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

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

Introduction

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

Prototype

public CellConstraints() 

Source Link

Document

Constructs a default instance of CellConstraints .

Usage

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

License:Common Public License

public JComponent createResourcesPanel() {
    FieldComponentMap map = createMap();

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

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();//w w  w.j a  v  a  2 s .  com
    CellConstraints cc = new CellConstraints();
    builder.add(createHeaderFieldsPanel(map), cc.xyw(builder.getColumn(), builder.getRow(), 3));
    builder.nextLine(2);
    builder.append(Messages.getString("TaskInformationDialog.Resources") + ":", getAssignResourceButton()); //$NON-NLS-1$
    builder.nextLine(2);
    builder.add(createAssignmentSpreadsheet(), cc.xyw(builder.getColumn(), builder.getRow(), 3));
    JComponent panel = builder.getPanel();
    HelpUtil.addDocHelp(panel, "Assign_Resources");
    return panel;
}

From source file:com.projity.dialog.TransformParameterDialog.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.
 * // www.  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.
    initControls();
    //TODO set minimum size
    FormLayout layout = new FormLayout("default, 3dlu, default", // cols
            "p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu"); // rows
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    Iterator l = labels.iterator();
    Iterator c = valueComponents.iterator();
    while (l.hasNext()) {
        String name = (String) l.next();
        JComponent comp = (JComponent) c.next();
        builder.append(name, comp);
        builder.nextLine(2);
    }
    return builder.getPanel();
}

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

License:Common Public License

public JComponent createContentPanel() {

    initControls();//from   w  w  w.  j  a  v a 2  s .co m

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

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

    builder.append(update);
    builder.append(Messages.getString("UpdateProjectDialogBox.UpdateWorkAsCompleteThrough")); //$NON-NLS-1$
    builder.append(updateDateChooser);
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.add(progress, cc.xyw(builder.getColumn(), builder.getRow(), 5));
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.add(completeOrNotOnly, cc.xyw(builder.getColumn(), builder.getRow(), 5));
    builder.nextLine(2);
    builder.append(reschedule);
    builder.append(Messages.getString("UpdateProjectDialogBox.RescheduleCompletedWorkToStartAfter")); //$NON-NLS-1$
    builder.append(rescheduleDateChooser);
    builder.nextLine(8);
    builder.addSeparator(""); //$NON-NLS-1$
    builder.nextLine(2);
    builder.append(Messages.getString("UpdateProjectDialogBox.For")); //$NON-NLS-1$
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.append(entireProject);
    builder.nextLine(2);
    builder.nextColumn(2);
    builder.append(selectedTask);

    return builder.getPanel();
}

From source file:com.projity.dialog.UpdateTaskDialog.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, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p" //$NON-NLS-1$
            , "p,3dlu,p,3dlu,p,3dlu,p,3dlu,p,3dlu,p,3dlu,p,3dlu,p,3dlu,p,3dlu,p"); //$NON-NLS-1$

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();//from w  w  w. j a  v a2s.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);
    builder.addSeparator(""); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.name", 5); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.percentComplete"); //$NON-NLS-1$
    map.append(builder, "Field.duration"); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.start"); //$NON-NLS-1$
    map.append(builder, "Field.finish"); //$NON-NLS-1$
    builder.nextLine(2);
    builder.addSeparator(""); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.actualDuration"); //$NON-NLS-1$
    map.append(builder, "Field.remainingDuration"); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.actualStart"); //$NON-NLS-1$
    map.append(builder, "Field.actualFinish"); //$NON-NLS-1$
    builder.nextLine(2);
    builder.addSeparator(""); //$NON-NLS-1$
    builder.nextLine(2);
    map.append(builder, "Field.taskType");
    return builder.getPanel();
}

From source file:com.projity.dialog.UserInfoDialog.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//from w  ww .j  av a  2  s .c om
 */

public JComponent createContentPanel() {
    FormLayout layout = new FormLayout("p,3dlu,p,3dlu", // cols //$NON-NLS-1$
            "p,10dlu,p,10dlu"); // 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();
    JEditorPane l = new JEditorPane("text/html", Messages.getString("LicenseDialog.Email"));
    l.setEditable(false);
    l.setOpaque(false);
    l.setFont(l.getFont().deriveFont(Font.PLAIN));
    JLabel emailLabel = new JLabel(Messages.getString("LicenseDialog.EmailLabel") + ":");
    //emailLabel.setFont(emailLabel.getFont().deriveFont(Font.PLAIN));
    builder.add(l, cc.xyw(1, 1, 4));
    builder.nextLine(2);
    builder.append(emailLabel, email);
    builder.nextLine(2);

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

From source file:com.projity.dialog.util.FieldComponentMap.java

License:Common Public License

public JComponent append(DefaultFormBuilder builder, String fieldId, int span) {
    Field field = Configuration.getFieldFromId(fieldId);
    if (field == null)
        return null;
    JComponent component = getComponent(fieldId, 0);
    boolean isCheckbox = component instanceof JCheckBox;
    CellConstraints cc = new CellConstraints().xyw(builder.getColumn() + (isCheckbox ? 0 : 2), builder.getRow(),
            span);//from  w  ww  . ja  v  a 2 s. c  om
    if (component instanceof JCheckBox) {// checkboxes already have a label to the right
        builder.add(component, cc);
    } else {
        builder.addLabel(getLabel(fieldId) + ":");
        builder.nextColumn(2);
        builder.add(component, cc);
        builder.nextColumn(1);
    }
    String fieldDoc = field.getHelp();
    if (fieldDoc != null)
        HelpUtil.addDocHelp(component, fieldDoc);
    return component;
}

From source file:com.projity.dialog.XbsDependencyDialog.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. ja  v  a 2 s. co  m
    //TODO set minimum size
    FormLayout layout = new FormLayout("50dlu,3dlu,50dlu,3dlu,50dlu,3dlu,50dlu", // cols
            "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));

    return builder.getPanel();
}

From source file:com.projity.pm.graphic.chart.ChartLegend.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  ww. ja v  a  2 s  . c o m
    FormLayout layout = new FormLayout("p:grow, 3dlu,100dlu:grow,5dlu, default, 5dlu", // cols //$NON-NLS-1$
            "p, 3dlu, p, 3dlu, p, 3dlu, " + (simple ? "" : "fill:") + "p:grow, 5dlu"); // 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.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    CellConstraints cc = new CellConstraints();

    builder.addLabel(Messages.getString("ChartLegend.ResourceFilter"), cc.xy(1, 1)); //$NON-NLS-1$
    builder.add(filterComboBox, cc.xy(3, 1));
    builder.add(treeScrollPane, cc.xywh(1, 3, 3, 5));
    builder.add(tracesScrollPane, cc.xy(5, 7));
    if (simple) {
        builder.add(selectedOnTop, cc.xy(5, 1));
    } else {
        builder.add(cumulative, cc.xy(5, 1));
        builder.add(histogram, cc.xy(5, 3));
        builder.add(workCostRadioPanel(), cc.xy(5, 5));
    }
    return builder.getPanel();
}

