Search in sources :

Example 41 with JSplitPane

use of javax.swing.JSplitPane in project cayenne by apache.

the class ObjEntityAttributeRelationshipTab method init.

private void init() {
    this.setLayout(new BorderLayout());
    attributePanel = new ObjEntityAttributePanel(mediator, this);
    relationshipPanel = new ObjEntityRelationshipPanel(mediator, this);
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, attributePanel, relationshipPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.5);
    try {
        ComponentGeometry geometry = new ComponentGeometry(this.getClass(), "objEntityAttrRelTab/splitPane/divider");
        geometry.bindIntProperty(splitPane, JSplitPane.DIVIDER_LOCATION_PROPERTY, -1);
    } catch (Exception ex) {
        LoggerFactory.getLogger(getClass()).error("Cannot bind divider property", ex);
    }
    add(splitPane);
}
Also used : BorderLayout(java.awt.BorderLayout) ComponentGeometry(org.apache.cayenne.modeler.pref.ComponentGeometry) JSplitPane(javax.swing.JSplitPane)

Example 42 with JSplitPane

use of javax.swing.JSplitPane in project cayenne by apache.

the class SelectQueryOrderingTab method initView.

protected void initView() {
    messagePanel = new JPanel(new BorderLayout());
    cardLayout = new CardLayout();
    Preferences detail = Application.getInstance().getPreferencesNode(this.getClass(), "");
    int defLocation = Application.getFrame().getHeight() / 2;
    int location = detail != null ? detail.getInt(getDividerLocationProperty(), defLocation) : defLocation;
    // As of CAY-888 #3 main pane is now a JSplitPane. Top component is a bit larger.
    JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    mainPanel.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, this);
    mainPanel.setDividerLocation(location);
    mainPanel.setTopComponent(createEditorPanel());
    mainPanel.setBottomComponent(createSelectorPanel());
    setLayout(cardLayout);
    add(mainPanel, REAL_PANEL);
    add(messagePanel, PLACEHOLDER_PANEL);
}
Also used : JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout) BorderLayout(java.awt.BorderLayout) Preferences(java.util.prefs.Preferences) JSplitPane(javax.swing.JSplitPane)

Example 43 with JSplitPane

use of javax.swing.JSplitPane in project cayenne by apache.

the class PreferenceDialogView method init.

private void init() {
    split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setBorder(TopBorder.create());
    list = new JList<>();
    list.setCellRenderer(new DefaultListCellRenderer() {

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0));
            return this;
        }
    });
    list.setFont(new JLabel().getFont().deriveFont(Font.BOLD, 12));
    detailLayout = new CardLayout();
    detailPanel = new JPanel(detailLayout);
    saveButton = new JButton("Save");
    cancelButton = new JButton("Cancel");
    // assemble
    Container leftContainer = new JPanel(new BorderLayout());
    JScrollPane scrollPane = new JScrollPane(list);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    leftContainer.add(scrollPane);
    leftContainer.setPreferredSize(new Dimension(180, 400));
    split.setLeftComponent(leftContainer);
    split.setRightComponent(detailPanel);
    split.setDividerSize(3);
    JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttons.add(cancelButton);
    buttons.add(saveButton);
    buttons.setBorder(TopBorder.create());
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(split, BorderLayout.CENTER);
    getContentPane().add(buttons, BorderLayout.SOUTH);
    setTitle("Edit Preferences");
}
Also used : JScrollPane(javax.swing.JScrollPane) CardLayout(java.awt.CardLayout) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) JSplitPane(javax.swing.JSplitPane) Component(java.awt.Component) JList(javax.swing.JList)

Example 44 with JSplitPane

use of javax.swing.JSplitPane in project cayenne by apache.

the class EditorView method initView.

