Search in sources :

Example 46 with CardLayout

use of java.awt.CardLayout 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 47 with CardLayout

use of java.awt.CardLayout in project cayenne by apache.

the class DbEntityTab method initView.

private void initView() {
    toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createEmptyBorder());
    toolBar.setFloatable(false);
    ActionManager actionManager = Application.getInstance().getActionManager();
    toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton(1));
    toolBar.add(actionManager.getAction(CreateRelationshipAction.class).buildButton(3));
    toolBar.addSeparator();
    toolBar.add(actionManager.getAction(CreateObjEntityFromDbAction.class).buildButton(1));
    toolBar.add(actionManager.getAction(DbEntitySyncAction.class).buildButton(2));
    toolBar.add(actionManager.getAction(DbEntityCounterpartAction.class).buildButton(3));
    toolBar.addSeparator();
    toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());
    // create widgets
    name = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) {
            setEntityName(text);
        }
    };
    catalogLabel = new JLabel("Catalog:");
    catalog = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) throws ValidationException {
            setCatalog(text);
        }
    };
    schemaLabel = new JLabel("Schema:");
    schema = new TextAdapter(new JTextField()) {

        protected void updateModel(String text) throws ValidationException {
            setSchema(text);
        }
    };
    qualifier = new TextAdapter(new JTextField()) {

        protected void updateModel(String qualifier) {
            setQualifier(qualifier);
        }
    };
    comment = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) throws ValidationException {
            setComment(text);
        }
    };
    pkGeneratorType = new JComboBox<>();
    pkGeneratorType.setEditable(false);
    pkGeneratorType.setModel(new DefaultComboBoxModel<>(PK_GENERATOR_TYPES));
    pkGeneratorDetailLayout = new CardLayout();
    pkGeneratorDetail = new JPanel(pkGeneratorDetailLayout);
    pkGeneratorDetail.add(new PKDefaultGeneratorPanel(mediator), PK_DEFAULT_GENERATOR);
    pkGeneratorDetail.add(new PKDBGeneratorPanel(mediator), PK_DB_GENERATOR);
    pkGeneratorDetail.add(new PKCustomSequenceGeneratorPanel(mediator), PK_CUSTOM_SEQUENCE_GENERATOR);
    // assemble
    FormLayout layout = new FormLayout("right:pref, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.appendSeparator("DbEntity Configuration");
    builder.append("DbEntity Name:", name.getComponent());
    builder.append(catalogLabel, catalog.getComponent());
    builder.append(schemaLabel, schema.getComponent());
    builder.append("Qualifier:", qualifier.getComponent());
    builder.append("Comment:", comment.getComponent());
    builder.appendSeparator("Primary Key");
    builder.append("PK Generation Strategy:", pkGeneratorType);
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(builder.getPanel(), BorderLayout.NORTH);
    mainPanel.add(pkGeneratorDetail, BorderLayout.CENTER);
    setLayout(new BorderLayout());
    add(toolBar, BorderLayout.NORTH);
    add(mainPanel, BorderLayout.CENTER);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) CardLayout(java.awt.CardLayout) JPanel(javax.swing.JPanel) ValidationException(org.apache.cayenne.validation.ValidationException) TextAdapter(org.apache.cayenne.modeler.util.TextAdapter) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) JTextField(javax.swing.JTextField) ActionManager(org.apache.cayenne.modeler.action.ActionManager) BorderLayout(java.awt.BorderLayout) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder)

Example 48 with CardLayout

use of java.awt.CardLayout in project vcell by virtualcell.

the class Wizard method initComponents.

/**
 * This method initializes the components for the wizard dialog: it creates a JDialog
 * as a CardLayout panel , as well as three buttons at the bottom.
 */
