Example usage for javax.swing JSplitPane setOrientation

List of usage examples for javax.swing JSplitPane setOrientation

Introduction

In this page you can find the example usage for javax.swing JSplitPane setOrientation.

Prototype

@BeanProperty(enumerationValues = { "JSplitPane.HORIZONTAL_SPLIT",
        "JSplitPane.VERTICAL_SPLIT" }, description = "The orientation, or how the splitter is divided.")
public void setOrientation(int orientation) 

Source Link

Document

Sets the orientation, or how the splitter is divided.

Usage

From source file:SwingSplitSample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("JSplitPane Sample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    frame.getContentPane().add(splitPane, BorderLayout.CENTER);
    frame.setSize(300, 200);/*from  w  w  w . j  av  a  2 s. c o m*/
    frame.setVisible(true);
}

From source file:SplitPaneSample.java

public static void main(String args[]) {
    JFrame vFrame = new JFrame("JSplitPane Sample");
    vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JSplitPane vSplitPane = new JSplitPane();
    vSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    vFrame.getContentPane().add(vSplitPane, BorderLayout.CENTER);
    vFrame.setSize(300, 150);//from  w w w .  j  ava 2s  .c  o  m
    vFrame.setVisible(true);

    JFrame hFrame = new JFrame("JSplitPane Sample");
    JSplitPane hSplitPane = new JSplitPane();
    hFrame.getContentPane().add(hSplitPane, BorderLayout.CENTER);
    hFrame.setSize(300, 150);
    hFrame.setVisible(true);
}

From source file:hu.bme.mit.sette.snippetbrowser.SnippetBrowser.java

/**
 * Initialise the contents of the frame.
 *//* w  w w  . jav a2  s. c  om*/
private void initialize() {
    setTitle("Snippet Browser");
    this.setBounds(50, 50, 1000, 600);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setResizeWeight(0.3);
    getContentPane().add(splitPane, BorderLayout.CENTER);

    JScrollPane scrollPaneLeft = new JScrollPane();
    splitPane.setLeftComponent(scrollPaneLeft);

    treeSnippets = new JTree();
    scrollPaneLeft.setViewportView(treeSnippets);

    JScrollPane scrollPaneRight = new JScrollPane();
    splitPane.setRightComponent(scrollPaneRight);

    txtrInfo = new JTextArea();
    txtrInfo.setEditable(false);
    scrollPaneRight.setViewportView(txtrInfo);
}

From source file:logdruid.ui.mainpanel.StatRecordingSelectorPanel.java

/**
 * Create the panel./*  ww w .  j  ava 2 s  .c  om*/
 */
public StatRecordingSelectorPanel(final Repository rep, Source src) {
    repository = rep;
    source = src;
    records = rep.getRecordings(StatRecording.class);
    // Collections.sort(records);
    Iterator it = records.iterator();
    while (it.hasNext()) {
        Recording record = (Recording) it.next();
        data.add(new Object[] { record.getName(), record.getRegexp(), record.getType(),
                src.isActiveRecordingOnSource(record) });
    }

    model = new logdruid.ui.mainpanel.StatRecordingSelectorPanel.MyTableModel(data, header);

    StatRecordingSelectorPanel thiis = this;
    logger.info("source is " + ((source == null) ? "null" : src.getSourceName()));
    setLayout(new BorderLayout(0, 0));

    JPanel panel_1 = new JPanel();
    panel_1.setLayout(new BorderLayout(0, 0));

    table = new JTable(model);
    JScrollPane scrollPane = new JScrollPane(table);
    panel_1.add(scrollPane, BorderLayout.CENTER);

    table.setPreferredScrollableViewportSize(new Dimension(0, 150));
    table.setFillsViewportHeight(true);
    table.setAutoCreateRowSorter(true);
    // Set up column sizes.
    initColumnSizes(table);

    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(splitPane);

    jPanelDetail = new JPanel();
    splitPane.setBottomComponent(jPanelDetail);
    splitPane.setTopComponent(panel_1);
    jPanelDetail.setLayout(new BorderLayout(0, 0));
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            logger.info("ListSelectionListener - selectedRow: " + selectedRow);
            if (selectedRow >= 0) {
                if (jPanelDetail != null) {
                    logger.debug("ListSelectionListener - valueChanged");
                    jPanelDetail.removeAll();
                    recEditor = getEditor(repository.getRecording(StatRecording.class, selectedRow));
                    if (recEditor != null) {
                        jPanelDetail.add(recEditor, BorderLayout.CENTER);
                    }
                    jPanelDetail.revalidate();
                }
            }
        }
    });
    if (repository.getRecordings(StatRecording.class).size() > 0) {
        recEditor = getEditor(repository.getRecording(StatRecording.class, 0));
        jPanelDetail.add(recEditor, BorderLayout.CENTER);
        table.setRowSelectionInterval(0, 0);
    }
    if (model.getRowCount() > 0) {
        table.getRowSorter().toggleSortOrder(0);
        table.setRowSelectionInterval(0, 0);

    }
}

