Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

In this page you can find the example usage for java.awt BorderLayout EAST.

Prototype

String EAST

To view the source code for java.awt BorderLayout EAST.

Click Source Link

Document

The east layout constraint (right side of container).

Usage

From source file:com.hp.alm.ali.idea.ui.MultipleItemsDialog.java

public MultipleItemsDialog(Project project, String title, final MultipleItemsDialogModel<K, E> model) {
    super(project, title, true);

    this.model = model;

    mySelectionModel = new MySelectionModel();
    myListSelectionListener = new MyListSelectionListener();

    tooMany = new JLabel("Too many results, narrow your search");
    tooMany.setBorder(BorderFactory.createEtchedBorder());
    tooMany.setVisible(false);//from w w w  . j  a va2 s  .co m
    selected = new JLabel("Showing currently selected items");
    selected.setVisible(false);
    toggleSelected = new JToggleButton();
    toggleSelected.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            model.setShowingSelected(toggleSelected.isSelected());
            if (!model.isShowingSelected() && !model.getSelectedFields().isEmpty()) {
                updateSelectionFromModel();
            } else if (model.isShowingSelected()) {
                header.getFilterEditor(1).setContent("");
            }
        }
    });
    updateSelected();

    table = new JBTable() {
        @Override
        public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
            int column = convertColumnIndexToModel(columnIndex);
            mySelectionModel.setFirstColumnEvent(column == 0);
            super.changeSelection(rowIndex, columnIndex, toggle, extend);
        }
    };
    table.setRowSelectionAllowed(true);
    table.setColumnSelectionAllowed(false);
    table.setAutoCreateColumnsFromModel(false);
    table.setModel(model);
    final MyTableRowSorter sorter = new MyTableRowSorter(model);
    table.setRowSorter(sorter);
    table.setDefaultRenderer(Boolean.class, new MyRenderer());
    table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    table.setSelectionModel(mySelectionModel);

    sorter.setIgnoreAddRowSorterListener(true); // prevent auto-selection (functionality not accessible via proper API)
    header = new TableFilterHeader(table);
    sorter.setIgnoreAddRowSorterListener(false);

    sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(1, SortOrder.ASCENDING)));
    JPanel panel = new JPanel(new BorderLayout());
    JPanel toolbar = new JPanel(new BorderLayout());
    toolbar.setBorder(BorderFactory.createEtchedBorder());
    panel.add(toolbar, BorderLayout.NORTH);
    toolbar.add(toggleSelected, BorderLayout.EAST);

    if (model.isMultiple()) {
        table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

        table.getColumnModel().addColumn(createColumn(0, model, 45, 45));
        header.getFilterEditor(0).setEditable(false);
        header.getFilterEditor(0).setUserInteractionEnabled(false);

        final LinkListener selectUnselect = new LinkListener() {
            public void linkSelected(LinkLabel aSource, Object aLinkData) {
                if (model.isShowingSelected()) {
                    if (!Boolean.TRUE.equals(aLinkData)) {
                        List<Integer> ixs = new ArrayList<Integer>();
                        for (int i = 0; i < sorter.getViewRowCount(); i++) {
                            ixs.add(sorter.convertRowIndexToModel(i));
                        }
                        // make sure indexes are not affected by removal by starting from the last
                        Collections.sort(ixs);
                        Collections.reverse(ixs);
                        for (int ix : ixs) {
                            model.setValueAt(aLinkData, ix, 0);
                        }
                    }
                } else {
                    if (Boolean.TRUE.equals(aLinkData)) {
                        mySelectionModel.doAddSelectionInterval(0, table.getRowCount() - 1);
                    } else {
                        mySelectionModel.removeSelectionInterval(0, table.getRowCount() - 1);
                    }
                }
            }
        };

        JPanel left = new JPanel(new FlowLayout(FlowLayout.LEFT));
        left.add(new LinkLabel("Select All", IconLoader.getIcon("/actions/selectall.png"), selectUnselect,
                true));
        left.add(new LinkLabel("Unselect All", IconLoader.getIcon("/actions/unselectall.png"), selectUnselect,
                false));
        toolbar.add(left, BorderLayout.WEST);
    } else {
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }
    table.getColumnModel().addColumn(createColumn(1, model, 450, null));
    table.getSelectionModel().addListSelectionListener(myListSelectionListener);

    model.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            selected.setVisible(model.isShowingSelected());
            tooMany.setVisible(model.hasMore() && !model.isShowingSelected());
            updateSelected();
        }
    });

    JPanel contentPanel = new JPanel(new BorderLayout());
    contentPanel.add(selected, BorderLayout.NORTH);
    contentPanel.add(new JBScrollPane(table), BorderLayout.CENTER);
    contentPanel.add(tooMany, BorderLayout.SOUTH);
    panel.add(contentPanel, BorderLayout.CENTER);
    JPanel buttons = new JPanel();
    okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            ok = true;
            close(true);
        }
    });
    buttons.add(okButton);
    JButton cancel = new JButton("Cancel");
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            close(false);
        }
    });
    buttons.add(cancel);
    panel.add(buttons, BorderLayout.SOUTH);
    getContentPane().add(panel, BorderLayout.CENTER);

    pack();
    setResizable(false);
    centerOnOwner();

    requestPropertyFilterFocus(header);

    load(true, null);
}