private void initView() {
    setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 1));
    // init widgets
    actionManager.getAction(CollapseTreeAction.class).setAlwaysOn(true);
    actionManager.getAction(FilterAction.class).setAlwaysOn(true);
    actionManager.getAction(FilterAction.class).resetDialog();
    JToolBar barPanel = new JToolBar();
    barPanel.setFloatable(false);
    barPanel.setMinimumSize(new Dimension(75, 30));
    barPanel.setBorder(BorderFactory.createEmptyBorder());
    barPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    JButton collapseButton = getAction(CollapseTreeAction.class).buildButton(1);
    JButton filterButton = getAction(FilterAction.class).buildButton(3);
    filterButton.setPreferredSize(new Dimension(30, 30));
    collapseButton.setPreferredSize(new Dimension(30, 30));
    barPanel.add(filterButton);
    barPanel.add(collapseButton);
    treePanel = new ProjectTreeView(eventController);
    treePanel.setMinimumSize(new Dimension(75, 180));
    JPanel treeNavigatePanel = new JPanel();
    treeNavigatePanel.setMinimumSize(new Dimension(75, 220));
    treeNavigatePanel.setLayout(new BorderLayout());
    treeNavigatePanel.add(treePanel, BorderLayout.CENTER);
    detailPanel = new JPanel();
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    splitPane.setDividerSize(2);
    splitPane.setBorder(BorderFactory.createEmptyBorder());
    leftPanel = new JPanel(new BorderLayout());
    // assemble...
    detailLayout = new CardLayout();
    detailPanel.setLayout(detailLayout);
    // some but not all panels must be wrapped in a scroll pane
    // those that are not wrapped usually have there own scrollers
    // in subpanels...
    detailPanel.add(new JPanel(), EMPTY_VIEW);
    dataDomainView = new DataDomainTabbedView(eventController);
    detailPanel.add(dataDomainView, DOMAIN_VIEW);
    DataNodeEditor nodeController = new DataNodeEditor(eventController);
    detailPanel.add(nodeController.getView(), NODE_VIEW);
    dataNodeView = nodeController.getTabComponent();
    dataMapView = new DataMapTabbedView(eventController);
    detailPanel.add(dataMapView, DATA_MAP_VIEW);
    procedureView = new ProcedureTabbedView(eventController);
    detailPanel.add(procedureView, PROCEDURE_VIEW);
    selectQueryView = new SelectQueryTabbedView(eventController);
    detailPanel.add(selectQueryView, SELECT_QUERY_VIEW);
    sqlTemplateView = new SQLTemplateTabbedView(eventController);
    detailPanel.add(sqlTemplateView, SQL_TEMPLATE_VIEW);
    Component procedureQueryView = new ProcedureQueryView(eventController);
    detailPanel.add(new JScrollPane(procedureQueryView), PROCEDURE_QUERY_VIEW);
    ejbqlQueryView = new EjbqlTabbedView(eventController);
    detailPanel.add(ejbqlQueryView, EJBQL_QUERY_VIEW);
    embeddableView = new EmbeddableTabbedView(eventController);
    detailPanel.add(embeddableView, EMBEDDABLE_VIEW);
    objDetailView = new ObjEntityTabbedView(eventController);
    detailPanel.add(objDetailView, OBJ_VIEW);
    dbDetailView = new DbEntityTabbedView(eventController);
    detailPanel.add(dbDetailView, DB_VIEW);
    leftPanel.add(barPanel, BorderLayout.NORTH);
    leftPanel.setBorder(BorderFactory.createEmptyBorder());
    JScrollPane scrollPane = new JScrollPane(treeNavigatePanel);
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    leftPanel.add(scrollPane, BorderLayout.CENTER);
    splitPane.setLeftComponent(leftPanel);
    splitPane.setRightComponent(detailPanel);
    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout) DbEntityTabbedView(org.apache.cayenne.modeler.editor.dbentity.DbEntityTabbedView) CollapseTreeAction(org.apache.cayenne.modeler.action.CollapseTreeAction) DataNodeEditor(org.apache.cayenne.modeler.editor.datanode.DataNodeEditor) JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar) Dimension(java.awt.Dimension) ProjectTreeView(org.apache.cayenne.modeler.ProjectTreeView) BorderLayout(java.awt.BorderLayout) JSplitPane(javax.swing.JSplitPane) Component(java.awt.Component) FilterAction(org.apache.cayenne.modeler.action.FilterAction)

Example 45 with JSplitPane

use of javax.swing.JSplitPane in project cayenne by apache.

the class DbEntityAttributeRelationshipTab method init.

private void init() {
    this.setLayout(new BorderLayout());
    attributePanel = new DbEntityAttributePanel(mediator, this);
    relationshipPanel = new DbEntityRelationshipPanel(mediator, this);
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, attributePanel, relationshipPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.5);
    try {
        ComponentGeometry geometry = new ComponentGeometry(this.getClass(), "dbEntityAttrRelTab/splitPane/divider");
        geometry.bindIntProperty(splitPane, JSplitPane.DIVIDER_LOCATION_PROPERTY, -1);
    } catch (Exception ex) {
        LoggerFactory.getLogger(getClass()).error("Cannot bind divider property", ex);
    }
    add(splitPane);
}
Also used : BorderLayout(java.awt.BorderLayout) ComponentGeometry(org.apache.cayenne.modeler.pref.ComponentGeometry) JSplitPane(javax.swing.JSplitPane)

Aggregations

JSplitPane (javax.swing.JSplitPane)109 BorderLayout (java.awt.BorderLayout)69 JPanel (javax.swing.JPanel)64 JScrollPane (javax.swing.JScrollPane)54 Dimension (java.awt.Dimension)40 JLabel (javax.swing.JLabel)31 JButton (javax.swing.JButton)17 JTextArea (javax.swing.JTextArea)16 FlowLayout (java.awt.FlowLayout)15 Insets (java.awt.Insets)15 GridBagLayout (java.awt.GridBagLayout)14 GridBagConstraints (java.awt.GridBagConstraints)13 JTable (javax.swing.JTable)13 Container (java.awt.Container)10 GridLayout (java.awt.GridLayout)10 ArrayList (java.util.ArrayList)10 BoxLayout (javax.swing.BoxLayout)10 JComponent (javax.swing.JComponent)10 JTabbedPane (javax.swing.JTabbedPane)10 EmptyBorder (javax.swing.border.EmptyBorder)10