From source file:logdruid.ui.mainpanel.EventRecordingSelectorPanel.java

/**
 * Create the panel./*w w  w. ja  va 2  s  .com*/
 */
public EventRecordingSelectorPanel(final Repository rep, Source src) {
    repository = rep;
    source = src;
    records = rep.getRecordings(EventRecording.class);
    // Collections.sort(records);
    Iterator it = records.iterator();
    while (it.hasNext()) {
        Recording record = (Recording) it.next();
        data.add(new Object[] { record.getName(), record.getRegexp(), record.getType(),
                src.isActiveRecordingOnSource(record) });
    }

    model = new logdruid.ui.mainpanel.EventRecordingSelectorPanel.MyTableModel(data, header);
    logger.info("source is " + ((source == null) ? "null" : src.getSourceName()));
    JPanel panel_1 = new JPanel();
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.insets = new Insets(5, 0, 5, 5);
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 0;
    panel_1.setLayout(new BorderLayout(0, 0));

    table = new JTable(model);
    JScrollPane scrollPane = new JScrollPane(table);
    panel_1.add(scrollPane, BorderLayout.CENTER);

    table.setPreferredScrollableViewportSize(new Dimension(0, 150));
    table.setFillsViewportHeight(true);
    table.setAutoCreateRowSorter(true);

    // Set up column sizes.
    initColumnSizes(table);

    setLayout(new BorderLayout(0, 0));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(splitPane);
    jPanelDetail = new JPanel();
    splitPane.setBottomComponent(jPanelDetail);
    splitPane.setTopComponent(panel_1);

    GridBagConstraints gbc_jPanelDetail = new GridBagConstraints();
    gbc_jPanelDetail.insets = new Insets(0, 0, 0, 5);
    gbc_jPanelDetail.fill = GridBagConstraints.BOTH;
    gbc_jPanelDetail.gridx = 1;
    gbc_jPanelDetail.gridy = 3;
    jPanelDetail.setLayout(new BorderLayout(0, 0));
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            logger.info("ListSelectionListener - selectedRow: " + selectedRow);
            if (selectedRow >= 0) {
                if (jPanelDetail != null) {
                    logger.debug("ListSelectionListener - valueChanged");
                    jPanelDetail.removeAll();
                    recEditor = getEditor(repository.getRecording(EventRecording.class, selectedRow));
                    if (recEditor != null) {
                        jPanelDetail.add(recEditor, BorderLayout.CENTER);
                    }
                    jPanelDetail.revalidate();
                }
            }
        }
    });
    if (repository.getRecordings(EventRecording.class).size() > 0) {
        recEditor = getEditor(repository.getRecording(EventRecording.class, 0));
        jPanelDetail.add(recEditor, BorderLayout.CENTER);
        table.setRowSelectionInterval(0, 0);
    }
    if (model.getRowCount() > 0) {
        table.getRowSorter().toggleSortOrder(0);
        table.setRowSelectionInterval(0, 0);
    }
}

From source file:com.sri.ai.praise.demo.ChurchPanel.java