From source file:net.sf.jabref.gui.fieldeditors.FileListEditor.java

public FileListEditor(JabRefFrame frame, BibDatabaseContext databaseContext, String fieldName, String content,
        EntryEditor entryEditor) {// ww w .j ava2  s .c o  m
    this.frame = frame;
    this.databaseContext = databaseContext;
    this.fieldName = fieldName;
    this.entryEditor = entryEditor;
    label = new FieldNameLabel(fieldName);
    tableModel = new FileListTableModel();
    setText(content);
    setModel(tableModel);
    JScrollPane sPane = new JScrollPane(this);
    setTableHeader(null);
    addMouseListener(new TableClickListener());

    JButton add = new JButton(IconTheme.JabRefIcon.ADD_NOBOX.getSmallIcon());
    add.setToolTipText(Localization.lang("New file link (INSERT)"));
    JButton remove = new JButton(IconTheme.JabRefIcon.REMOVE_NOBOX.getSmallIcon());
    remove.setToolTipText(Localization.lang("Remove file link (DELETE)"));
    JButton up = new JButton(IconTheme.JabRefIcon.UP.getSmallIcon());

    JButton down = new JButton(IconTheme.JabRefIcon.DOWN.getSmallIcon());
    auto = new JButton(Localization.lang("Get fulltext"));
    JButton download = new JButton(Localization.lang("Download from URL"));
    add.setMargin(new Insets(0, 0, 0, 0));
    remove.setMargin(new Insets(0, 0, 0, 0));
    up.setMargin(new Insets(0, 0, 0, 0));
    down.setMargin(new Insets(0, 0, 0, 0));
    add.addActionListener(e -> addEntry());
    remove.addActionListener(e -> removeEntries());
    up.addActionListener(e -> moveEntry(-1));
    down.addActionListener(e -> moveEntry(1));
    auto.addActionListener(e -> autoSetLinks());
    download.addActionListener(e -> downloadFile());

    FormBuilder builder = FormBuilder.create()
            .layout(new FormLayout("fill:pref,1dlu,fill:pref,1dlu,fill:pref", "fill:pref,fill:pref"));
    builder.add(up).xy(1, 1);
    builder.add(add).xy(3, 1);
    builder.add(auto).xy(5, 1);
    builder.add(down).xy(1, 2);
    builder.add(remove).xy(3, 2);
    builder.add(download).xy(5, 2);
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(sPane, BorderLayout.CENTER);
    panel.add(builder.getPanel(), BorderLayout.EAST);

    TransferHandler transferHandler = new FileListEditorTransferHandler(frame, entryEditor, null);
    setTransferHandler(transferHandler);
    panel.setTransferHandler(transferHandler);

    // Add an input/action pair for deleting entries:
    getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete");
    getActionMap().put("delete", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            int row = getSelectedRow();
            removeEntries();
            row = Math.min(row, getRowCount() - 1);
            if (row >= 0) {
                setRowSelectionInterval(row, row);
            }
        }
    });

    // Add an input/action pair for inserting an entry:
    getInputMap().put(KeyStroke.getKeyStroke("INSERT"), "insert");
    getActionMap().put("insert", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            addEntry();
        }
    });

    // Add input/action pair for moving an entry up:
    getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.FILE_LIST_EDITOR_MOVE_ENTRY_UP), "move up");
    getActionMap().put("move up", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            moveEntry(-1);
        }
    });

    // Add input/action pair for moving an entry down:
    getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.FILE_LIST_EDITOR_MOVE_ENTRY_DOWN), "move down");
    getActionMap().put("move down", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            moveEntry(1);
        }
    });

    JMenuItem openLink = new JMenuItem(Localization.lang("Open"));
    menu.add(openLink);
    openLink.addActionListener(e -> openSelectedFile());

    JMenuItem openFolder = new JMenuItem(Localization.lang("Open folder"));
    menu.add(openFolder);
    openFolder.addActionListener(e -> {
        int row = getSelectedRow();
        if (row >= 0) {
            FileListEntry entry = tableModel.getEntry(row);
            try {
                String path = "";
                // absolute path
                if (Paths.get(entry.link).isAbsolute()) {
                    path = Paths.get(entry.link).toString();
                } else {
                    // relative to file folder
                    for (String folder : databaseContext.getFileDirectory()) {
                        Path file = Paths.get(folder, entry.link);
                        if (Files.exists(file)) {
                            path = file.toString();
                            break;
                        }
                    }
                }
                if (!path.isEmpty()) {
                    JabRefDesktop.openFolderAndSelectFile(path);
                } else {
                    JOptionPane.showMessageDialog(frame, Localization.lang("File not found"),
                            Localization.lang("Error"), JOptionPane.ERROR_MESSAGE);
                }
            } catch (IOException ex) {
                LOGGER.debug("Cannot open folder", ex);
            }
        }
    });

    JMenuItem rename = new JMenuItem(Localization.lang("Move/Rename file"));
    menu.add(rename);
    rename.addActionListener(new MoveFileAction(frame, entryEditor, this, false));

    JMenuItem moveToFileDir = new JMenuItem(Localization.lang("Move file to file directory"));
    menu.add(moveToFileDir);
    moveToFileDir.addActionListener(new MoveFileAction(frame, entryEditor, this, true));

    JMenuItem deleteFile = new JMenuItem(Localization.lang("Delete local file"));
    menu.add(deleteFile);
    deleteFile.addActionListener(e -> {
        int row = getSelectedRow();
        // no selection
        if (row != -1) {

            FileListEntry entry = tableModel.getEntry(row);
            // null if file does not exist
            Optional<File> file = FileUtil.expandFilename(databaseContext, entry.link);

            // transactional delete and unlink
            try {
                if (file.isPresent()) {
                    Files.delete(file.get().toPath());
                }
                removeEntries();
            } catch (IOException ex) {
                JOptionPane.showMessageDialog(frame, Localization.lang("File permission error"),
                        Localization.lang("Cannot delete file"), JOptionPane.ERROR_MESSAGE);
                LOGGER.warn("File permission error while deleting: " + entry.link, ex);
            }
        }
    });
    adjustColumnWidth();
}

