Example usage for com.jgoodies.forms.layout CellConstraints xy

List of usage examples for com.jgoodies.forms.layout CellConstraints xy

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints xy.

Prototype

public CellConstraints xy(int col, int row) 

Source Link

Document

Sets column and row origins; sets width and height to 1; uses the default alignments.

Examples:

 cc.xy(1, 1); cc.xy(1, 3); 

Usage

From source file:com.jeta.swingbuilder.gui.font.FontView.java

License:Open Source License

/**
 * ctor/*from  w  w  w  . j a va 2s .c om*/
 */
public FontView(Font f) {
    setLayout(new BorderLayout());
    m_view = new FormPanel("com/jeta/swingbuilder/gui/font/fontSelector.frm");
    add(m_view, BorderLayout.CENTER);
    setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
    m_view.getTextField(FontViewNames.ID_SIZE_FIELD).setDocument(new IntegerDocument());

    CellConstraints cc = new CellConstraints();
    m_font_comp = new FontSampleComponent(f);

    m_view.getFormAccessor(FontViewNames.ID_SAMPLE_VIEW).addBean(m_font_comp, cc.xy(1, 1));

    initialize(f);
    setController(new FontViewController(this));
}

From source file:com.jeta.swingbuilder.gui.main.ComponentsToolBar.java

License:Open Source License

/** @param model */
public ComponentsToolBar() {
    try {/*from  w  w  w  . ja  v  a2 s  . c o  m*/
        FormLayout layout = new FormLayout("pref", "fill:pref:grow");
        setLayout(layout);
        CellConstraints cc = new CellConstraints();
        add(createToolbar(), cc.xy(1, 1));
    } catch (Exception e) {
        FormsLogger.debug(e);
    }
}

From source file:com.jeta.swingbuilder.gui.main.ComponentsToolBar.java

License:Open Source License

/**
 * Creates the java beans palette toolbar.
 * //from w  ww .  j  a v  a 2s.c  o  m
 */
private Container createToolbar() {

    LinkedList button_list = new LinkedList();
    button_list.addAll(registerDefaultBeans());
    button_list.addAll(registerImportedBeans());

    StringBuffer colspec = new StringBuffer();
    StringBuffer rowspec = new StringBuffer();

    int cols = button_list.size() / MAX_TOOLBAR_ROWS + (button_list.size() % MAX_TOOLBAR_ROWS == 0 ? 0 : 1);
    int rows = Math.min(button_list.size(), MAX_TOOLBAR_ROWS);
    for (int col = 1; col <= cols; col++) {
        if (col > 1)
            colspec.append(",");

        colspec.append("pref");
    }

    for (int row = 1; row <= rows; row++) {
        if (row > 1)
            rowspec.append(",");

        rowspec.append("pref");
    }

    ButtonGroup bgroup = new ButtonGroup();

    JETAPanel toolbar = new JETAPanel();
    toolbar.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 4, 0, 4));
    FormLayout layout = new FormLayout(colspec.toString(), rowspec.toString());
    CellConstraints cc = new CellConstraints();
    toolbar.setLayout(layout);

    int row_count = button_list.size() / cols + (button_list.size() % cols == 0 ? 0 : 1);
    Iterator iter = button_list.iterator();
    for (int col = 1; col <= cols; col++) {
        for (int row = 1; row <= row_count; row++) {
            if (iter.hasNext()) {
                Component btn = (Component) iter.next();
                bgroup.add((AbstractButton) btn);
                JPanel btn_panel = new JPanel(new BorderLayout());
                btn_panel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
                btn_panel.add(btn, BorderLayout.CENTER);
                toolbar.add(btn_panel, cc.xy(col, row));
            } else {
                break;
            }
        }
    }
    layout.insertRow(1, new RowSpec("5px"));
    toolbar.setController(new ToolbarController(toolbar, button_list));

    assert (!iter.hasNext());
    return toolbar;
}

From source file:com.jeta.swingbuilder.gui.main.ComponentsToolBar.java

License:Open Source License

/**
 * Reloads the toolbar//from ww w.jav  a  2  s .c  o  m
 */
public void reload() {
    m_factories.clear();
    removeAll();
    CellConstraints cc = new CellConstraints();
    add(createToolbar(), cc.xy(1, 1));
    revalidate();
}