private void initComponents() {
    wizardModel.addPropertyChangeListener(this);
    wizardController = new WizardController(this);
    wizardDialog.getContentPane().setLayout(new BorderLayout());
    wizardDialog.addWindowListener(this);
    // Create the outer wizard panel, which is responsible for three buttons:
    // Next, Back, and Cancel. It is also responsible a JPanel above them that
    // uses a CardLayout layout manager to display multiple panels in the
    // same spot.
    JPanel buttonPanel = new JPanel();
    JSeparator separator = new JSeparator();
    Box buttonBox = new Box(BoxLayout.X_AXIS);
    cardPanel = new JPanel();
    cardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
    cardLayout = new CardLayout();
    cardPanel.setLayout(cardLayout);
    backButton = new JButton();
    nextButton = new JButton();
    cancelButton = new JButton();
    backButton.setActionCommand(BACK_BUTTON_ACTION_COMMAND);
    nextButton.setActionCommand(NEXT_BUTTON_ACTION_COMMAND);
    cancelButton.setActionCommand(CANCEL_BUTTON_ACTION_COMMAND);
    backButton.addActionListener(wizardController);
    nextButton.addActionListener(wizardController);
    cancelButton.addActionListener(wizardController);
    // Create the buttons with a separator above them, then put them
    // on the east side of the panel with a small amount of space between
    // the back and the next button, and a larger amount of space between
    // the next button and the cancel button.
    buttonPanel.setLayout(new BorderLayout());
    buttonPanel.add(separator, BorderLayout.NORTH);
    buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
    buttonBox.add(backButton);
    buttonBox.add(Box.createHorizontalStrut(10));
    buttonBox.add(nextButton);
    buttonBox.add(Box.createHorizontalStrut(30));
    buttonBox.add(cancelButton);
    buttonPanel.add(buttonBox, java.awt.BorderLayout.EAST);
    wizardDialog.getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH);
    wizardDialog.getContentPane().add(cardPanel, java.awt.BorderLayout.CENTER);
}
Also used : JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) JButton(javax.swing.JButton) Box(javax.swing.Box) EmptyBorder(javax.swing.border.EmptyBorder) JSeparator(javax.swing.JSeparator)

Example 49 with CardLayout

use of java.awt.CardLayout in project vcell by virtualcell.

the class BatchRunDisplayPanel method getTopDisplayPanel.

public JPanel getTopDisplayPanel() {
    if (topDisplayPanel == null) {
        topDisplayPanel = new JPanel(new CardLayout());
        topDisplayPanel.add(getFRAPDataPanel(), DISPLAY_IMG_ID);
        topDisplayPanel.add(getBatchRunResultsPanel(), DISPLAY_PARAM_ID);
    }
    return topDisplayPanel;
}
Also used : JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout)

Example 50 with CardLayout

use of java.awt.CardLayout in project processdash by dtuma.

the class PercentSpentIndicator method buildUI.

private void buildUI() {
    layout = new CardLayout();
    setLayout(layout);
    levelIndicator = new LevelIndicator(true);
    levelIndicator.setPaintBarRect(false);
    add(levelIndicator, LEVEL_INDICATOR_KEY);
    Icon hourglassIcon = DashboardIconFactory.getHourglassIcon();
    JLabel label = new JLabel(hourglassIcon);
    add(label, MISSING_ESTIMATE_KEY);
    if (!Settings.isReadOnly()) {
        addMouseListener(new MouseAdapter() {

            public void mousePressed(MouseEvent e) {
                showEditEstimateDialog();
            }
        });
    }
    setBorder(BorderFactory.createLineBorder(UIManager.getColor("controlDkShadow")));
    Dimension d = new Dimension(hourglassIcon.getIconWidth() + 4, hourglassIcon.getIconHeight() + 6);
    setMinimumSize(d);
    setPreferredSize(d);
    new ToolTipTimingCustomizer(750, 60000).install(this);
}
Also used : CardLayout(java.awt.CardLayout) MouseEvent(java.awt.event.MouseEvent) ToolTipTimingCustomizer(net.sourceforge.processdash.ui.lib.ToolTipTimingCustomizer) LevelIndicator(net.sourceforge.processdash.ui.lib.LevelIndicator) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) Icon(javax.swing.Icon) Dimension(java.awt.Dimension)

Aggregations

CardLayout (java.awt.CardLayout)92 JPanel (javax.swing.JPanel)37 BorderLayout (java.awt.BorderLayout)16 JLabel (javax.swing.JLabel)14 JScrollPane (javax.swing.JScrollPane)12 Dimension (java.awt.Dimension)9 GridBagLayout (java.awt.GridBagLayout)8 Insets (java.awt.Insets)8 JButton (javax.swing.JButton)7 ImageIcon (javax.swing.ImageIcon)6 ListSelectionEvent (javax.swing.event.ListSelectionEvent)6 JSplitPane (javax.swing.JSplitPane)5 ListSelectionListener (javax.swing.event.ListSelectionListener)5 FlowLayout (java.awt.FlowLayout)4 Font (java.awt.Font)4 Point (java.awt.Point)4 JList (javax.swing.JList)4 EmptyBorder (javax.swing.border.EmptyBorder)4 AWTException (java.awt.AWTException)3 GridBagConstraints (java.awt.GridBagConstraints)3