private void initialize() {
    setLayout(new BorderLayout(0, 0));

    JPanel rootPanel = new JPanel();
    add(rootPanel, BorderLayout.CENTER);
    rootPanel.setLayout(new BorderLayout(0, 0));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setContinuousLayout(true);
    splitPane.setResizeWeight(0.5);//w ww.j a  va  2  s.  co m
    splitPane.setOneTouchExpandable(true);
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    rootPanel.add(splitPane, BorderLayout.CENTER);

    JPanel churchPanel = new JPanel();
    churchPanel.setLayout(new BorderLayout(0, 0));

    JLabel lblNewLabel = new JLabel("Church Program");
    churchPanel.add(lblNewLabel, BorderLayout.NORTH);

    churchEditor = new ChurchEditor();
    churchPanel.add(churchEditor, BorderLayout.CENTER);

    splitPane.setLeftComponent(churchPanel);

    JPanel hogmPanel = new JPanel();
    hogmPanel.setLayout(new BorderLayout(0, 0));

    JLabel lblNewLabel_1 = new JLabel("Generated Model (Read Only)");
    hogmPanel.add(lblNewLabel_1, BorderLayout.NORTH);

    hogmEditor = new RuleEditor();
    hogmEditor.setEditable(false);
    hogmPanel.add(hogmEditor, BorderLayout.CENTER);

    splitPane.setRightComponent(hogmPanel);
}

From source file:logdruid.ui.mainpanel.MetadataRecordingSelectorPanel.java

/**
 * Create the panel./*w  ww .ja  v a  2  s  . co m*/
 */
public MetadataRecordingSelectorPanel(Repository rep, Source src) {
    repository = rep;
    source = src;
    records = rep.getRecordings(MetadataRecording.class);
    // Collections.sort(records);
    Iterator it = records.iterator();
    while (it.hasNext()) {
        Recording record = (Recording) it.next();
        data.add(new Object[] { record.getName(), record.getRegexp(), record.getType(),
                src.isActiveRecordingOnSource(record) });
    }

    model = new logdruid.ui.mainpanel.MetadataRecordingSelectorPanel.MyTableModel(data, header);

    logger.info("source is " + ((source == null) ? "null" : src.getSourceName()));
    setLayout(new BorderLayout(0, 0));

    JPanel panel_1 = new JPanel();
    panel_1.setLayout(new BorderLayout(0, 0));

    table = new JTable(model);
    JScrollPane scrollPane = new JScrollPane(table);
    panel_1.add(scrollPane, BorderLayout.CENTER);

    table.setPreferredScrollableViewportSize(new Dimension(0, 150));
    table.setFillsViewportHeight(true);
    table.setAutoCreateRowSorter(true);

    // Set up column sizes.
    initColumnSizes(table);
    reloadTable();

    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(splitPane);

    jPanelDetail = new JPanel();
    splitPane.setBottomComponent(jPanelDetail);
    splitPane.setTopComponent(panel_1);

    jPanelDetail.setLayout(new BorderLayout(0, 0));
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            // ((table.getSelectedRow()!=-1)?table.convertRowIndexToModel(table.getSelectedRow()):-1)
            // persist repository
            // display selected row
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);

            logger.info("ListSelectionListener - selectedRow: " + selectedRow);
            if (selectedRow >= 0) {

                if (jPanelDetail != null) {
                    logger.debug("ListSelectionListener - valueChanged");
                    jPanelDetail.removeAll();
                    recEditor = getEditor(repository.getRecording(MetadataRecording.class, selectedRow));
                    if (recEditor != null) {
                        jPanelDetail.add(recEditor, BorderLayout.CENTER);
                    }
                    reloadTable();
                    jPanelDetail.revalidate();
                }
            }
        }
    });
    if (repository.getRecordings(MetadataRecording.class).size() > 0) {
        recEditor = getEditor(repository.getRecording(MetadataRecording.class, 0));
        jPanelDetail.add(recEditor, BorderLayout.CENTER);
        table.setRowSelectionInterval(0, 0);
    }
    if (model.getRowCount() > 0) {
        table.getRowSorter().toggleSortOrder(0);
        table.setRowSelectionInterval(0, 0);
    }
    //reloadTable();
    // jPanelDetail.revalidate();

}

From source file:logdruid.ui.RecordingList.java

/**
 * Create the panel.// w w w .ja  v a  2s. c o  m
 */
