Search in sources :

Example 66 with GridConstraints

use of com.intellij.uiDesigner.core.GridConstraints in project intellij-community by JetBrains.

the class RadFormLayoutManager method updateGridConstraintsFromCellConstraints.

private static void updateGridConstraintsFromCellConstraints(RadContainer grid) {
    FormLayout layout = (FormLayout) grid.getLayout();
    for (RadComponent c : grid.getComponents()) {
        CellConstraints cc = layout.getConstraints(c.getDelegee());
        GridConstraints gc = c.getConstraints();
        copyCellToGridConstraints(gc, cc);
    }
}
Also used : GridConstraints(com.intellij.uiDesigner.core.GridConstraints)

Example 67 with GridConstraints

use of com.intellij.uiDesigner.core.GridConstraints in project intellij-community by JetBrains.

the class RadGridLayoutManager method processCellResized.

public void processCellResized(RadContainer container, final boolean isRow, final int cell, final int newSize) {
    int cellCount = isRow ? container.getGridRowCount() : container.getGridColumnCount();
    if (container.getParent().isXY() && cell == cellCount - 1) {
        processRootContainerResize(container, isRow, newSize);
    } else {
        for (RadComponent component : container.getComponents()) {
            GridConstraints c = component.getConstraints();
            if (c.getCell(isRow) == cell && c.getSpan(isRow) == 1) {
                Dimension preferredSize = new Dimension(c.myPreferredSize);
                if (isRow) {
                    preferredSize.height = newSize;
                    if (preferredSize.width == -1) {
                        preferredSize.width = component.getDelegee().getPreferredSize().width;
                    }
                } else {
                    preferredSize.width = newSize;
                    if (preferredSize.height == -1) {
                        preferredSize.height = component.getDelegee().getPreferredSize().height;
                    }
                }
                PreferredSizeProperty.getInstance(container.getProject()).setValueEx(component, preferredSize);
            }
        }
    }
}
Also used : GridConstraints(com.intellij.uiDesigner.core.GridConstraints)

Example 68 with GridConstraints

use of com.intellij.uiDesigner.core.GridConstraints in project intellij-community by JetBrains.

the class CachedGridImage method repaint.

private void repaint(final RadContainer container) {
    final int width = container.getWidth();
    final int height = container.getHeight();
    if (width * height >= 4096 * 4096)
        return;
    Graphics2D g2d = (Graphics2D) myImage.getGraphics();
    try {
        g2d.setComposite(AlphaComposite.Clear);
        g2d.fillRect(0, 0, width, height);
        g2d.setComposite(AlphaComposite.Src);
        if (container.isSelected()) {
            g2d.setColor(Painter.SELECTED_GRID_COLOR);
        } else {
            g2d.setColor(Painter.NON_SELECTED_GRID_COLOR);
        }
        g2d.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, ourDashes, 0.0f));
        if (myHorzGridLines.length > 0) {
            int lastLine = (container.getDelegee().getHeight() - myHorzGridLines[myHorzGridLines.length - 1] > 4) ? myHorzGridLines.length : myHorzGridLines.length - 1;
            for (int i = 1; i < lastLine; i++) {
                final int y = myHorzGridLines[i];
                g2d.drawLine(0, y, width, y);
            }
        }
        if (myVertGridLines.length > 0) {
            // Vertical lines
            int lastLine = (container.getDelegee().getWidth() - myVertGridLines[myVertGridLines.length - 1] > 4) ? myVertGridLines.length : myVertGridLines.length - 1;
            for (int i = 1; i < lastLine; i++) {
                final int x = myVertGridLines[i];
                g2d.drawLine(x, 0, x, height);
            }
        }
        g2d.setComposite(AlphaComposite.Clear);
        g2d.setStroke(new BasicStroke(1.0f));
        for (RadComponent childComponent : container.getComponents()) {
            final GridConstraints constraints = childComponent.getConstraints();
            if (constraints.getColSpan() > 1) {
                for (int col = constraints.getColumn() + 1; col < constraints.getColumn() + constraints.getColSpan(); col++) {
                    drawVertGridLine(g2d, col, constraints.getRow(), constraints.getRowSpan());
                }
            }
            if (constraints.getRowSpan() > 1) {
                for (int row = constraints.getRow() + 1; row < constraints.getRow() + constraints.getRowSpan(); row++) {
                    drawHorzGridLine(g2d, row, constraints.getColumn(), constraints.getColSpan());
                }
            }
        }
    } finally {
        g2d.dispose();
    }
}
Also used : GridConstraints(com.intellij.uiDesigner.core.GridConstraints) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent)

