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:eu.europa.ec.markt.dss.applet.view.validation.ReportView.java

License:Open Source License

private JPanel getSimpleReportText() {
    final String[] columnSpecs = new String[] { "5dlu", "fill:default:grow", "5dlu" };
    final String[] rowSpecs = new String[] { "5dlu", "pref", "5dlu", "fill:default:grow", "5dlu" };
    final PanelBuilder builder = ComponentFactory.createBuilder(columnSpecs, rowSpecs);
    final CellConstraints cc = new CellConstraints();

    builder.addSeparator("Detailed Report XML", cc.xyw(2, 2, 1));
    builder.add(ComponentFactory.createScrollPane(simpleReportText), cc.xyw(2, 4, 1));

    return ComponentFactory.createPanel(builder);
}

From source file:eu.europa.ec.markt.dss.applet.view.validation.ReportView.java

License:Open Source License

private JPanel getDetailedReportText() {
    final String[] columnSpecs = new String[] { "5dlu", "fill:default:grow", "5dlu" };
    final String[] rowSpecs = new String[] { "5dlu", "pref", "5dlu", "fill:default:grow", "5dlu" };
    final PanelBuilder builder = ComponentFactory.createBuilder(columnSpecs, rowSpecs);
    final CellConstraints cc = new CellConstraints();

    builder.addSeparator("Detailed Report XML", cc.xyw(2, 2, 1));
    builder.add(ComponentFactory.createScrollPane(detailedReportText), cc.xyw(2, 4, 1));

    return ComponentFactory.createPanel(builder);
}

From source file:eu.europa.ec.markt.dss.applet.view.validation.ValidationView.java

License:Open Source License

@Override
protected Container doLayout() {
    final FormLayout layout = new FormLayout("5dlu, pref, 5dlu, pref, 5dlu, pref:grow, 5dlu",
            "5dlu, p, 5dlu, pref, 5dlu, p, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu");

    final CellConstraints cc = new CellConstraints();
    final PanelBuilder builder = ComponentFactory.createBuilder(layout);
    int row = 2;/* ww w.j a v a 2 s  .  c om*/
    builder.addSeparator(I18N_SIGNED_FILE_TO_VALIDATE, cc.xyw(2, 2, 6));
    builder.add(selectFileA, cc.xy(2, row = row + 2));
    builder.add(fileA, cc.xyw(4, row, 4));
    builder.addSeparator(I18N_ORIGINAL_FILE, cc.xyw(2, row = row + 2, 6));
    builder.add(selectFileB, cc.xy(2, row = row + 2));
    builder.add(fileB, cc.xyw(4, row, 4));
    builder.add(clear, cc.xy(2, row = row + 2));
    if (DISPLAY_LEGACY_VALIDATION) {
        builder.addSeparator(I18N_VALIDATION_TYPE, cc.xyw(2, row = row + 2, 6));
        builder.add(validationLegacy, cc.xyw(2, row = row + 2, 6));
        builder.add(validation102853, cc.xyw(2, row = row + 2, 6));
    }

    validationTypeSeparator = builder.addSeparator(ValidationView.I18N_VALIDATION_102853_TYPE,
            cc.xyw(2, row = row + 2, 6));
    builder.add(defaultValidation, cc.xyw(2, row = row + 2, 6));
    builder.add(customValidation, cc.xyw(2, row = row + 2, 6));
    builder.add(selectFilePolicy, cc.xy(2, row = row + 2));
    builder.add(filePolicyLabel, cc.xyw(4, row, 3));

    displayOrHideValidation();

    return ComponentFactory.createPanel(builder);

}

From source file:eu.europa.ec.markt.dss.applet.view.validationpolicy.FileView.java

License:Open Source License

@Override
protected Container doLayout() {
    final FormLayout layout = new FormLayout("5dlu, pref, 5dlu, pref, 5dlu ,pref:grow ,5dlu",
            "5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu");
    final PanelBuilder builder = ComponentFactory.createBuilder(layout);
    final CellConstraints cc = new CellConstraints();

    builder.add(editDefaultPolicy, cc.xyw(2, 2, 5));
    builder.add(chooseFilePolicy, cc.xyw(2, 4, 5));

    int columnOffset = 4;
    builder.addSeparator(I18N_FILE_TO_EDIT, cc.xyw(2, columnOffset + 2, 5));
    builder.add(selectFileSource, cc.xy(2, columnOffset + 4));
    builder.add(fileSourceLabel, cc.xyw(4, columnOffset + 4, 3));
    return ComponentFactory.createPanel(builder);
}