public RecordingList(final Repository rep) {

    if (Preferences.getPreference("timings").equals("true")) {
        header = (String[]) new String[] { "name", "regexp", "type", "active", "success time", "failed time",
                "match attempt", "success match" };
    } else {
        header = (String[]) new String[] { "name", "regexp", "type", "active" };
    }

    records = rep.getRecordings();
    // Collections.sort(records);
    Iterator it = records.iterator();
    while (it.hasNext()) {
        Recording record = (Recording) it.next();
        stats = DataVault.getRecordingStats(record.getName());
        if (stats != null) {
            data.add(new Object[] { record.getName(), record.getRegexp(), record.getType(),
                    record.getIsActive(), stats[0], stats[1], stats[2], stats[3] });
        } else {
            data.add(new Object[] { record.getName(), record.getRegexp(), record.getType(),
                    record.getIsActive(), 0, 0, 0, 0 });
        }
    }

    repository = rep;
    model = new MyTableModel2(data, header);

    JPanel panel_1 = new JPanel();
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.insets = new Insets(5, 0, 5, 5);
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 0;
    panel_1.setLayout(new BorderLayout(0, 0));

    table = new JTable(model);
    JScrollPane scrollPane = new JScrollPane(table);
    int column;
    panel_1.add(scrollPane);

    table.setPreferredScrollableViewportSize(new Dimension(0, 150));
    table.setFillsViewportHeight(true);

    // Set up column sizes.
    initColumnSizes(table);
    table.setAutoCreateRowSorter(true);
    //   RowSorter sorter = table.getRowSorter();
    //      sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING)));
    if (model.getRowCount() > 0) {
        table.getRowSorter().toggleSortOrder(0);
        table.getRowSorter().toggleSortOrder(2);
    }
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            ;
            logger.info("ListSelectionListener - selectedRow: " + selectedRow);
            if (selectedRow >= 0) {
                if (jPanelDetail != null) {
                    logger.info("ListSelectionListener - valueChanged");
                    jPanelDetail.removeAll();
                    recEditor = getEditor(repository.getRecording(selectedRow));
                    if (recEditor != null) {
                        jPanelDetail.add(recEditor, BorderLayout.CENTER);
                    }
                    jPanelDetail.revalidate();
                }
            }
        }
    });
    JPanel panel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);
    flowLayout.setVgap(2);
    flowLayout.setHgap(2);
    panel_1.add(panel, BorderLayout.SOUTH);

    JButton btnNewMeta = new JButton("New Meta");
    panel.add(btnNewMeta);
    btnNewMeta.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            int rowCount = table.getRowCount();
            jPanelDetail.removeAll();
            Recording re = new MetadataRecording("name", "regex", "example line", "", true, null);
            recEditor = new MetadataRecordingEditor(thiis, repository, "the line", "regex",
                    (MetadataRecording) re);
            jPanelDetail.add(recEditor, BorderLayout.CENTER);
            repository.addRecording(re);
            model.addRow(
                    new Object[] { re.getName(), re.getRegexp(), re.getType(), re.getIsActive(), 0, 0, 0, 0 });
            model.fireTableRowsInserted(rowCount, rowCount);
            table.setRowSelectionInterval(rowCount, rowCount);
            logger.info("New record - row count : " + rowCount);
        }
    });

    JButton btnDuplicate = new JButton("Duplicate");
    btnDuplicate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int rowCount = table.getRowCount();
            int selectRow = ((table.getSelectedRow() != -1) ? table.getSelectedRow() : -1);
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            repository.addRecording(
                    repository.getRecording(table.convertRowIndexToModel(table.getSelectedRow())).duplicate());
            model.fireTableRowsInserted(rowCount, rowCount);
            table.setRowSelectionInterval(selectRow, selectRow);
        }
    });

    JButton btnNewStat = new JButton("New Stat");
    btnNewStat.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int rowCount = table.getRowCount();
            jPanelDetail.removeAll();
            Recording re = new StatRecording("name", "regex", "example line", "", true, null);
            recEditor = new StatRecordingEditor(thiis, repository, "the line", "regex", (StatRecording) re);
            jPanelDetail.add(recEditor, BorderLayout.CENTER);
            repository.addRecording(re);
            model.addRow(
                    new Object[] { re.getName(), re.getRegexp(), re.getType(), re.getIsActive(), 0, 0, 0, 0 });
            model.fireTableRowsInserted(rowCount, rowCount);
            table.setRowSelectionInterval(rowCount, rowCount);
            logger.info("New record - row count : " + rowCount);
        }
    });
    panel.add(btnNewStat);

    JButton btnNewEvent = new JButton("New Event");
    btnNewEvent.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int rowCount = table.getRowCount();
            logger.info("table.getRowCount()" + table.getRowCount());
            jPanelDetail.removeAll();
            Recording re = new EventRecording("name", "regex", "example line", "", true, null);
            recEditor = new EventRecordingEditor(thiis, repository, "the line", "regex", (EventRecording) re);
            jPanelDetail.add(recEditor, BorderLayout.CENTER);
            repository.addRecording(re);
            model.addRow(
                    new Object[] { re.getName(), re.getRegexp(), re.getType(), re.getIsActive(), 0, 0, 0, 0 });
            model.fireTableRowsInserted(rowCount, rowCount);
            table.setRowSelectionInterval(rowCount, rowCount);
            logger.info("New record - row count : " + rowCount);
        }
    });
    panel.add(btnNewEvent);
    panel.add(btnDuplicate);

    JButton btnDelete = new JButton("Delete");
    btnDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int rowCount = table.getRowCount();
            int selectedRow = ((table.getSelectedRow() != -1)
                    ? table.convertRowIndexToModel(table.getSelectedRow())
                    : -1);
            ;
            int realSelectedRow = table.getSelectedRow();
            logger.info("selectedRow : " + selectedRow + ", row count: " + table.getRowCount());
            if (rowCount != 0) {
                repository.deleteRecording(selectedRow);
                model.fireTableRowsDeleted(selectedRow, selectedRow);
                //         table.remove(selectedRow);
                if (realSelectedRow != -1) {
                    if (realSelectedRow != 0)
                        table.setRowSelectionInterval(realSelectedRow - 1, realSelectedRow - 1);
                    else if (realSelectedRow > 0)
                        table.setRowSelectionInterval(realSelectedRow, realSelectedRow);
                    else if (rowCount > 1)
                        table.setRowSelectionInterval(0, 0);
                }
                /*            if (table.getRowCount() > 0) {
                               if (selectedRow == table.getRowCount()) {
                                  table.setRowSelectionInterval(selectedRow - 1, selectedRow - 1);
                               } else
                                  table.setRowSelectionInterval(selectedRow, selectedRow);
                            }*/
            }
        }
    });
    panel.add(btnDelete);
    setLayout(new BorderLayout(0, 0));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(splitPane, BorderLayout.CENTER);

    jPanelDetail = new JPanel();
    GridBagConstraints gbc_jPanelDetail = new GridBagConstraints();
    gbc_jPanelDetail.insets = new Insets(0, 0, 0, 5);
    gbc_jPanelDetail.fill = GridBagConstraints.BOTH;
    gbc_jPanelDetail.gridx = 1;
    gbc_jPanelDetail.gridy = 4;
    splitPane.setBottomComponent(jPanelDetail);
    splitPane.setTopComponent(panel_1);
    jPanelDetail.setLayout(new BorderLayout(0, 0));
    if (repository.getRecordingCount() > 0) {
        //recEditor = getEditor(repository.getRecording(0));
        //jPanelDetail.add(recEditor, BorderLayout.CENTER);
        table.setRowSelectionInterval(0, 0);
    }
    jPanelDetail.revalidate();

}

