Search in sources :

Example 1 with Spacer

use of com.intellij.uiDesigner.core.Spacer in project android by JetBrains.

the class TemplateParameterStep2 method addParameterComponents.

private int addParameterComponents(final int rowCount, final Set<Parameter> parameters) {
    CellLocation location = new CellLocation();
    myTemplateParameters.removeAll();
    GridLayoutManager layout = new GridLayoutManager(rowCount + 1, COLUMN_COUNT);
    layout.setSameSizeHorizontally(false);
    myTemplateParameters.setLayout(layout);
    for (final Parameter parameter : parameters) {
        addComponents(parameter, location);
    }
    if (location.column > 0) {
        //add spacers before moving to the next row.
        if (location.column < COLUMN_COUNT) {
            addComponent(myTemplateParameters, new Spacer(), location.row, location.column, true);
        }
        location.row++;
    }
    return location.row;
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) Spacer(com.intellij.uiDesigner.core.Spacer)

Example 2 with Spacer

use of com.intellij.uiDesigner.core.Spacer in project android by JetBrains.

the class TemplateParameterStep2 method addComponent.

private static int addComponent(JComponent parent, JComponent component, int row, int column, boolean isLast) {
    GridConstraints gridConstraints = new GridConstraints();
    gridConstraints.setRow(row);
    gridConstraints.setColumn(column);
    boolean isGreedyComponent = component instanceof JTextField || component instanceof Spacer || component instanceof LabelWithEditLink || component instanceof TextAccessor || component instanceof EditorComboBox;
    int columnSpan = (isLast && isGreedyComponent) ? COLUMN_COUNT - column : 1;
    gridConstraints.setColSpan(columnSpan);
    gridConstraints.setAnchor(GridConstraints.ALIGN_LEFT);
    gridConstraints.setHSizePolicy(isGreedyComponent ? GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW : GridConstraints.SIZEPOLICY_CAN_SHRINK);
    gridConstraints.setVSizePolicy(component instanceof Spacer ? GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW : GridConstraints.SIZEPOLICY_FIXED);
    gridConstraints.setFill(GridConstraints.FILL_HORIZONTAL);
    parent.add(component, gridConstraints);
    if (isLast && !isGreedyComponent && column < COLUMN_COUNT - 1) {
        addComponent(parent, new Spacer(), row, column + 1, true);
    }
    return columnSpan;
}
Also used : LabelWithEditLink(com.android.tools.adtui.LabelWithEditLink) GridConstraints(com.intellij.uiDesigner.core.GridConstraints) Spacer(com.intellij.uiDesigner.core.Spacer)

Example 3 with Spacer

use of com.intellij.uiDesigner.core.Spacer in project android by JetBrains.

the class TemplateParameterStep2 method addComponents.

private void addComponents(Parameter parameter, CellLocation location) {
    List<JComponent> keyComponents = createComponents(parameter);
    // If a group of components take a full row, we ensure we are on
    // a fresh row at the start, and also ensure we end on a new row
    // for the next component.
    // We only group components together on the same row if both
    // component sets indicate they allow it.
    // Right now, our indication for requiring a full row is simply
    // if the # of components is > 1.  Only checkbox is allowed to
    // share a row.
    boolean isFullRow = keyComponents.size() > 1;
    // or if there isn't enough space.
    if ((isFullRow && location.column > 0) || location.column + keyComponents.size() > COLUMN_COUNT) {
        // Add spacers before moving to the next row.
        if (location.column < COLUMN_COUNT) {
            addComponent(myTemplateParameters, new Spacer(), location.row, location.column, true);
        }
        location.column = 0;
        location.row++;
    }
    // For any component that didn't return a label (checkbox for now), we manually add a null label here to keep the layout the same.
    if (location.column == 0 && keyComponents.size() == 1 && keyComponents.get(0) instanceof JCheckBox) {
        location.column += addComponent(myTemplateParameters, new JLabel(), location.row, location.column, false);
    }
    myParameterComponents.put(parameter, keyComponents);
    for (Iterator<JComponent> iterator = keyComponents.iterator(); iterator.hasNext(); ) {
        JComponent keyComponent = iterator.next();
        location.column += addComponent(myTemplateParameters, keyComponent, location.row, location.column, isFullRow && !iterator.hasNext());
        setControlDescription(keyComponent, parameter.help);
    }
    if (isFullRow) {
        location.row++;
        location.column = 0;
    }
}
Also used : Spacer(com.intellij.uiDesigner.core.Spacer)

Example 4 with Spacer

use of com.intellij.uiDesigner.core.Spacer in project ServiceStack.Java by ServiceStack.