From source file:com.jeta.swingbuilder.gui.main.GridControlsView.java

License:Open Source License

public GridControlsView() {
    FormLayout layout = new FormLayout("center:pref:grow", "pref,2dlu,pref");
    CellConstraints cc = new CellConstraints();

    setLayout(layout);/*w  w  w  .  j  av a 2  s.co m*/

    m_col_panel = new FormPanel("com/jeta/swingbuilder/gui/main/columnSpec.frm");
    m_row_panel = new FormPanel("com/jeta/swingbuilder/gui/main/rowSpec.frm");

    add(m_col_panel, cc.xy(1, 1));
    add(m_row_panel, cc.xy(1, 3));

    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
}

From source file:com.jeta.swingbuilder.gui.main.MainFrame.java

License:Open Source License

/**
 * Creates the status bar the application. Shows current project.
 *//*from   ww w  .  j a v  a 2 s  .  co  m*/
private void createStatusBar() {
    JETAPanel panel = new JETAPanel();
    FormLayout layout = new FormLayout("pref:grow", "pref");
    panel.setLayout(layout);

    m_status_cell = new TSCell("formcell", "left:pref:nogrow");
    m_status_cell.setFont(javax.swing.UIManager.getFont("Table.font"));
    m_status_cell.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    m_status_cell.setIcon(FormDesignerUtils.loadImage(Icons.APPLICATION_16));
    m_status_cell.setBorder(BorderFactory.createCompoundBorder(m_status_cell.getBorder(),
            BorderFactory.createEmptyBorder(1, 0, 0, 0)));
    CellConstraints cc = new CellConstraints();
    panel.add(m_status_cell, cc.xy(1, 1));
    getContentPane().add(panel, BorderLayout.SOUTH);
}

From source file:com.jeta.swingbuilder.gui.properties.editors.DimensionEditor.java

License:Open Source License

public DimensionEditor() {
    m_panel = new JPanel();
    FormLayout layout = new FormLayout("pref,5px,pref,10px,pref,5px,pref,pref:grow", "pref");
    m_panel.setLayout(layout);//from  w  w w.  ja  v  a 2 s .c  o m
    CellConstraints cc = new CellConstraints();

    m_panel.add(new JLabel(I18N.getLocalizedMessage("width")), cc.xy(1, 1));
    m_panel.add(m_width, cc.xy(3, 1));
    m_panel.add(new JLabel(I18N.getLocalizedMessage("height")), cc.xy(5, 1));
    m_panel.add(m_height, cc.xy(7, 1));
    m_panel.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
    m_width.setEnabled(false);
    m_height.setEnabled(false);
}

From source file:com.jeta.swingbuilder.gui.properties.PropertyPaneContainer.java

License:Open Source License

/**
 * Top panel that displays the name and class of the current bean
 *///from  w ww .  j a va2 s  . co  m
private JPanel createNamePanel() {
    JPanel panel = new JPanel();
    FormLayout layout = new FormLayout("pref,2dlu,pref:grow", "pref,2dlu,pref,4dlu");
    panel.setLayout(layout);
    CellConstraints cc = new CellConstraints();

    panel.add(new JLabel(I18N.getLocalizedDialogLabel("Name")), cc.xy(1, 1));
    m_name_field = new JTextField();
    m_name_field.setEnabled(false);
    panel.add(m_name_field, cc.xy(3, 1));

    panel.add(new JLabel(I18N.getLocalizedDialogLabel("Component")), cc.xy(1, 3));

    layout = new FormLayout("d:grow,24px", "fill:pref");
    m_class_field = new JTextField();
    m_class_field.setEditable(false);
    JPanel cpanel = new JPanel(layout);

    m_customizer_btn = new JButton(FormDesignerUtils.loadImage(Icons.EDIT_16));
    m_customizer_btn.setPreferredSize(new java.awt.Dimension(24, 16));
    m_customizer_btn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            showCustomizerDialog();
        }
    });
    m_customizer_btn.setToolTipText(I18N.getLocalizedMessage("Bean Customizer"));
    m_customizer_btn.setEnabled(false);

    cpanel.add(m_class_field, cc.xy(1, 1));
    cpanel.add(m_customizer_btn, cc.xy(2, 1));

    panel.add(cpanel, cc.xy(3, 3));

    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    m_name_field.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            updateBeanName();
        }
    });

    return panel;
}