From source file:jhplot.gui.GHPanel.java

/**
 * Create a panel with graphics. By default, all margins have size of 10
 * pixels. Background color is white. Initialization of JHPLot classes are
 * done here./* w ww.  j  av a2  s  .c o m*/
 * 
 * @param Width
 *            in pixels
 * @param Height
 *            in pixels
 */
public GHPanel(int Width, int Height) {

    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");

    CanvasPanel = new JPanel();

    // build export file tipes
    // list = new List<ExportFileType>();
    // List<ExportFileType> list = ExportFileType.getExportFileTypes();
    // addAllExportFileTypes();

    this.Width = Width;
    this.Height = Height;

    // what if the screen size is smaller?
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int Sheight = screenSize.height;
    int Swidth = screenSize.width;
    if (Swidth < this.Width || Sheight < this.Height) {
        this.Width = (int) (0.5 * Swidth);
        this.Height = (int) (0.5 * Sheight);
    }

    CanvasPanel.addComponentListener(this);
    CanvasPanel.setPreferredSize(new Dimension(Width, Height));
    CanvasPanel.setMinimumSize(new Dimension(20, 20));

    leftSize = (int) (Width * 0.025);
    rightSize = (int) (Width * 0.025);
    bottomSize = (int) (Height * 0.025);
    topSize = (int) (Height * 0.025);

    backMargin = Color.white;

    mainPanel = new JPanel();

    topPanel = new GHMargin(this, "Top"); // left panel
    topPanel.setGBackground(backMargin);
    topPanel.setGRecBackground(backMargin);

    leftPanel = new GHMargin(this, "Left"); // left panel
    leftPanel.setGBackground(backMargin);
    leftPanel.setGRecBackground(backMargin);

    rightPanel = new GHMargin(this, "Right"); // right panel
    rightPanel.setGBackground(backMargin);
    rightPanel.setGRecBackground(backMargin);

    bottomPanel = new GHMargin(this, "Bottom"); // buttom panel
    bottomPanel.setGBackground(backMargin);
    rightPanel.setGRecBackground(backMargin);

    leftPanel.setSizeMargin(leftSize, Height);
    rightPanel.setSizeMargin(rightSize, Height);
    bottomPanel.setSizeMargin(Width, bottomSize);
    topPanel.setSizeMargin(Width, topSize);

    // invert to GridLayout(); Gaps are zero
    mainPanel.setBackground(Color.white);
    mainPanel.setBorder(BorderFactory.createEmptyBorder());

    CanvasPanel.setLayout(new BorderLayout());

    CanvasPanel.add(mainPanel, BorderLayout.CENTER);
    CanvasPanel.add(leftPanel, BorderLayout.WEST);
    CanvasPanel.add(rightPanel, BorderLayout.EAST);
    CanvasPanel.add(bottomPanel, BorderLayout.SOUTH);
    CanvasPanel.add(topPanel, BorderLayout.NORTH);

    // no boarder
    CanvasPanel.setBorder(BorderFactory.createEmptyBorder());

    // initialisation
    JHPlot.init();

}

From source file:gui.QTLResultsPanel.java

/** QTLResultsPanel().
 * //from w w  w. j  a va2 s  .c o m
 * @param qtlResult = the QTL results to show.
 * @param order = the ordered result data this QTL was created from. 
 */