the class AddRef method $$$setupUI$$$.

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    contentPane = new JPanel();
    contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
    contentPane.setMaximumSize(new Dimension(700, 420));
    contentPane.setMinimumSize(new Dimension(400, 220));
    contentPane.setOpaque(true);
    contentPane.setPreferredSize(new Dimension(550, 220));
    contentPane.setRequestFocusEnabled(true);
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    contentPane.add(panel1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false));
    panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    buttonOK = new JButton();
    buttonOK.setText("OK");
    panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    buttonCancel = new JButton();
    buttonCancel.setText("Cancel");
    panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel3.setFocusable(false);
    contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    errorTextPane = new JTextPane();
    errorTextPane.setEditable(false);
    errorTextPane.setFocusCycleRoot(false);
    errorTextPane.setFocusable(true);
    errorTextPane.setFont(new Font("Arial", errorTextPane.getFont().getStyle(), errorTextPane.getFont().getSize()));
    errorTextPane.setOpaque(false);
    errorTextPane.setVisible(false);
    panel3.add(errorTextPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(150, 25), null, 0, false));
    infoTextPane = new JTextPane();
    infoTextPane.setEditable(false);
    infoTextPane.setFocusCycleRoot(false);
    infoTextPane.setFocusable(false);
    infoTextPane.setFont(new Font("Arial", infoTextPane.getFont().getStyle(), infoTextPane.getFont().getSize()));
    infoTextPane.setOpaque(false);
    infoTextPane.setRequestFocusEnabled(false);
    infoTextPane.setText("To generate the DTO Service Model types for a specific ServiceStack instance, enter the base URI for the remote ServiceStack server and click OK.");
    panel3.add(infoTextPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(150, 25), null, 0, false));
    final JPanel panel4 = new JPanel();
    panel4.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPane.add(panel4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setText("Address Url");
    panel4.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    addressUrlTextField = new JTextField();
    addressUrlTextField.setToolTipText("eg, http://example.com/");
    panel4.add(addressUrlTextField, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setText("Package");
    panel4.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    packageBrowse = new TextFieldWithBrowseButton();
    panel4.add(packageBrowse, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("Name");
    panel4.add(label3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    nameTextField = new JTextField();
    nameTextField.setText("dtos.java");
    panel4.add(nameTextField, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    label1.setLabelFor(addressUrlTextField);
    label3.setLabelFor(nameTextField);
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) GridConstraints(com.intellij.uiDesigner.core.GridConstraints) Spacer(com.intellij.uiDesigner.core.Spacer)

Example 5 with Spacer

use of com.intellij.uiDesigner.core.Spacer in project ServiceStack.Java by ServiceStack.

the class AddTypeScriptRef method $$$setupUI$$$.

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    contentPane = new JPanel();
    contentPane.setLayout(new GridLayoutManager(4, 1, new Insets(10, 10, 10, 10), -1, -1));
    contentPane.setMaximumSize(new Dimension(700, 420));
    contentPane.setMinimumSize(new Dimension(400, 220));
    contentPane.setPreferredSize(new Dimension(550, 220));
    contentPane.setRequestFocusEnabled(false);
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPane.add(panel1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false));
    panel1.add(panel2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    buttonOK = new JButton();
    buttonOK.setText("OK");
    panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    buttonCancel = new JButton();
    buttonCancel.setText("Cancel");
    panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    onlyTypeScriptDefinitionsCheckBox = new JCheckBox();
    onlyTypeScriptDefinitionsCheckBox.setSelected(false);
    onlyTypeScriptDefinitionsCheckBox.setText("Only TypeScript definitions");
    panel1.add(onlyTypeScriptDefinitionsCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPane.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setText("Address Url");
    panel3.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    addressUrlTextField = new JTextField();
    addressUrlTextField.setToolTipText("eg, http://example.com/");
    panel3.add(addressUrlTextField, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setText("Name");
    panel3.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    nameTextField = new JTextField();
    nameTextField.setText("");
    panel3.add(nameTextField, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JPanel panel4 = new JPanel();
    panel4.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel4.setFocusable(false);
    contentPane.add(panel4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    infoTextPane = new JTextPane();
    infoTextPane.setEditable(false);
    infoTextPane.setFocusCycleRoot(false);
    infoTextPane.setFocusable(false);
    infoTextPane.setFont(new Font("Arial", infoTextPane.getFont().getStyle(), infoTextPane.getFont().getSize()));
    infoTextPane.setOpaque(false);
    infoTextPane.setRequestFocusEnabled(false);
    infoTextPane.setText("To generate the DTO Service Model types for a specific ServiceStack instance, enter the base URI for the remote ServiceStack server and click OK.");
    panel4.add(infoTextPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(150, 25), null, 0, false));
    errorTextPane = new JTextPane();
    errorTextPane.setEditable(false);
    errorTextPane.setFocusCycleRoot(false);
    errorTextPane.setFocusable(true);
    errorTextPane.setFont(new Font("Arial", errorTextPane.getFont().getStyle(), errorTextPane.getFont().getSize()));
    errorTextPane.setOpaque(false);
    errorTextPane.setVisible(false);
    panel4.add(errorTextPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(150, 25), null, 0, false));
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) GridConstraints(com.intellij.uiDesigner.core.GridConstraints) Spacer(com.intellij.uiDesigner.core.Spacer)

Aggregations

Spacer (com.intellij.uiDesigner.core.Spacer)15 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)13 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)12 Insets (java.awt.Insets)3 JPanel (javax.swing.JPanel)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 HideableDecorator (com.intellij.ui.HideableDecorator)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 LabelWithEditLink (com.android.tools.adtui.LabelWithEditLink)1 NlProperty (com.android.tools.idea.uibuilder.property.NlProperty)1 SearchableOptionsHelper (com.google.idea.blaze.base.settings.SearchableOptionsHelper)1 Module (com.intellij.openapi.module.Module)1 CompositeConfigurable (com.intellij.openapi.options.CompositeConfigurable)1 Configurable (com.intellij.openapi.options.Configurable)1 UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)1 LabeledComponent (com.intellij.openapi.ui.LabeledComponent)1 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)1 JBLabel (com.intellij.ui.components.JBLabel)1 BorderLayout (java.awt.BorderLayout)1