From source file:org.ash.history.detail.DetailsPanelH.java

/**
 * Add ChartPanel to mainPanel/*from   w w  w .  java 2 s.com*/
 * @param waitClass
 */
private void addChartPanelT(String waitClass) {

    JSplitPane splitPaneMainDetail = new JSplitPane();

    StackedChartDetail stackedChartMainObjectDetail = new StackedChartDetail(database, waitClass);

    ChartPanel chartDetailPanel = stackedChartMainObjectDetail.createChartPanel();
    stackedChartMainObjectDetail.setThresholdMaxCpu(this.maxCpu);

    GanttDetailsH sqlsAndSessions = new GanttDetailsH(database, waitClass);
    chartDetailPanel.addListenerReleaseMouse(sqlsAndSessions);

    database.clearStackedXYAreaChartDetail();
    database.saveStackedXYAreaChartDetail(stackedChartMainObjectDetail, waitClass);
    database.initialLoadingDataToChartPanelDataSetDetail(waitClass, this.beginTime, this.endTime);

    stackedChartMainObjectDetail.setTitle();

    this.mainPanel.removeAll();

    splitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPaneMainDetail.add(chartDetailPanel, "top");
    splitPaneMainDetail.add(sqlsAndSessions, "bottom");
    splitPaneMainDetail.setDividerLocation(215);
    splitPaneMainDetail.setOneTouchExpandable(true);

    this.mainPanel.add(splitPaneMainDetail, BorderLayout.CENTER);
    this.validate();
    this.repaint();
}

