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

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

Introduction

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

Prototype

public JLabel append(String textWithMnemonic) 

Source Link

Document

Adds a text label to the panel and proceeds to the next column.

Usage

From source file:com.projity.dialog.BaselineDialog.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  . j av 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("default, 3dlu, fill:80dlu:grow", // cols //$NON-NLS-1$
            "p, 3dlu, 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("BaselineDialog.Baseline")); //$NON-NLS-1$
    builder.append(baseline);
    builder.nextLine(2);
    builder.addSeparator(""); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(Messages.getString("BaselineDialog.For")); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(entireProject);
    builder.nextLine(2);
    builder.append(selectedTasks);
    return builder.getPanel();
}

From source file:com.projity.dialog.calendar.ChangeWorkingTimeDialogBox.java

License:Common Public License

public JComponent createContentPanel() {

    initControls();//from ww w.jav  a2 s .  c  o  m

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

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    //       JSplitPane settingsPanel=new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    //       settingsPanel.setTopComponent(createSettingsPanel());
    //       settingsPanel.setBottomComponent(new JPanel());
    //       settingsPanel.setDividerSize(0);
    JSplitPane panel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    //      panel.setLeftComponent(settingsPanel);
    panel.setLeftComponent(createSettingsPanel());

    panel.setRightComponent(sdCalendar);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    JButton backButton = new JButton(IconManager.getIcon("calendar.back")); //$NON-NLS-1$
    backButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            long first = sdCalendar.getFirstDisplayedDate();
            Calendar calendar = DateTime.calendarInstance();
            calendar.setTimeInMillis(sdCalendar.getLastDisplayedDate());
            int nbMonth = 0;
            while (calendar.getTimeInMillis() > first) {
                calendar.add(Calendar.MONTH, -1);
                nbMonth++;
            }
            calendar.setTimeInMillis(first);
            calendar.add(Calendar.MONTH, -nbMonth);
            sdCalendar.setFirstDisplayedDate(calendar.getTimeInMillis());
        }
    });
    JButton todayButton = new JButton(IconManager.getIcon("calendar.today")); //$NON-NLS-1$
    todayButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Calendar calendar = DateTime.calendarInstance();
            calendar.setTimeInMillis(System.currentTimeMillis());
            calendar.set(Calendar.DATE, 1);
            sdCalendar.setFirstDisplayedDate(calendar.getTimeInMillis());
        }
    });
    JButton forwardButton = new JButton(IconManager.getIcon("calendar.forward")); //$NON-NLS-1$
    forwardButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Calendar calendar = DateTime.calendarInstance();
            calendar.setTimeInMillis(sdCalendar.getLastDisplayedDate());
            calendar.add(Calendar.DATE, 1);
            sdCalendar.setFirstDisplayedDate(calendar.getTimeInMillis());
        }
    });
    buttonPanel.add(backButton);
    buttonPanel.add(todayButton);
    buttonPanel.add(forwardButton);
    builder.nextLine();
    builder.append(buttonPanel);
    builder.nextLine();
    builder.append(panel);

    //      builder.append(newCalendar);

    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();//  ww w . ja  va  2 s  .  c o 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.DonateDialog.java

License:Common Public License

public JComponent createContentPanel() {
    FormLayout layout = new FormLayout("default", // cols //$NON-NLS-1$
            (showRunsSince ? "p, 6dlu," : "") + "170px"); // rows //$NON-NLS-1$
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();//from   w w  w .ja  v a  2 s.co m

    if (showRunsSince) {
        builder.append(Main.getRunSinceMessage());
        builder.nextLine(2);
    }
    builder.append(HelpDialog.makeDonatePanel(false));
    return builder.getPanel();
}

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

License:Common Public License

public JComponent createContentPanel() {
    FormLayout layout = new FormLayout("400px", "100px");// rows,cols //$NON-NLS-1$
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();/*from   w w w .ja va2s .  c o  m*/
    JTextArea textArea = new JTextArea(Messages.getString("Text.notAvailableWithJava15"), 4, 50);

    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    textArea.setEditable(false);
    textArea.setOpaque(false);
    builder.append(textArea);

    Hyperlink link = new Hyperlink(Messages.getString("Text.javaUpgradeUrl"),
            Messages.getString("Text.javaUpgradeUrl"));
    JLabel linkLabel = link.createLinkLabel();

    builder.append(linkLabel);

    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  av 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.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)/* w w  w.  j  a v a 2 s .com*/
        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 w  w  . j  ava  2 s  .c  o m
    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);
    if (field.getHelp() != null)
        HelpUtil.addDocHelp(c, field.getHelp());
    if (fieldFlag != ComponentFactory.READ_ONLY)
        builder.append(tool);//from  w ww .  ja  v a 2 s.c  o  m
    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/*  ww  w.ja  v  a 2 s .  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;
}