public QTLResultsPanel(QTLResult qtlResult, OrderedResult order) {
    this.qtlResult = qtlResult;
    this.order = order;

    // Trait listbox
    traitModel = new DefaultListModel<Trait>();
    for (Trait trait : qtlResult.getTraits()) {
        traitModel.addElement(trait);
    }
    traitList = new JList<Trait>(traitModel);
    traitList.addListSelectionListener(this);
    traitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane sp1 = new JScrollPane(traitList);
    sp1.setPreferredSize(new Dimension(125, 50));

    // Details text box
    details = new JTextArea();
    details.setFont(new Font("Monospaced", Font.PLAIN, 11));
    details.setMargin(new Insets(2, 5, 2, 5));
    details.setEditable(false);
    details.setTabSize(6);
    JScrollPane sp4;
    if (AppFrame.tpmmode == AppFrame.TPMMODE_QTL) {
        simpleDetails = new JScrollPane();
        simpleDetails.setFont(new Font("Monospaced", Font.PLAIN, 11));
        simplesplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        simpleright = new JTextArea();
        simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11));
        simpleright.setMargin(new Insets(2, 5, 2, 5));
        simpleright.setEditable(false);
        simpleright.setTabSize(6);
        simplesplit.setRightComponent(new JScrollPane(simpleright));

        simplesplit.setLeftComponent(simpleDetails);
        sp4 = new JScrollPane(simplesplit);
    } else {
        // TPM MODE NONSNP
        simpleright = new JTextArea();
        simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11));
        simpleright.setMargin(new Insets(2, 5, 2, 5));
        simpleright.setEditable(false);
        sp4 = new JScrollPane(simpleright);
    }

    lodDetails = new JTextArea();
    lodDetails.setFont(new Font("Monospaced", Font.PLAIN, 11));
    lodDetails.setMargin(new Insets(2, 5, 2, 5));
    lodDetails.setEditable(false);
    lodDetails.setTabSize(6);
    JScrollPane sp3 = new JScrollPane(lodDetails);
    JTabbedPane tabs = new JTabbedPane();
    JScrollPane sp2 = new JScrollPane(details);
    tabs.add(sp2, "Full Model");
    tabs.add(sp4, "Simple Model");
    tabs.add(sp3, "LOD Details");

    // The splitpane
    splits = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splits.setTopComponent(new JPanel());
    splits.setBottomComponent(tabs);
    splits.setResizeWeight(0.5);

    // pane2
    JSplitPane splits2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splits2.setLeftComponent(sp1);
    splits2.setRightComponent(splits);

    setLayout(new BorderLayout());
    add(new GradientPanel("QTL Analysis Results"), BorderLayout.NORTH);
    // add(sp1, BorderLayout.WEST);
    // add(splits);
    add(splits2);
    add(toolbar = new QTLResultsToolBar(this), BorderLayout.EAST);
}

From source file:net.aepik.alasca.gui.util.LoadFileFrame.java

/**
 * Initialize frame content./*from   ww  w.  java 2 s. co  m*/
 */
private void initFrame() {
    // - Panel bouton du bas -

    JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    boutonsPanel.add(boutonOk);
    boutonsPanel.add(boutonAnnuler);

    // - Panel nom du fichier -

    JTextArea textAreaFilename = new JTextArea(
            "Indiquez le nom du fichier contenant les dfinitions du schma LDAP que vous souhaitez charger.");
    textAreaFilename.setEditable(false);
    textAreaFilename.setLineWrap(true);
    textAreaFilename.setWrapStyleWord(true);
    textAreaFilename.setFont((new JLabel()).getFont());
    textAreaFilename.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6));
    textAreaFilename.setBackground(new Color(240, 235, 226));

    boutonOpenFile.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 5, 0, 0, boutonsPanel.getBackground()),
            boutonOpenFile.getBorder()));

    JPanel filenamePanel = new JPanel(new BorderLayout());
    filenamePanel.add(textAreaFilename, BorderLayout.NORTH);
    filenamePanel.add(filename, BorderLayout.CENTER);
    filenamePanel.add(boutonOpenFile, BorderLayout.EAST);
    filenamePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Schma LDAP "),
                    BorderFactory.createEmptyBorder(0, 5, 5, 5))));

    // - Panel du selecteur de syntaxes -

    JTextArea textAreaSyntaxes = new JTextArea(
            "Il vous faut appliquer un filtre sur le schma que vous voulez charger. Voici la liste des filtres disponibles :");
    textAreaSyntaxes.setEditable(false);
    textAreaSyntaxes.setLineWrap(true);
    textAreaSyntaxes.setWrapStyleWord(true);
    textAreaSyntaxes.setFont((new JLabel()).getFont());
    textAreaSyntaxes.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6));
    textAreaSyntaxes.setBackground(new Color(240, 235, 226));

    JPanel syntaxesPanel = new JPanel(new BorderLayout());
    syntaxesPanel.add(textAreaSyntaxes, BorderLayout.NORTH);
    syntaxesPanel.add(syntaxes);
    syntaxesPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Syntaxe LDAP "),
                    BorderFactory.createEmptyBorder(0, 5, 5, 5))));

    // On injecte le nom des classes de syntaxes possibles
    // dynamiquement.
    String[] syntaxesName = Schema.getSyntaxeNames();
    for (int i = 0; syntaxesName != null && i < syntaxesName.length; i++) {
        syntaxes.addItem(syntaxesName[i]);
    }

    // - Organisation gnrale -

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(filenamePanel, BorderLayout.NORTH);
    mainPanel.add(syntaxesPanel, BorderLayout.CENTER);

    JPanel mainPanelContainer = new JPanel(new BorderLayout());
    mainPanelContainer.add(mainPanel, BorderLayout.NORTH);
    mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH);
    mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1));

    getContentPane().add(new DescriptiveInternalFrame(mainFrame.getIconImage(),
            "Slectionner un fichier et sa syntaxe.", mainPanelContainer));

    // - Listeners -

    addWindowListener(this);
    boutonOpenFile.addActionListener(this);
    boutonOk.addActionListener(this);
    boutonAnnuler.addActionListener(this);
}