From source file:cool.pandora.modeller.ui.jpanel.base.BagView.java

/**
 * createBagPanel.//  w w w  .jav  a2s .  c  o m
 *
 * @return splitPane
 */
private JSplitPane createBagPanel() {

    final LineBorder border = new LineBorder(Color.GRAY, 1);

    bagButtonPanel = createBagButtonPanel();

    final JPanel bagTagButtonPanel = createBagTagButtonPanel();

    bagPayloadTree = new BagTree(this, AbstractBagConstants.DATA_DIRECTORY);
    bagPayloadTree.setEnabled(false);

    bagPayloadTreePanel = new BagTreePanel(bagPayloadTree);
    bagPayloadTreePanel.setEnabled(false);
    bagPayloadTreePanel.setBorder(border);
    bagPayloadTreePanel.setToolTipText(getMessage("bagTree.help"));

    bagTagFileTree = new BagTree(this, getMessage("bag.label.noname"));
    bagTagFileTree.setEnabled(false);
    bagTagFileTreePanel = new BagTreePanel(bagTagFileTree);
    bagTagFileTreePanel.setEnabled(false);
    bagTagFileTreePanel.setBorder(border);
    bagTagFileTreePanel.setToolTipText(getMessage("bagTree.help"));

    tagManifestPane = new TagManifestPane(this);
    tagManifestPane.setToolTipText(getMessage("compositePane.tab.help"));

    final JSplitPane splitPane = new JSplitPane();
    splitPane.setResizeWeight(0.5);
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);

    final JPanel payloadPannel = new JPanel();
    splitPane.setLeftComponent(payloadPannel);
    payloadPannel.setLayout(new BorderLayout(0, 0));

    final JPanel payLoadToolBarPanel = new JPanel();
    payloadPannel.add(payLoadToolBarPanel, BorderLayout.NORTH);
    payLoadToolBarPanel.setLayout(new GridLayout(1, 0, 0, 0));

    final JPanel payloadLabelPanel = new JPanel();
    final FlowLayout flowLayout = (FlowLayout) payloadLabelPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);
    payLoadToolBarPanel.add(payloadLabelPanel);

    final JLabel lblPayloadTree = new JLabel(getMessage("bagView.payloadTree.name"));
    payloadLabelPanel.add(lblPayloadTree);

    payLoadToolBarPanel.add(bagButtonPanel);

    payloadPannel.add(bagPayloadTreePanel, BorderLayout.CENTER);

    final JPanel tagFilePanel = new JPanel();
    splitPane.setRightComponent(tagFilePanel);
    tagFilePanel.setLayout(new BorderLayout(0, 0));

    final JPanel tagFileToolBarPannel = new JPanel();
    tagFilePanel.add(tagFileToolBarPannel, BorderLayout.NORTH);
    tagFileToolBarPannel.setLayout(new GridLayout(0, 2, 0, 0));

    final JPanel TagFileLabelPanel = new JPanel();
    final FlowLayout tagFileToolbarFlowLayout = (FlowLayout) TagFileLabelPanel.getLayout();
    tagFileToolbarFlowLayout.setAlignment(FlowLayout.LEFT);
    tagFileToolBarPannel.add(TagFileLabelPanel);

    final JLabel tagFileTreeLabel = new JLabel(getMessage("bagView.TagFilesTree.name"));
    TagFileLabelPanel.add(tagFileTreeLabel);

    tagFileToolBarPannel.add(bagTagButtonPanel);

    tagFilePanel.add(bagTagFileTreePanel, BorderLayout.CENTER);

    return splitPane;
}