From source file:com.jhash.oimadmin.ui.ConnectionDetails.java

License:Apache License

private JPanel buildComponent() {
    FormLayout eventHandlerFormLayout = new FormLayout(
            "3dlu, right:pref, 3dlu, pref:grow, 5dlu, right:pref, 3dlu, pref:grow, 5dlu",
            "5dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu, p,3dlu, p, 3dlu, p ");
    eventHandlerFormLayout.setColumnGroups(new int[][] { { 2, 6 } });
    CellConstraints cellConstraint = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(eventHandlerFormLayout);
    builder.addLabel("Name", cellConstraint.xy(2, 2));
    builder.add(nameLabel, cellConstraint.xy(4, 2));
    builder.addLabel("OIM Home Directory", cellConstraint.xy(6, 2));
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    oimHome.addFocusListener(new FocusListener() {
        boolean focusAfterShowFileChooser = false;

        @Override//from   w ww. j  a v a  2 s  .  c  om
        public void focusGained(FocusEvent e) {
            if (focusAfterShowFileChooser)
                return;
            fileChooser.setSelectedFile(new File(oimHome.getText()));
            int returnedResult = fileChooser.showOpenDialog(ConnectionDetails.this);
            if (returnedResult == JFileChooser.APPROVE_OPTION) {
                File file = fileChooser.getSelectedFile();
                oimHome.setText(file.getAbsolutePath());
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            focusAfterShowFileChooser = fileChooser.isShowing();
        }
    });
    builder.add(oimHome, cellConstraint.xy(8, 2));

    builder.addSeparator("OIM Connection", cellConstraint.xyw(2, 4, 7));
    builder.addLabel("Server Platform", cellConstraint.xy(2, 6));
    builder.add(platform, cellConstraint.xy(4, 6));
    builder.addLabel("OIM Server URL", cellConstraint.xy(6, 6));
    builder.add(oimURL, cellConstraint.xy(8, 6));

    builder.addLabel("User", cellConstraint.xy(2, 8));
    builder.add(oimUser, cellConstraint.xy(4, 8));
    builder.addLabel("Password", cellConstraint.xy(6, 8));
    builder.add(oimUserPassword, cellConstraint.xy(8, 8));

    builder.addSeparator("Weblogic Admin Server (JMX)", cellConstraint.xyw(2, 10, 7));
    builder.addLabel("Protocol", cellConstraint.xy(2, 12));
    builder.add(jmxProtocol, cellConstraint.xy(4, 12));

    builder.addLabel("Host name", cellConstraint.xy(2, 14));
    builder.add(jmxHostname, cellConstraint.xy(4, 14));
    builder.addLabel("Port", cellConstraint.xy(6, 14));
    builder.add(jmxPort, cellConstraint.xy(8, 14));

    builder.addLabel("User", cellConstraint.xy(2, 16));
    builder.add(jmxUser, cellConstraint.xy(4, 16));
    builder.addLabel("Password", cellConstraint.xy(6, 16));
    builder.add(jmxUserPassword, cellConstraint.xy(8, 16));

    builder.addSeparator("Database", cellConstraint.xyw(2, 18, 5));
    JButton testDBButton = JGComponentFactory.getCurrent().createButton("Test");
    testDBButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Utils.executeAsyncOperation("Test Database Connection", new Runnable() {
                public void run() {
                    logger.debug("Trying to test connection using configuration {}", connectionDetails);
                    DBConnection connection = new DBConnection();
                    try {
                        connection.initialize(connectionDetails);
                        displayMessage("Database Connection", "Successfully connected to database", null);
                    } catch (Exception exception) {
                        displayMessage("Database Connection Failed",
                                "Failed to create data base connection using details", exception);
                    }
                    try {
                        connection.destroy();
                    } catch (Exception exception) {
                        logger.warn("Failed to destroy new connection. Ignoring error", exception);
                    }
                    logger.debug("Tested connection");
                }
            });
        }
    });
    builder.add(testDBButton, cellConstraint.xy(8, 18));

    builder.addLabel("Driver Class", cellConstraint.xy(2, 20));
    builder.add(dbJDBCDriverClass, cellConstraint.xy(4, 20));
    builder.addLabel("JDBC URL", cellConstraint.xy(6, 20));
    builder.add(dbJDBCURL, cellConstraint.xy(8, 20));

    builder.addLabel("User", cellConstraint.xy(2, 22));
    builder.add(dbUser, cellConstraint.xy(4, 22));
    builder.addLabel("Password", cellConstraint.xy(6, 22));
    builder.add(dbPassword, cellConstraint.xy(8, 22));

    builder.add(dbAutoCommit, cellConstraint.xy(4, 24));

    JButton saveButton = JGComponentFactory.getCurrent().createButton("&Save");
    saveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            logger.debug("Trying to save configuration {}", connectionDetails);
            connectionDetails.getConfig().saveConfiguration(connectionDetails, false);
            String connectionName = connectionDetails.getProperty(Connection.ATTR_CONN_NAME);
            if (isNewConnection)
                ConnectionTreeNode.ConnectionsRegisterUI.addNewNode(connectionName,
                        connectionDetails.getConfig(), selectionTree, displayArea);
            destroy();
            logger.debug("Saved configuration");
        }
    });
    JButton cancelButton = JGComponentFactory.getCurrent().createButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            destroy();
        }
    });
    builder.add(saveButton, cellConstraint.xy(4, 26));
    builder.add(cancelButton, cellConstraint.xy(6, 26));
    return builder.build();
}