From source file:gui.GraphsPanel.java

/** TV constructor for DendrogramsPanel to be called when clustering SNP marker data.
 * /*  w w w  .  j a  v  a 2s  .  co  m*/
 */
public GraphsPanel(Cluster cluster, int tpmmode) {
    this.cluster = cluster;
    graph = cluster.getGraph();

    final Factory<TreeNode> vertexFactory = new Factory<TreeNode>() {
        TreeNode treeVertice;

        public TreeNode create() {
            return treeVertice;
        }
    };
    final Factory<TreeNode> edgeFactory = new Factory<TreeNode>() {
        TreeNode treeEdge;

        public TreeNode create() {
            return treeEdge;
        }
    };

    balloonLayout = new BalloonLayout<TreeNode, TreeNode>(graph);
    radialLayout = new RadialTreeLayout<TreeNode, TreeNode>((Forest<TreeNode, TreeNode>) graph, 10000, 10000);
    vv = new VisualizationViewer<TreeNode, TreeNode>(radialLayout);
    vv.setBackground(Color.white);
    vv.setVertexToolTipTransformer(vertexString);
    vv.setEdgeToolTipTransformer(edgeString);
    vv.getRenderContext().setArrowFillPaintTransformer(arrowFillColor);
    vv.getRenderContext().setArrowDrawPaintTransformer(arrowColor);
    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeColor);

    balloonrings = new BalloonRings(balloonLayout);
    radialrings = new RadialRings(radialLayout);

    EditingModalGraphMouse<TreeNode, TreeNode> gm = new EditingModalGraphMouse<TreeNode, TreeNode>(
            vv.getRenderContext(), vertexFactory, edgeFactory);
    gm.add(new ReEditingPopupGraphMousePlugin<TreeNode, TreeNode>(vertexFactory, edgeFactory));
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);

    vv.getRenderContext().setVertexFillPaintTransformer(vertexColor);
    vv.getRenderContext().setVertexShapeTransformer(vertexSize);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<TreeNode, TreeNode>());

    // final GraphZoomScrollPane
    zoomScrollPane = new GraphZoomScrollPane(this.vv);
    this.setLayout(new BorderLayout());
    this.add(zoomScrollPane, BorderLayout.CENTER);

    this.toolbar = new GraphToolBar(this);// , canvas, chart);
    this.add(toolbar, BorderLayout.EAST);

    this.label = new JLabel("<html><table><tr><td> Similarity: " + Prefs.d3.format(this.getThreshold())
            + "</td><td> Groups: " + cluster.getAvLnkDendrogram().getGroupCount(this.getThreshold())
            + "</td><td>        </td><td> Distinctiveness: " + Prefs.d3.format(this.getSensitivity())
            + "</td><td> Subgroups: " + cluster.getAvLnkDendrogram().getWeakEdgeCount(this.getSensitivity())
            + "</td></tr></table></html>");
    this.label.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    this.add(label, BorderLayout.SOUTH);

    this.setVisible(true);
}

From source file:com.floreantpos.ui.dialog.DiscountSelectionDialog.java

private void createCouponSearchPanel() {
    itemSearchPanel = new JPanel(new BorderLayout(5, 5));
    PosButton btnSearch = new PosButton("...");
    btnSearch.setPreferredSize(new Dimension(60, 40));

    JLabel lblCoupon = new JLabel("Enter Coupon Number");

    txtSearchItem = new JTextField();
    txtSearchItem.addFocusListener(new FocusListener() {
        @Override/*from w  w  w . ja v  a 2 s.co m*/
        public void focusLost(FocusEvent e) {
            txtSearchItem.setText("Scan barcode");
            txtSearchItem.setForeground(Color.gray);
        }

        @Override
        public void focusGained(FocusEvent e) {
            txtSearchItem.setForeground(Color.black);
            txtSearchItem.setText("");
        }
    });

    txtSearchItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (txtSearchItem.getText().equals("")) {
                POSMessageDialog.showMessage("Please enter coupon number or barcode ");
                return;
            }
            if (!addCouponByBarcode(txtSearchItem.getText())) {
                addCouponById(txtSearchItem.getText());
            }
            txtSearchItem.setText("");
        }
    });

    btnSearch.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ItemSearchDialog dialog = new ItemSearchDialog(Application.getPosWindow());
            dialog.setTitle("Search Coupon");
            dialog.pack();
            dialog.open();
            if (dialog.isCanceled()) {
                return;
            }

            txtSearchItem.requestFocus();

            if (!addCouponByBarcode(dialog.getValue())) {
                if (!addCouponById(dialog.getValue())) {
                    POSMessageDialog.showError(Application.getPosWindow(), "Coupon not found");
                }
            }
        }
    });
    itemSearchPanel.add(lblCoupon, BorderLayout.WEST);
    itemSearchPanel.add(txtSearchItem);
    itemSearchPanel.add(btnSearch, BorderLayout.EAST);
}