Example 69 with GridConstraints

use of com.intellij.uiDesigner.core.GridConstraints in project intellij-community by JetBrains.

the class CachedGridImage method update.

private void update(final RadContainer container) {
    if (container.getWidth() * container.getHeight() >= 4096 * 4096)
        return;
    int count = container.getComponentCount();
    int[] rows = new int[count];
    int[] rowSpans = new int[count];
    int[] cols = new int[count];
    int[] colSpans = new int[count];
    for (int i = 0; i < count; i++) {
        GridConstraints c = container.getComponent(i).getConstraints();
        rows[i] = c.getRow();
        rowSpans[i] = c.getRowSpan();
        cols[i] = c.getColumn();
        colSpans[i] = c.getColSpan();
    }
    int[] horzGridLines = container.getGridLayoutManager().getHorizontalGridLines(container);
    int[] vertGridLines = container.getGridLayoutManager().getVerticalGridLines(container);
    if (!arraysEqual(horzGridLines, myHorzGridLines) || !arraysEqual(vertGridLines, myVertGridLines) || !arraysEqual(rows, myRows) || !arraysEqual(rowSpans, myRowSpans) || !arraysEqual(cols, myCols) || !arraysEqual(colSpans, myColSpans)) {
        myHorzGridLines = horzGridLines;
        myVertGridLines = vertGridLines;
        myRows = rows;
        myRowSpans = rowSpans;
        myCols = cols;
        myColSpans = colSpans;
        repaint(container);
    }
}
Also used : GridConstraints(com.intellij.uiDesigner.core.GridConstraints)

Example 70 with GridConstraints

use of com.intellij.uiDesigner.core.GridConstraints in project Main by SpartanRefactoring.

the class EditTipper 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$$$() {
    mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
    final JLabel label1 = new JLabel();
    label1.setFont(new Font(label1.getFont().getName(), label1.getFont().getStyle(), 28));
    label1.setText("Label");
    mainPanel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    tempPane = new JPanel();
    tempPane.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    mainPanel.add(tempPane, 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));
    TablePanel = new JScrollPane();
    tempPane.add(TablePanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    mainPanel.add(panel1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_SOUTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    applyButton = new JButton();
    applyButton.setText("Button");
    panel1.add(applyButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    closeButton = new JButton();
    closeButton.setText("Button");
    panel1.add(closeButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) GridConstraints(com.intellij.uiDesigner.core.GridConstraints)

Aggregations

GridConstraints (com.intellij.uiDesigner.core.GridConstraints)73 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)17 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)14 Spacer (com.intellij.uiDesigner.core.Spacer)6 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)5 ComponentItem (com.intellij.uiDesigner.palette.ComponentItem)3 CellConstraints (com.jgoodies.forms.layout.CellConstraints)3 ArrayList (java.util.ArrayList)3 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 JBLabel (com.intellij.ui.components.JBLabel)2 JBTextField (com.intellij.ui.components.JBTextField)2 GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)2 IComponent (com.intellij.uiDesigner.lw.IComponent)2 Palette (com.intellij.uiDesigner.palette.Palette)2 QuickFix (com.intellij.uiDesigner.quickFixes.QuickFix)2 RadAbstractGridLayoutManager (com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager)2 RadRootContainer (com.intellij.uiDesigner.radComponents.RadRootContainer)2 XYLayoutManager (com.intellij.uiDesigner.shared.XYLayoutManager)2 IncorrectOperationException (com.intellij.util.IncorrectOperationException)2 Element (org.jdom.Element)2