From source file:com.projity.pm.graphic.network.rendering.FormComponent.java

License:Common Public License

public void init(BarFormat format) {
    if (format == null)
        return;// w w  w . ja  v  a 2 s.com
    FormFormat form = format.getForm();
    if (form == null)
        return;
    List boxes = form.getBoxes();
    if (boxes == null || boxes.size() == 0) {
        return;
    }
    FormBoxLayout formBoxLayout = form.getLayout(zoom);
    FormLayout layout = new FormLayout(formBoxLayout.getColumnGrid(), formBoxLayout.getRowGrid());
    DefaultFormBuilder builder = new DefaultFormBuilder(this, layout);
    if (formBoxLayout.getBorder() == null)
        builder.setDefaultDialogBorder();
    else
        builder.setBorder(Borders.createEmptyBorder(formBoxLayout.getBorder()));
    CellConstraints cc = new CellConstraints();
    for (Iterator i = boxes.iterator(); i.hasNext();) {
        FormBox box = (FormBox) i.next();
        if (zoom < box.getMinZoom())
            return;
        JComponent component;
        if (box.getFieldId() == null)
            component = new JLabel(Messages.getString(box.getTextId()));
        else {
            if (editor && !box.getField().isReadOnly()) {
                component = new ChangeAwareTextField();
                component.setBorder(null);
                //component.setOpaque(false);
            } else
                component = new JLabel();

            //if (box.getRow()==1&&!editor) ((JLabel)component).setHorizontalAlignment(SwingConstants.CENTER);
            //bug workaround, not possible to center with classic method when rowSpan>1

            fieldComponents.put(box.getFieldId(), component);
        }
        Font font = formBoxLayout.getFont(box.getFont());
        if (font != null)
            component.setFont(font);
        builder.add(component,
                (box.getAlignment() == null)
                        ? cc.xywh(box.getColumn(), box.getRow(), box.getColumnSpan(), box.getRowSpan())
                        : cc.xywh(box.getColumn(), box.getRow(), box.getColumnSpan(), box.getRowSpan(),
                                box.getAlignment()));
    }
}

From source file:com.projity.pm.graphic.TabbedNavigation.java

License:Common Public License

public JComponent createContentPanel(MenuManager menuManager, JToolBar toolbar, int group, int tabPlacement,
        boolean addFilterButtons) {
    this.menuManager = menuManager;
    menuManager.add(this);
    boolean top = (tabPlacement == JTabbedPane.TOP);
    int height = top ? 45 : 15;
    FormLayout layout = new FormLayout("p:grow", "fill:" + height + "dlu:grow");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    CellConstraints cc = new CellConstraints();
    builder.setBorder(BorderFactory.createEmptyBorder());
    tabbedPane = new ExtTabbedPane();
    tabbedPane.setTabPlacement(tabPlacement);
    int tabCount = 0;
    int groupCount = 0;
    for (int i = 0; i < toolbar.getComponentCount(); i++) {
        Object obj = toolbar.getComponent(i);
        if (obj instanceof JToolbarSeparator)
            groupCount++;//from   w w w  . jav  a2  s  .  c o m
        if (!(obj instanceof AbstractButton))
            continue;
        if (group != -1 && group != groupCount)
            continue;
        AbstractButton b = (AbstractButton) obj;
        Action action = b.getAction();
        if (action == menuManager.getActionFromId(ACTION_TRACKING_GANTT))
            continue;
        if (action == menuManager.getActionFromId(ACTION_PROJECTS))
            continue;
        JComponent component;
        if (top)
            component = createSubPanel(action, addFilterButtons);
        else
            component = dummy();
        component.setBorder(BorderFactory.createEmptyBorder());
        if (Environment.isNewLook() && !Environment.isNewLaf())
            component.setOpaque(false);
        String text = HyperLinkToolTip.extractTip(b.getToolTipText());
        tabbedPane.addTab(text, component);
        if (action == menuManager.getActionFromId(ACTION_RESOURCES))
            this.resourceTabCount = tabCount;
        tabbedPane.setToolTipTextAt(tabCount, text); // don't use version with F1
        actions.add(action);
        tabCount++;
    }
    builder.add(tabbedPane);
    JComponent c = builder.getPanel();
    c.setBorder(BorderFactory.createEmptyBorder());

    return c;
}