From source file:tvbrowser.ui.filter.dlgs.EditFilterDlg.java

public EditFilterDlg(JFrame parent, FilterList filterList, UserFilter filter) {

    super(parent, true);

    UiUtilities.registerForClosing(this);

    mFilterList = filterList;//from   w  w w  . ja  v  a 2 s  . com
    mParent = parent;
    mFilter = filter;

    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setLayout(new BorderLayout(7, 7));
    contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    if (filter == null) {
        setTitle(mLocalizer.msg("titleNew", "Create filter"));
    } else {
        setTitle(mLocalizer.msg("titleEdit", "Edit filter {0}", filter.toString()));
        mFilterName = filter.toString();
    }

    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));

    mFilterNameTF = new JTextField(new PlainDocument() {

        public void insertString(int offset, String str, AttributeSet a) throws BadLocationException {
            str = str.replaceAll("[\\p{Punct}&&[^_]]", "_");
            super.insertString(offset, str, a);
        }
    }, "", 30);

    mFilterNameTF.getDocument().addDocumentListener(this);
    JPanel panel = new JPanel(new BorderLayout(7, 7));
    panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0));
    panel.add(new JLabel(mLocalizer.msg("filterName", "Filter name:")), BorderLayout.WEST);
    JPanel panel1 = new JPanel(new BorderLayout());
    panel1.add(mFilterNameTF, BorderLayout.WEST);
    panel.add(panel1, BorderLayout.CENTER);
    northPanel.add(panel);

    mFilterRuleTF = new JTextField();
    mFilterRuleTF.getDocument().addDocumentListener(this);
    mFilterRuleTF.addCaretListener(this);
    panel = new JPanel(new BorderLayout(7, 7));
    panel1 = new JPanel(new BorderLayout());
    panel.add(new JLabel(mLocalizer.msg("ruleString", "Filter rule:")), BorderLayout.WEST);
    JLabel exampleLb = new JLabel(
            mLocalizer.msg("ruleExample", "example: component1 or (component2 and not component3)"));
    Font f = exampleLb.getFont();
    exampleLb.setFont(new Font(f.getName(), Font.ITALIC | Font.PLAIN, f.getSize()));
    panel1.add(exampleLb, BorderLayout.WEST);
    panel.add(panel1, BorderLayout.CENTER);
    northPanel.add(panel);
    northPanel.add(mFilterRuleTF);
    mFilterRuleErrorLb = new JLabel();
    mFilterRuleErrorLb.setForeground(Color.red);
    panel = new JPanel(new BorderLayout(7, 7));
    panel.add(mFilterRuleErrorLb, BorderLayout.WEST);
    mColLb = new JLabel("0");
    panel.add(mColLb, BorderLayout.EAST);
    northPanel.add(panel);

    JPanel filterComponentsPanel = new JPanel(new BorderLayout(7, 7));
    filterComponentsPanel.add(DefaultComponentFactory.getInstance().createSeparator(
            mLocalizer.msg("componentsTitle", "Available filter components:")), BorderLayout.NORTH);
    JPanel btnPanel = new JPanel(new BorderLayout());
    panel1 = new JPanel(new GridLayout(0, 1, 0, 7));

    mNewBtn = new JButton(mLocalizer.msg("newButton", "new"));
    mEditBtn = new JButton(Localizer.getLocalization(Localizer.I18N_EDIT));
    mRemoveBtn = new JButton(Localizer.getLocalization(Localizer.I18N_DELETE));

    mNewBtn.addActionListener(this);
    mEditBtn.addActionListener(this);
    mRemoveBtn.addActionListener(this);

    panel1.add(mNewBtn);
    panel1.add(mEditBtn);
    panel1.add(mRemoveBtn);

    btnPanel.add(panel1, BorderLayout.NORTH);

    mComponentTableModel = new FilterTableModel();

    mRuleTableBox = new JTable(mComponentTableModel);
    mRuleTableBox.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            updateBtns();
        }
    });

    mRuleTableBox.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() >= 2) {
                int row = mRuleTableBox.rowAtPoint(e.getPoint());

                if (mRuleTableBox.getSelectedRow() == row && mEditBtn.isEnabled()) {
                    actionPerformed(new ActionEvent(mEditBtn, ActionEvent.ACTION_PERFORMED,
                            mEditBtn.getActionCommand()));
                }
            }
        }
    });

    mRuleTableBox.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    mRuleTableBox.setShowGrid(false);
    mRuleTableBox.setShowVerticalLines(true);
    mRuleTableBox.getColumnModel().getColumn(0).setPreferredWidth(125);
    mRuleTableBox.getColumnModel().getColumn(1).setPreferredWidth(320);
    //    mRuleTableBox.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    // Dispatchs the KeyEvent to the RootPane for Closing the Dialog.
    // Needed for Java 1.4.
    mRuleTableBox.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                mRuleTableBox.getRootPane().dispatchEvent(e);
            }
        }
    });

    JPanel ruleListBoxPanel = new JPanel(new BorderLayout());
    ruleListBoxPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0));
    ruleListBoxPanel.add(new JScrollPane(mRuleTableBox), BorderLayout.CENTER);

    filterComponentsPanel.add(btnPanel, BorderLayout.EAST);
    filterComponentsPanel.add(ruleListBoxPanel, BorderLayout.CENTER);

    ButtonBarBuilder2 bottomBar = Utilities.createFilterButtonBar();

    mOkBtn = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    mOkBtn.addActionListener(this);
    getRootPane().setDefaultButton(mOkBtn);

    mCancelBtn = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
    mCancelBtn.addActionListener(this);

    bottomBar.addButton(new JButton[] { mOkBtn, mCancelBtn });

    contentPane.add(northPanel, BorderLayout.NORTH);
    contentPane.add(filterComponentsPanel, BorderLayout.CENTER);
    contentPane.add(bottomBar.getPanel(), BorderLayout.SOUTH);

    if (mFilter != null) {
        mFilterNameTF.setText(mFilter.toString());
        mFilterRuleTF.setText(mFilter.getRule());
    }

    FilterComponent[] fc = FilterComponentList.getInstance().getAvailableFilterComponents();

    Arrays.sort(fc, new FilterComponent.NameComparator());

    for (FilterComponent element : fc) {
        mComponentTableModel.addElement(element);
    }

    updateBtns();

    Settings.layoutWindow("editFilterDlg", this, new Dimension(600, 300));
    setVisible(true);
}