From source file:eu.europa.ec.markt.dss.applet.view.validationpolicy.SaveView.java

License:Open Source License

@Override
protected Container doLayout() {
    final FormLayout layout = new FormLayout(
            "5dlu, pref, 5dlu, pref, 5dlu ,pref:grow ,5dlu, fill:default:grow, 5dlu",
            "5dlu, pref, 5dlu, pref, 5dlu, fill:default:grow, 5dlu");
    final PanelBuilder builder = ComponentFactory.createBuilder(layout);
    final CellConstraints cc = new CellConstraints();

    builder.addSeparator(I18N_SAVE_TO_FILE, cc.xyw(2, 2, 5));
    builder.add(selectFileTarget, cc.xy(2, 4));
    builder.add(fileTargetLabel, cc.xyw(4, 4, 3));
    builder.add(scrollPane, cc.xywh(2, 5, 8, 3));
    return ComponentFactory.createPanel(builder);
}

From source file:eu.europa.esig.dss.applet.view.signature.PersonalDataView.java

License:Open Source License

@Override
protected Container doLayout() {

    final FormLayout layout = new FormLayout("5dlu, pref, 5dlu, pref:grow, 5dlu",
            "5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu");
    final PanelBuilder builder = ComponentFactory.createBuilder(layout);
    final CellConstraints cc = new CellConstraints();

    builder.addSeparator("Additional data for signature meta-data", cc.xyw(2, 2, 3));
    builder.add(claimedCheckBox, cc.xy(2, 4));
    builder.add(claimedRoleInput, cc.xy(4, 4));
    builder.add(policyCheckBox, cc.xy(2, 8));
    builder.add(doExplicitLayout(), cc.xy(4, 8));

    return ComponentFactory.createPanel(builder);
}

From source file:feedsplugin.FeedsSettingsTab.java

License:Open Source License

public JPanel createSettingsPanel() {
    final EnhancedPanelBuilder panelBuilder = new EnhancedPanelBuilder(
            FormFactory.RELATED_GAP_COLSPEC.encode() + ", fill:default:grow");
    final CellConstraints cc = new CellConstraints();

    mListModel = new DefaultListModel();
    for (String feed : mSettings.getFeeds()) {
        mListModel.addElement(feed);//from  w w  w . j a  v a 2  s.com
    }
    mFeeds = new JList(mListModel);
    mFeeds.setSelectedIndex(0);
    mFeeds.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    mFeeds.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(final ListSelectionEvent e) {
            listSelectionChanged();
        }
    });

    panelBuilder.addGrowingRow();
    panelBuilder.add(new JScrollPane(mFeeds),
            cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1));

    mAdd = new JButton(mLocalizer.msg("add", "Add feed"));
    mAdd.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            String genre = JOptionPane.showInputDialog(mLocalizer.msg("addMessage", "Add feed URL"), "");
            if (genre != null) {
                genre = genre.trim();
                if (genre.length() > 0) {
                    mListModel.addElement(genre);
                }
            }
        }
    });

    mRemove = new JButton(mLocalizer.msg("remove", "Remove feed"));
    mRemove.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            final int index = mFeeds.getSelectedIndex();
            if (index >= 0) {
                mListModel.remove(index);
            }
        }
    });

    panelBuilder.addRow();
    ButtonBarBuilder2 buttonBar = new ButtonBarBuilder2();
    buttonBar.addButton(new JButton[] { mAdd, mRemove });
    panelBuilder.add(buttonBar.getPanel(), cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1));

    mFeeds.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(final ListSelectionEvent e) {
            mRemove.setEnabled(mFeeds.getSelectedIndex() >= 0);
        }
    });

    panelBuilder.addParagraph(mLocalizer.msg("moreFeeds", "Get more feeds"));
    panelBuilder.addRow();
    JEditorPane help = UiUtilities.createHtmlHelpTextArea(mLocalizer.msg("help",
            "You can find more news feeds on the <a href=\"{0}\">plugin help page</a>. If you know more interesting feeds, feel free to add them on that page.",
            StringUtils.replace(PluginInfo.getHelpUrl(FeedsPlugin.getInstance().getId()), "&", "&amp;")));
    panelBuilder.add(help, cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1));

    // force update of enabled states
    listSelectionChanged();

    return panelBuilder.getPanel();
}

From source file:fi.smaa.jsmaa.gui.components.ValueFunctionPointsPanel.java

License:Open Source License