From source file:com.jhash.oimadmin.ui.EventHandlerDetails.java

License:Apache License

private JPanel buildDetailScreen() {
    JPanel eventHandlerDetailPanel = new JPanel(new BorderLayout());
    JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT);
    FormLayout eventHandlerFormLayout = new FormLayout(
            "right:pref, 3dlu, pref:grow, 7dlu, right:pref, 3dlu, pref:grow",
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu");
    eventHandlerFormLayout.setColumnGroups(new int[][] { { 1, 5 } });
    CellConstraints cellConstraint = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(eventHandlerFormLayout);
    builder.addLabel("Name", cellConstraint.xy(1, 1));
    builder.add(nameLabel, cellConstraint.xy(3, 1));
    switch (connection.getVersion()) {
    case OIM11GR2PS2:
        builder.addLabel("Custom", cellConstraint.xy(5, 1));
        builder.add(customLabel, cellConstraint.xy(7, 1));
        break;/*  w w w .j a v  a 2  s  .c  o m*/
    default:
        builder.addLabel("Sync", cellConstraint.xy(5, 1));
        builder.add(sync, cellConstraint.xy(7, 1));
        break;
    }
    builder.addLabel("Stage", cellConstraint.xy(1, 3));
    builder.add(stageLabel, cellConstraint.xy(3, 3));
    builder.addLabel("Order", cellConstraint.xy(5, 3));
    builder.add(orderLabel, cellConstraint.xy(7, 3));
    builder.addLabel("Conditional", cellConstraint.xy(1, 5));
    builder.add(conditionalLabel, cellConstraint.xy(3, 5));
    switch (connection.getVersion()) {
    case OIM11GR2PS2:
        builder.addLabel("Off Band", cellConstraint.xy(5, 5));
        builder.add(offBandLabel, cellConstraint.xy(7, 5));
        break;
    default:
        builder.addLabel("Exception", cellConstraint.xy(5, 5));
        builder.add(exception, cellConstraint.xy(7, 5));
        break;
    }
    builder.addLabel("Location", cellConstraint.xy(1, 7));
    builder.add(locationLabel, cellConstraint.xyw(3, 7, 5));
    builder.addLabel("Class", cellConstraint.xy(1, 9));
    builder.add(classNameLabel, cellConstraint.xyw(3, 9, 5));
    switch (connection.getVersion()) {
    case OIM11GR2PS2:
        break;
    default:
        builder.addLabel("Transactional", cellConstraint.xy(1, 11));
        builder.add(transactional, cellConstraint.xyw(3, 11, 5));
        break;
    }
    splitPane.add(new JideScrollPane(table), 0);
    splitPane.add(builder.getPanel(), 1);
    splitPane.setProportionalLayout(true);
    splitPane.setProportions(new double[] { 0.6 });
    eventHandlerDetailPanel.add(splitPane, BorderLayout.CENTER);
    logger.debug("Returning the developed component {}", eventHandlerDetailPanel);
    return eventHandlerDetailPanel;
}