From source file:eu.europeana.sip.gui.SipCreatorGUI.java

public SipCreatorGUI() throws FileStoreException {
    super("Delving SIP Creator");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    MetadataModel metadataModel = loadMetadataModel();
    File fileStoreDirectory = getFileStoreDirectory();
    FileStore fileStore = new FileStoreImpl(fileStoreDirectory, metadataModel);
    GroovyCodeResource groovyCodeResource = new GroovyCodeResource();
    this.dataSetListModel = new DataSetListModel(new DataSetListModel.ConnectedStatus() {
        @Override/*from   w ww.j a  v  a2s.  c  o m*/
        public boolean isConnected() {
            return connectedBox.isSelected();
        }
    });
    this.dataSetList = new JList(dataSetListModel);
    this.sipModel = new SipModel(fileStore, metadataModel, groovyCodeResource, new PopupExceptionHandler());
    this.dataSetClient = new DataSetClient(new DataSetClient.Context() {

        @Override
        public String getServerUrl() {
            return sipModel.getAppConfigModel().getServerUrl();
        }

        @Override
        public String getAccessKey() {
            return sipModel.getAppConfigModel().getAccessKey();
        }

        @Override
        public void setInfo(DataSetInfo dataSetInfo) {
            dataSetListModel.setDataSetInfo(dataSetInfo);
            dataSetActions.setDataSetInfo(dataSetInfo);
        }

        @Override
        public void setList(List<DataSetInfo> list) {
            if (list != null) {
                Set<String> untouched = dataSetListModel.setDataSetInfoList(list);
                if (!untouched.isEmpty()) {
                    dataSetActions.setUntouched(untouched);
                }
                for (DataSetInfo dataSetInfo : list) {
                    dataSetActions.setDataSetInfo(dataSetInfo);
                }
            } else {
                log.warn("received empty list from the server");
            }
        }

        @Override
        public void tellUser(String message) {
            sipModel.getUserNotifier().tellUser(message);
        }

        @Override
        public void disconnected() {
            connectedBox.setSelected(false);
            sipModel.getUserNotifier().tellUser(String.format("Disconnected from Repository at %s",
                    sipModel.getAppConfigModel().getServerHostPort()));
        }
    });
    dataSetActions = new DataSetActions(this, sipModel, dataSetClient, new Runnable() {
        @Override
        public void run() {
            dataSetListModel.clear();
            for (FileStore.DataSetStore dataSetStore : sipModel.getFileStore().getDataSetStores().values()) {
                dataSetListModel.setDataSetStore(dataSetStore);
            }
            dataSetListModel.setPattern(filter.getText());
        }
    });
    setJMenuBar(createMenuBar());
    JPanel main = new JPanel(new BorderLayout(MARGIN, MARGIN));
    main.setBorder(BorderFactory.createEmptyBorder(MARGIN, MARGIN, MARGIN, MARGIN));
    JPanel north = new JPanel(new BorderLayout());
    north.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(MARGIN, MARGIN, 0, MARGIN),
                    BorderFactory.createRaisedBevelBorder()));
    titleLabel.setOpaque(true);
    titleLabel.setFont(new Font("Sans", Font.BOLD, 24));
    JLabel northRight = new JLabel(new ImageIcon(getClass().getResource("/delving-logo.png")));
    north.add(createFilterPanel(), BorderLayout.WEST);
    north.add(titleLabel, BorderLayout.CENTER);
    north.add(northRight, BorderLayout.EAST);
    getContentPane().add(north, BorderLayout.NORTH);
    getContentPane().add(main, BorderLayout.CENTER);
    JPanel south = new JPanel(new GridLayout(1, 0));
    south.add(createConnectPanel());
    south.add(createFinishedPanel());
    getContentPane().add(south, BorderLayout.SOUTH);
    main.add(createList(), BorderLayout.CENTER);
    main.add(dataSetActions.getPanel(), BorderLayout.EAST);
    setSize(SIZE);
    setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - SIZE.width) / 2,
            (Toolkit.getDefaultToolkit().getScreenSize().height - SIZE.height) / 2);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            for (FileStore.DataSetStore dataSetStore : sipModel.getFileStore().getDataSetStores().values()) {
                dataSetListModel.setDataSetStore(dataSetStore);
            }
        }
    });
}