private void rebuild() {
    removeAll();/*from  ww w  .  jav a2 s .  c  o m*/
    FormLayout layout = new FormLayout("left:pref:grow", "p, 3dlu, p, 3dlu, p, 3dlu, p");

    PanelBuilder builder = new PanelBuilder(layout, this);
    CellConstraints cc = new CellConstraints();

    int yIndex = 1;
    DecimalFormat df = new DecimalFormat("0.00");
    DecimalFormat df2 = new DecimalFormat("0.##");
    int ptIndex = 1;
    for (final Point2D pt : crit.getValuePoints()) {
        LayoutUtil.addColumn(layout, "center:pref");
        yIndex += 2;
        builder.addLabel(df2.format(pt.getX()), cc.xy(yIndex, 3));
        builder.addLabel(df.format(pt.getY()), cc.xy(yIndex, 5));
        if (ptIndex > 1 && ptIndex < crit.getValuePoints().size()) {
            JButton delButton = new JButton("x");
            builder.add(delButton, cc.xy(yIndex, 7));
            delButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent ev) {
                    crit.deleteValuePoint(pt);
                }
            });
        }
        ptIndex += 1;
    }

    builder.addLabel("Function defined as", cc.xyw(1, 1, crit.getValuePoints().size() * 2 + 1));
    builder.addLabel("x", cc.xy(1, 3));
    builder.addLabel("v(x)", cc.xy(1, 5));
    builder.addLabel("Del", cc.xy(1, 7));

    revalidate();
    repaint();
}

From source file:fi.smaa.jsmaa.gui.views.AlternativeView.java

License:Open Source License

public JComponent buildPanel() {

    FormLayout layout = new FormLayout("pref, 3dlu, left:pref:grow", "p, 3dlu, p, 3dlu, p");

    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(BorderFactory.createEmptyBorder());
    CellConstraints cc = new CellConstraints();

    int fullwidth = 3;

    builder.addLabel("Name:", cc.xy(1, 1));
    builder.add(BasicComponentFactory.createLabel(
            new PresentationModel<Alternative>(alt).getModel(Alternative.PROPERTY_NAME)), cc.xy(3, 1));

    builder.addSeparator("Measurements", cc.xyw(1, 3, fullwidth));

    if (impactMatrix instanceof IndependentMeasurements) {
        builder.add(buildMeasurementsPart(), cc.xyw(1, 5, fullwidth));
    } else {// ww  w  . j a va  2s  .  c o m
        builder.add(new JLabel("Measurements are not independent."));
    }

    return builder.getPanel();
}

From source file:fi.smaa.jsmaa.gui.views.PreferenceInformationView.java

License:Open Source License

@SuppressWarnings("serial")
public JComponent buildPanel() {
    FormLayout layout = new FormLayout("right:pref, 3dlu, left:pref:grow", "p, 3dlu, p");

    int fullWidth = 3;

    ValueModel preferenceTypeModel = model.getModel(PreferencePresentationModel.PREFERENCE_TYPE);

    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(BorderFactory.createEmptyBorder());
    CellConstraints cc = new CellConstraints();

    PreferenceType[] valueList = null;//from  w  w w  .ja v  a 2s .c om
    if (model.includesCardinalPreferences()) {
        valueList = PreferenceType.values();
    } else {
        valueList = new PreferenceType[] { PreferenceType.MISSING, PreferenceType.ORDINAL };
    }
    SelectionInList<PreferenceType> typeSelInList = new SelectionInList<PreferenceType>(valueList,
            preferenceTypeModel);

    JComboBox preferenceTypeBox = BasicComponentFactory.createComboBox(typeSelInList);
    builder.add(preferenceTypeBox, cc.xy(1, 1));

    builder.addLabel("Preference information", cc.xyw(3, 1, fullWidth - 2));

    prefPanel = null;
    if (model.getPreferenceType() == PreferenceType.ORDINAL) {
        SMAAModel smodel = model.getBean();
        OrdinalPreferencesView oview = new OrdinalPreferencesView(
                (OrdinalPreferenceInformation) smodel.getPreferenceInformation());
        oview.setScaleRenderer(renderer);
        prefPanel = oview.buildPanel();
    } else if (model.getPreferenceType() == PreferenceType.CARDINAL) {
        CardinalPreferencesView oview = new CardinalPreferencesView(
                (CardinalPreferenceInformation) model.getBean().getPreferenceInformation());
        oview.setScaleRenderer(renderer);
        prefPanel = oview.buildPanel();
    }
    if (prefPanel != null) {
        builder.add(prefPanel, cc.xyw(1, 3, fullWidth));
    }

    preferenceTypeBox.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (prefPanel != null) {
                prefPanel.requestFocusInWindow();
            }
        }
    });

    return builder.getPanel();
}