Search in sources :

Example 6 with RadContainer

use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.

the class I18nFormInspection method checkStringDescriptor.

@Override
protected void checkStringDescriptor(final Module module, final IComponent component, final IProperty prop, final StringDescriptor descriptor, final FormErrorCollector collector) {
    if (isHardCodedStringDescriptor(descriptor)) {
        if (isPropertyDescriptor(prop)) {
            if (isSetterNonNls(module.getProject(), GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module), component.getComponentClassName(), prop.getName())) {
                return;
            }
        }
        EditorQuickFixProvider provider;
        if (prop.getName().equals(BorderProperty.NAME)) {
            provider = new EditorQuickFixProvider() {

                @Override
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                    return new I18nizeFormBorderQuickFix(editor, UIDesignerBundle.message("i18n.quickfix.border.title"), (RadContainer) component);
                }
            };
        } else if (prop.getName().equals(ITabbedPane.TAB_TITLE_PROPERTY) || prop.getName().equals(ITabbedPane.TAB_TOOLTIP_PROPERTY)) {
            provider = new EditorQuickFixProvider() {

                @Override
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                    return new I18nizeTabTitleQuickFix(editor, UIDesignerBundle.message("i18n.quickfix.tab.title", prop.getName()), component, prop.getName());
                }
            };
        } else {
            provider = new EditorQuickFixProvider() {

                @Override
                public QuickFix createQuickFix(GuiEditor editor, RadComponent component) {
                    return new I18nizeFormPropertyQuickFix(editor, UIDesignerBundle.message("i18n.quickfix.property", prop.getName()), component, (IntrospectedProperty) prop);
                }
            };
        }
        collector.addError(getID(), component, prop, UIDesignerBundle.message("inspection.i18n.message.in.form", descriptor.getValue()), provider);
    }
}
Also used : QuickFix(com.intellij.uiDesigner.quickFixes.QuickFix) EditorQuickFixProvider(com.intellij.uiDesigner.inspections.EditorQuickFixProvider) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Example 7 with RadContainer

use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.

the class GridChangeUtilTest method test_split.

public void test_split() throws Exception {
    final RadContainer grid = SampleGrid.create();
    GridChangeUtil.splitColumn(grid, 1);
    assertGridDimensions(grid, SampleGrid.ORIGINAL_ROWS, SampleGrid.ORIGINAL_COLUMNS + 1);
    assertComponentCellAndSpan(grid, 0, 0, 4);
    assertComponentCellAndSpan(grid, 1, 1, 4);
    assertComponentCellAndSpan(grid, 2, 0, 5);
    assertComponentCellAndSpan(grid, 3, 1, 2);
    assertComponentCellAndSpan(grid, 4, 3, 3);
    assertComponentCellAndSpan(grid, 5, 0, 1);
}
Also used : RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Example 8 with RadContainer

use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.

the class GridChangeUtilTest method createGrid.

private static RadContainer createGrid(final int rowCount, final int columnCount, final Insets margin, final int hGap, final int vGap) {
    final RadContainer container = new RadContainer(null, "grid");
    container.setLayout(new GridLayoutManager(rowCount, columnCount, margin, hGap, vGap));
    return container;
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Example 9 with RadContainer

use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.

the class GridChangeUtilTest method test_insert_last.

public void test_insert_last() throws Exception {
    final RadContainer grid = SampleGrid.create();
    GridChangeUtil.insertRowOrColumn(grid, SampleGrid.ORIGINAL_COLUMNS - 1, false, false);
    assertGridDimensions(grid, SampleGrid.ORIGINAL_ROWS, SampleGrid.ORIGINAL_COLUMNS + 1);
    // no component should change its cell or span
    assertComponentCellAndSpan(grid, 0, SampleGrid.C0, SampleGrid.S0);
    assertComponentCellAndSpan(grid, 1, SampleGrid.C1, SampleGrid.S1);
    assertComponentCellAndSpan(grid, 2, SampleGrid.C2, SampleGrid.S2);
    assertComponentCellAndSpan(grid, 3, SampleGrid.C3, SampleGrid.S3);
    assertComponentCellAndSpan(grid, 4, SampleGrid.C4, SampleGrid.S4);
    assertComponentCellAndSpan(grid, 5, SampleGrid.C5, SampleGrid.S5);
}
Also used : RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Example 10 with RadContainer

use of com.intellij.uiDesigner.radComponents.RadContainer in project intellij-community by JetBrains.

the class GridChangeUtilTest method testMoveRowDown.

public void testMoveRowDown() throws Exception {
    final RadContainer grid = SampleGrid.create();
    GridChangeUtil.moveCells(grid, true, new int[] { 3 }, 6);
    assertEquals(5, grid.getComponent(3).getConstraints().getRow());
    assertEquals(3, grid.getComponent(4).getConstraints().getRow());
    assertEquals(4, grid.getComponent(5).getConstraints().getRow());
}
Also used : RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Aggregations

RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)51 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)20 RadRootContainer (com.intellij.uiDesigner.radComponents.RadRootContainer)6 ArrayList (java.util.ArrayList)6 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)5 FormEditingUtil (com.intellij.uiDesigner.FormEditingUtil)3 IComponent (com.intellij.uiDesigner.lw.IComponent)3 ComponentTreeBuilder (com.intellij.uiDesigner.componentTree.ComponentTreeBuilder)2 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)2 GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)2 IProperty (com.intellij.uiDesigner.lw.IProperty)2 IncorrectOperationException (com.intellij.util.IncorrectOperationException)2 LayoutManager (java.awt.LayoutManager)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 Ref (com.intellij.openapi.util.Ref)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 SelectionState (com.intellij.uiDesigner.SelectionState)1 ComponentPtr (com.intellij.uiDesigner.componentTree.ComponentPtr)1 ComponentTree (com.intellij.uiDesigner.componentTree.ComponentTree)1