Example usage for com.jgoodies.forms.builder DefaultFormBuilder DefaultFormBuilder

List of usage examples for com.jgoodies.forms.builder DefaultFormBuilder DefaultFormBuilder

Introduction

In this page you can find the example usage for com.jgoodies.forms.builder DefaultFormBuilder DefaultFormBuilder.

Prototype

public DefaultFormBuilder(FormLayout layout) 

Source Link

Document

Constructs a DefaultFormBuilder for the given layout.

Usage

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

License:Common Public License

public static JPanel makeDonatePanel(boolean border) {
    FormLayout layout = new FormLayout("250px", // cols //$NON-NLS-1$
            "p, 6dlu,  p"); // rows //$NON-NLS-1$
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    if (border)//from w  w w  .j ava2 s.  c  o m
        builder.setDefaultDialogBorder();

    JLabel msg = new JLabel(Messages.getString("Text.donateMessage"));

    builder.append(msg);
    builder.nextLine(2);
    ImageIcon icon = IconManager.getIcon("paypal.donate");
    JButton donate = new JButton(icon);
    donate.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    builder.append(donate);
    donate.setEnabled(true);
    donate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            BrowserControl.displayURL(donateUrl);
        }
    });

    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 ww  . jav a 2s .  c om*/
    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.InformationDialog.java

License:Common Public License

protected JComponent pairedComponents(FieldComponentMap map, String fieldId, int fieldFlag, JComponent tool) {
    FormLayout layout = new FormLayout("p:grow,0dlu,16dlu", // extra padding on right is for estimated field //$NON-NLS-1$
            "p"); //$NON-NLS-1$

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    Component c = map.getComponent(fieldId, fieldFlag);
    Field field = Configuration.getFieldFromId(fieldId);
    builder.append(c);/*from   ww w  . j a  v  a 2s.  co  m*/
    if (field.getHelp() != null)
        HelpUtil.addDocHelp(c, field.getHelp());
    if (fieldFlag != ComponentFactory.READ_ONLY)
        builder.append(tool);
    return builder.getPanel();
}

From source file:com.projity.dialog.LicenseDialog.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.
 *
 * @return the built panel//w  w  w .  j ava 2s .c  o m
 */

public JComponent createContentPanel() {
    FormLayout layout = new FormLayout("700px", // cols //$NON-NLS-1$
            "600px"); // 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();
    if (!Environment.isOpenProj()) {
        builder.append(new JScrollPane(thirdParty));
    } else {
        JTabbedPane tabbed = new JTabbedPane();
        tabbed.addTab(Messages.getString("LicenseDialog.License"), new JScrollPane(license));
        tabbed.addTab(Messages.getString("LicenseDialog.ThirdParty"), new JScrollPane(thirdParty));
        builder.append(tabbed);
    }

    JComponent result = builder.getPanel();
    return result;
}

From source file:com.projity.dialog.LoginDialog.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("default, 3dlu, 120dlu:grow", // cols //$NON-NLS-1$
            "p, 3dlu,p,3dlu,p,3dlu,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();
    builder.append(Messages.getString("LoginDialog.Login"), login); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(Messages.getString("LoginDialog.Password"), password); //$NON-NLS-1$
    builder.nextLine(2);
    //      builder.append(useMenus);
    //      builder.append(Messages.getString("LoginDialog.UseOfficeLook")); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(storeCredentials);
    builder.append(Messages.getString("LoginDialog.RememberMe")); //$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.
 * /* w w w  .  ja v  a 2 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("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.OpenProjectDialog.java

License:Common Public License

public JComponent createContentPanel() {
    initControls();/*from w  w  w .  j a  v  a 2 s. c o m*/
    //TODO set minimum size
    FormLayout layout = new FormLayout("400dlu:grow", // cols //$NON-NLS-1$
            "p,3dlu,p,2dlu"); // 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();
    builder.add(new JScrollPane(/*list*/table));
    builder.nextLine(2);
    resourcePoolMessage = new JLabel(Messages.getString("Warn.resourcePoolCannotOpen"));
    resourcePoolMessage.setVisible(false);
    builder.add(resourcePoolMessage);

    return builder.getPanel();
}

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

License:Common Public License

public JComponent createContentPanel() {

    initControls();/*from  ww w . ja v a  2s  .c  om*/

    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.PODOnlyFeature.java

License:Common Public License

public JComponent createContentPanel() {
    FormLayout layout = new FormLayout("250px", "100px");// rows,cols //$NON-NLS-1$
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();// w  ww .  j av  a 2 s  . co  m
    String tip = Messages.getString("Text.notAvailableInOpenProj");
    JEditorPane link = new JEditorPane("text/html", tip);
    link.setEditable(false);
    link.setForeground(Colors.GRAY);
    link.setFont(this.getFont());

    link.setBackground(getBackground());

    link.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
                BrowserControl.displayURL(e.getURL().toExternalForm());
        }
    });

    builder.append(link);
    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.
 * //from  ww  w  .j  a v a 2  s  .c om
 * @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();
}