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

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

Introduction

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

Prototype

public CellConstraints xyw(int col, int row, int colSpan) 

Source Link

Document

Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

Examples:

 cc.xyw(1, 3, 7); cc.xyw(1, 3, 2); 

Usage

From source file:com.pari.license.ui.LicenseGenDialog.java

License:Open Source License

@Override
public JComponent createContentPanel() {
    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new BorderLayout());
    contentPanel.setBackground(Color.white);

    seedTextArea = new AutoResizingTextArea(100, 100);
    seedTextArea.addMouseListener(new TextFieldMenu(seedTextArea));
    seedTextArea.setEditable(true);//from w w w  . ja va2s .  c  o m

    evaluationCheckBox = new JCheckBox("Evaluation License Only");
    evaluationCheckBox.setOpaque(false);
    evaluationCheckBox.setMargin(new Insets(0, 0, 0, 0));

    evaluationCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            enableControls();
        }
    });

    allowDeviceBeyondLicenseCheck = new JCheckBox("Allow to add devices beyond Maximum Devices");
    allowDeviceBeyondLicenseCheck.setOpaque(false);
    allowDeviceBeyondLicenseCheck.setMargin(new Insets(0, 0, 0, 0));

    allowDeviceBeyondLicenseCheck.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
        }
    });

    JPanel optionsPane = new JPanel();
    optionsPane.setOpaque(false);

    String columnSpecs = "5dlu, pref, 5dlu, 175dlu, 5dlu, 30dlu";
    String rowSpecs = "pref, 4dlu, top:100dlu, 8dlu, pref, 4dlu, pref, 5dlu, pref, 5dlu, pref, 8dlu, pref, 6dlu, pref, 8dlu, pref";
    FormLayout formLayout = new FormLayout(columnSpecs, rowSpecs);
    DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, optionsPane);
    builder.setDefaultDialogBorder();

    evaluationPeriod = new NumericTextField();
    evaluationPeriod.addMouseListener(new TextFieldMenu(evaluationPeriod));

    maxDevices = new NumericTextField();
    maxDevices.addMouseListener(new TextFieldMenu(maxDevices));

    JLabel seedLabel = ControlFactory.createLabelFor("License Seed", true, seedTextArea, 'S');
    JLabel evalPeriodLabel = ControlFactory.createLabelFor("Evaluation Period", false, evaluationPeriod, 'E');
    JLabel maxDevicesLabel = ControlFactory.createLabelFor("Maximum Devices", true, maxDevices, 'M');

    CellConstraints cc = new CellConstraints();

    int rowIndex = 1;
    builder.addSeparator("License Seed Information", cc.xyw(1, rowIndex, 6));

    rowIndex += 2;
    builder.add(seedLabel, cc.xy(2, rowIndex));
    builder.add(new JScrollPane(seedTextArea), cc.xyw(4, rowIndex, 3));

    rowIndex += 2;
    builder.addSeparator("License Details", cc.xyw(1, rowIndex, 6));

    rowIndex += 2;
    builder.add(evaluationCheckBox, cc.xyw(2, rowIndex, 4));

    rowIndex += 2;
    builder.add(evalPeriodLabel, cc.xy(2, rowIndex));
    builder.add(evaluationPeriod, cc.xy(4, rowIndex));
    builder.add(new JLabel("(days)"), cc.xy(6, rowIndex));

    rowIndex += 2;
    builder.add(maxDevicesLabel, cc.xy(2, rowIndex));
    builder.add(maxDevices, cc.xy(4, rowIndex));

    rowIndex += 2;

    builder.add(allowDeviceBeyondLicenseCheck, cc.xyw(2, rowIndex, 4));

    contentPanel.add(optionsPane, BorderLayout.CENTER);

    licensedComponentsList = new CheckBoxList(getAllComponentNames());
    licensedComponentsList.setPreferredSize(new Dimension(350, 175));
    SearchableUtils.installSearchable(licensedComponentsList);

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3),
            BorderFactory.createTitledBorder("Select Licensed Components")));

    panel.setOpaque(false);
    panel.setLayout(new BorderLayout());
    panel.add(new JScrollPane(licensedComponentsList), BorderLayout.CENTER);

    contentPanel.add(panel, BorderLayout.SOUTH);

    contentPanel.setBackground(Color.white);
    setResizable(true);
    enableControls();
    return contentPanel;
}

From source file:com.projity.dialog.assignment.AssignmentDialog.java

License:Common Public License