From source file:org.ut.biolab.medsavant.client.view.genetics.GeneticsTablePage.java

/**
 * Splits the main table view into an upper and lower section.
 * The upper section contains the main table pane, and the lower section
 * contains the given JPanel.     // w ww.  j  a v a 2  s . c o  m
 */
/*
@Override
public void splitScreen(JPanel p){
split = true;
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tablePanel, p);
splitPane.setResizeWeight(1);        
outerTablePanel.removeAll();
outerTablePanel.add(splitPane);
outerTablePanel.revalidate();
outerTablePanel.repaint();
}
        
@Override
public void unsplitScreen(){
split = false;
outerTablePanel.removeAll();
outerTablePanel.add(tablePanel);
outerTablePanel.revalidate();
outerTablePanel.repaint();
}
        
@Override
public boolean isSplit(){
return split;
}*/

@Override
public JPanel getView() {
    try {
        if (view == null) {

            view = new JPanel();
            view.setLayout(new BorderLayout());
            view.add(new WaitPanel("Preparing Spreadsheet..."));

            Runnable prepareViewInBackground = new Runnable() {
                @Override
                public void run() {
                    try {
                        LOG.debug("Running thread prepareViewINBackground!");
                        final JPanel tmpView = new JPanel();
                        tmpView.setLayout(new BorderLayout());

                        tablePanel = new TablePanel(pageName);
                        SplitScreenPanel ssp = new SplitScreenPanel(tablePanel);

                        final ComprehensiveInspector inspectorPanel = new ComprehensiveInspector(true, true,
                                true, true, true, true, true, ssp);

                        inspectorPanel.addSelectionListener(new Listener<Object>() {
                            @Override
                            public void handleEvent(Object event) {
                                clearSelection();
                            }
                        });

                        TablePanel.addVariantSelectionChangedListener(new Listener<VariantRecord>() {
                            @Override
                            public void handleEvent(final VariantRecord r) {
                                inspectorPanel.setVariantRecord(r);
                            }
                        });
                        LOG.debug("Constructing detailView");
                        detailView = new PeekingPanel("Detail", BorderLayout.WEST, inspectorPanel, false,
                                StaticInspectorPanel.INSPECTOR_WIDTH);
                        detailView.setToggleBarVisible(false);

                        tmpView.add(detailView, BorderLayout.EAST);
                        //outerTablePanel = new JPanel();
                        //outerTablePanel.setLayout(new BoxLayout(outerTablePanel, BoxLayout.Y_AXIS));

                        //outerTablePanel.add(tablePanel);
                        //tmpView.add(outerTablePanel, BorderLayout.CENTER);
                        tmpView.add(ssp, BorderLayout.CENTER);

                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                view.removeAll();
                                view.add(tmpView, BorderLayout.CENTER);
                                view.updateUI();
                            }
                        });

                    } catch (Exception ex) {
                        LOG.error(ex);
                        System.out.println("Caught spreadsheet loading error: " + ex);
                        ex.printStackTrace();
                        view.removeAll();
                        WaitPanel p = new WaitPanel("Error loading Spreadsheet");
                        p.setComplete();
                        view.add(p);

                    }
                }
            };

            viewPreparationThread = new Thread(prepareViewInBackground);
            viewPreparationThread.start();

        }

        return view;

    } catch (Exception ex) {
        ClientMiscUtils.reportError("Error generating genome view: %s", ex);
    }
    return view;
}