public JComponent createContentPanel() {

    // Separating the component initialization and configuration
    // from the layout code makes both parts easier to read.
    initControls();/*w  w w  . j av a  2  s  .  co  m*/
    FormLayout layout = new FormLayout("p, 1dlu, default ,3dlu, default", // cols //$NON-NLS-1$
            "p, 3dlu," + (Environment.getStandAlone() ? "" : "p, 3dlu,") + "fill:200dlu:grow"); // rows //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    // task names span whole dialog
    builder.add(taskNames, cc.xyw(builder.getColumn(), builder.getRow(), builder.getColumnCount()));
    builder.nextLine(2);

    if (!Environment.getStandAlone()) {
        if (!Environment.isExternal())
            builder.add(getTeamOrAllLabel(),
                    cc.xyw(builder.getColumn(), builder.getRow(), builder.getColumnCount()));
        builder.nextLine(2);
    }

    //      builder.append(projectName);
    //      builder.nextLine(2);

    builder.append(spreadSheetPane, createEditorsButtons(), createButtons());
    return builder.getPanel();
}

From source file:com.projity.dialog.DelegateTaskDialog.java

License:Common Public License

public JComponent createContentPanel() {
    taskNames = new JLabel();
    String names = DataUtils.stringListWithMaxAndMessage(getCollection(), Settings.STRING_LIST_LIMIT,
            Messages.getString("Message.tooManyTasksSelectedToList.mf")); //$NON-NLS-1$
    taskNames.setText(Messages.getString("Text.Tasks") + ": " + names); //$NON-NLS-1$ //$NON-NLS-2$

    FieldComponentMap map = createMap();

    FormLayout layout = new FormLayout("p, 3dlu, p" //$NON-NLS-1$
            , "p,3dlu,p"); //$NON-NLS-1$

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();/*from   ww w. java  2 s  .  c  o m*/
    CellConstraints cc = new CellConstraints();

    // task names span whole dialog
    builder.add(taskNames, cc.xyw(builder.getColumn(), builder.getRow(), builder.getColumnCount()));
    builder.nextLine(2);
    map.append(builder, "Field.delegatedTo"); //$NON-NLS-1$
    return builder.getPanel();
}

From source file:com.projity.dialog.DependencyDialog.java

License:Common Public License

public JComponent createContentPanel() {
    // Separating the component initialization and configuration
    // from the layout code makes both parts easier to read.
    initControls();//from www . j  a v a 2s. co m
    //TODO set minimum size
    FormLayout layout = new FormLayout("50dlu,3dlu,50dlu,3dlu,50dlu,3dlu,50dlu", // cols
            "p,3dlu,p,3dlu,p,3dlu,p,3dlu"); // rows

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    builder.append(Messages.getString("Text.From") + ":");
    builder.add(preLabel, cc.xyw(builder.getColumn(), builder.getRow(), 5));
    builder.nextLine(2);
    builder.append(Messages.getString("Text.To") + ":");
    builder.add(sucLabel, cc.xyw(builder.getColumn(), builder.getRow(), 5));

    builder.nextLine(2);
    builder.append(Messages.getString("Text.Type") + ":", typeCombo);

    builder.addLabel(Messages.getString("Text.Lag") + ":");
    builder.nextColumn(2);
    builder.add(lagTextField);

    return builder.getPanel();
}

From source file:com.projity.dialog.HelpDialog.java

License:Common Public License

/**
 * Builds the panel. Initializes and configures components first, then
 * creates a FormLayout, configures the layout, creates a builder, sets a
 * border, and finally adds the components.
 * /*from  w w  w .  j  a  v  a 2 s.c  o  m*/
 * @return the built panel
 */

public JComponent createContentPanel() {
    // Separating the component initialization and configuration
    // from the layout code makes both parts easier to read.
    //TODO set minimum size
    FormLayout layout = new FormLayout("120px,180px,120px", // cols //$NON-NLS-1$

            "p, 6dlu,  p,6dlu,p,6dlu,p,6dlu,p,6dlu,p"); // rows //$NON-NLS-1$

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    JLabel logo = new JLabel(IconManager.getIcon("logo.ProjectLibre"));
    logo.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent arg0) {
            BrowserControl.displayURL("http://www.projectlibre.com");//$NON-NLS-1$
        }
    });
    builder.nextColumn();
    builder.append(logo);
    builder.nextLine(2);
    builder.nextColumn();
    builder.append(link);
    //      builder.nextLine(2);
    //      builder.append(videos);
    if (Environment.isOpenProj()) {
        builder.nextLine(2);
        builder.nextColumn();
        builder.append(tipOfTheDay);
    }
    builder.nextLine(2);
    builder.nextColumn();
    builder.append(license);

    builder.nextLine(2);
    String version = VersionUtils.getVersion();
    builder.addLabel(Messages.getContextString("Text.ShortTitle") + " " + "Version "
            + (version == null ? "Unknown" : version), cc.xyw(1, 9, 3));
    builder.nextLine(2);
    builder.addLabel(Messages.getString("AboutDialog.copyright"), cc.xyw(1, 11, 3));

    if (false || Environment.isOpenProj()) { // removed donation link
        JPanel p = new JPanel();
        p.add(builder.getPanel());
        //      p.add(makeDonatePanel(false));
        return p;
    } else
        return builder.getPanel();
}

From source file:com.projity.dialog.InformationDialog.java

License:Common Public License

protected JComponent createNotesPanel() {
    FieldComponentMap map = createMap();
    FormLayout layout = new FormLayout("p:grow", // extra padding on right is for estimated field //$NON-NLS-1$
            "p, 3dlu,p, 3dlu, fill:50dlu:grow"); //$NON-NLS-1$

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    CellConstraints cc = new CellConstraints();
    builder.setDefaultDialogBorder();/*from  w w w  . j av  a  2s.com*/
    JComponent header = createHeaderFieldsPanel(map);
    if (header != null)
        builder.add(header, cc.xyw(builder.getColumn(), builder.getRow(), 1));

    builder.nextLine(2);
    builder.append(map.getLabel("Field.notes") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    builder.nextLine(2);
    builder.append(map.getComponent("Field.notes", 0)); //$NON-NLS-1$
    return builder.getPanel();
}

From source file:com.projity.dialog.LookupDialog.java

License:Common Public License

/**
 * Builds the panel. Initializes and configures components first, then
 * creates a FormLayout, configures the layout, creates a builder, sets a
 * border, and finally adds the components.
 * //from w w  w  .  j a  v a2 s . c  o  m
 * @return the built panel
 */

public JComponent createContentPanel() {
    // Separating the component initialization and configuration
    // from the layout code makes both parts easier to read.
    initControls();
    //TODO set minimum size
    FormLayout layout = new FormLayout("p, 3dlu, p,20dlu,p,3dlu,160dlu:grow,3dlu,p", // cols //$NON-NLS-1$
            "p, 3dlu, p,3dlu,fill:default:grow"); // rows //$NON-NLS-1$

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    builder.append(Messages.getString("LookupDialog.Type"), types); //$NON-NLS-1$
    builder.append(Messages.getString("LookupDialog.Find") + ":", match); //$NON-NLS-1$
    builder.append(find);
    builder.nextLine(2);
    builder.append(Messages.getString("LookupDialog.Results")); //$NON-NLS-1$
    builder.nextLine(2);
    builder.add(resultsPane, cc.xyw(builder.getColumn(), builder.getRow(), 9));
    return builder.getPanel();
}

From source file:com.projity.dialog.options.CalendarDialogBox.java

License:Common Public License

public JComponent createContentPanel() {

    initControls();/*ww  w .  j a v  a 2  s  .c o  m*/

    FormLayout layout = new FormLayout("p,3dlu,p,p:grow", //$NON-NLS-1$
            "p,3dlu,p,3dlu,p,3dlu,p"); //$NON-NLS-1$

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    builder.add(new JLabel(Messages.getString("CalendarDialogBox.TheseSettingsOnlyApplyToDuration")), //$NON-NLS-1$
            cc.xyw(builder.getColumn(), builder.getRow(), 4));
    builder.nextLine(2);
    builder.append(Messages.getString("CalendarDialogBox.HoursPerday"), hoursPerDay); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(Messages.getString("CalendarDialogBox.HoursPerWeek"), hoursPerWeek); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(Messages.getString("CalendarDialogBox.DaysPerMonth"), daysPerMonth); //$NON-NLS-1$

    return builder.getPanel();
}

From source file:com.projity.dialog.ProjectDialog.java

License:Common Public License

/**
 * Builds the panel. Initializes and configures components first, then
 * creates a FormLayout, configures the layout, creates a builder, sets a
 * border, and finally adds the components.
 * /*w ww .j  ava2  s .co m*/
 * @return the built panel
 */

public JComponent createContentPanel() {
    // Separating the component initialization and configuration
    // from the layout code makes both parts easier to read.
    initControls();
    //TODO set minimum size
    FormLayout layout = new FormLayout("default, 3dlu, 220dlu, 3dlu, default:grow", // cols //$NON-NLS-1$
            // with commented fields         "p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 3dlu,p, 3dlu,p, 3dlu,p,3dlu,p 3dlu, p, 3dlu, fill:50dlu:grow"); // rows
            "p, 3dlu,p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, fill:50dlu:grow"); // rows //$NON-NLS-1$

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    builder.append(Messages.getString("ProjectDialog.ProjectName"), name, 3); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(Messages.getString("ProjectDialog.Manager"), manager, 3); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(dateLabel);
    builder.append(startDateChooser);
    builder.append(forward);
    builder.nextLine(2);

    if (!Environment.getStandAlone()) {
        builder.append(Messages.getString("ProjectDialog.ProjectTeam")); //$NON-NLS-1$
        builder.add(accessControl, cc.xy(builder.getColumn(), builder.getRow(), "left,default")); //$NON-NLS-1$
    }
    HelpUtil.addDocHelp(accessControl, "Project_Team");
    //      builder.nextLine(2);
    //      builder.append("Project Status:",projectStatus);
    //      builder.nextLine(2);
    //      builder.append("Project Type:",projectType);
    //      builder.nextLine(2);
    //      builder.append("Expense Type:",expenseType);
    //      builder.nextLine(2);
    //      builder.append("Division:",division);
    //      builder.nextLine(2);
    //      builder.append("Group:",group);
    builder.nextLine(2);

    FieldComponentMap map = createMap();
    Collection extraFields = FieldDictionary
            .extractExtraFields(FieldDictionary.getInstance().getProjectFields(), true);
    JComponent extra = createFieldsPanel(map, extraFields);
    if (extra != null) {
        builder.add(extra, cc.xyw(builder.getColumn(), builder.getRow(), 3));
    }
    builder.nextLine(2);

    //      builder.append("Shared resource Pool:", resourcePool);
    //      builder.nextLine(2);
    builder.append(Messages.getString("ProjectDialog.Notes")); //$NON-NLS-1$
    builder.nextLine(2);
    builder.add(new JScrollPane(notes), cc.xyw(builder.getColumn(), builder.getRow(), 5)); // allow spanning 3 cols
    return builder.getPanel();
}

From source file:com.projity.dialog.ProjectInformationDialog.java

License:Common Public License

private JComponent createGeneralPanel() {
    FieldComponentMap map = createMap();
    FormLayout layout = new FormLayout("max(50dlu;pref), 3dlu, 90dlu, 10dlu, p, 3dlu,max(90dlu;pref),60dlu", // extra padding on right is for estimated field //$NON-NLS-1$
            "p,3dlu,p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu,p,3dlu,p,3dlu,p, 3dlu,p,3dlu,p, 6dlu, fill:50dlu:grow"); //$NON-NLS-1$

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    CellConstraints cc = new CellConstraints();
    builder.setDefaultDialogBorder();// ww  w.  j  av  a  2 s .  c om
    builder.add(createHeaderFieldsPanel(map), cc.xyw(builder.getColumn(), builder.getRow(), 8));
    builder.nextLine(2);
    map.append(builder, "Field.manager"); //$NON-NLS-1$
    builder.nextLine(2);

    map.appendSometimesReadOnly(builder, "Field.startDate"); //$NON-NLS-1$
    map.append(builder, "Field.currentDate"); //$NON-NLS-1$
    builder.nextLine(2);
    map.appendSometimesReadOnly(builder, "Field.finishDate"); //$NON-NLS-1$
    map.append(builder, "Field.statusDate"); //$NON-NLS-1$

    builder.nextLine(2);
    map.append(builder, "Field.forward"); //$NON-NLS-1$
    builder.nextColumn(2);
    map.append(builder, "Field.baseCalendar"); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.priority"); //$NON-NLS-1$
    map.append(builder, "Field.projectStatus"); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.projectType"); //$NON-NLS-1$
    map.append(builder, "Field.expenseType"); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.projectDivision"); //$NON-NLS-1$
    map.append(builder, "Field.projectGroup"); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.netPresentValue"); //$NON-NLS-1$
    map.append(builder, "Field.benefit"); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.risk"); //$NON-NLS-1$
    builder.nextLine(2);

    if (!Environment.getStandAlone()) {
        map.append(builder, "Field.accessControlPolicy", 3); //$NON-NLS-1$
        builder.nextLine(2);
    }
    Collection extraFields = FieldDictionary
            .extractExtraFields(FieldDictionary.getInstance().getProjectFields(), false);
    JComponent extra = createFieldsPanel(map, extraFields);
    if (extra != null) {
        builder.add(extra, cc.xyw(builder.getColumn(), builder.getRow(), 7));
    }
    return builder.getPanel();
}