public void generateComponentLayout(final LwComponent component, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { GridBagConstraints gbc; if (component.getCustomLayoutConstraints() instanceof GridBagConstraints) { gbc = (GridBagConstraints) component.getCustomLayoutConstraints(); } else { gbc = new GridBagConstraints(); } GridBagConverter.constraintsToGridBag(component.getConstraints(), gbc); generateGridBagConstraints(generator, gbc, componentLocal, parentLocal); }
public boolean generateCustomSetValue(final LwComponent lwComponent, final InstrumentationClassFinder.PseudoClass componentClass, final LwIntrospectedProperty property, final GeneratorAdapter generator, final int componentLocal, final String formClassName) { FontDescriptor descriptor = (FontDescriptor) property.getPropertyValue(lwComponent); if (descriptor.isFixedFont() && !descriptor.isFullyDefinedFont()) { Label fontNullLabel = generator.newLabel(); generatePushFont(generator, componentLocal, lwComponent, descriptor, property.getReadMethodName(), fontNullLabel); Method setFontMethod = new Method(property.getWriteMethodName(), Type.VOID_TYPE, new Type[] { ourFontType } ); Type componentType = AsmCodeGenerator.typeFromClassName(lwComponent.getComponentClassName()); generator.invokeVirtual(componentType, setFontMethod); generator.mark(fontNullLabel); return true; } return false; }
public void generateComponentLayout(LwComponent lwComponent, GeneratorAdapter generator, int componentLocal, int parentLocal) { super.generateComponentLayout(lwComponent, generator, componentLocal, parentLocal); String defaultCard = (String)lwComponent.getParent().getClientProperty(UIFormXmlConstants.LAYOUT_CARD); if (lwComponent.getId().equals(defaultCard)) { generator.loadLocal(parentLocal); generator.invokeVirtual(ourContainerType, ourGetLayoutMethod); generator.checkCast(myLayoutType); generator.loadLocal(parentLocal); generator.push((String) lwComponent.getCustomLayoutConstraints()); generator.invokeVirtual(myLayoutType, ourShowMethod); } }
private static boolean hasBinding(final LwComponent component) { if (component.getBinding() != null) { return true; } if (component instanceof LwContainer) { final LwContainer container = (LwContainer)component; for (int i=0; i < container.getComponentCount(); i++) { if (hasBinding((LwComponent)container.getComponent(i))) { return true; } } } return false; }
public FormProperty( final @NotNull LwComponent component, final @NotNull @NonNls String componentPropertyGetterName, final @NotNull @NonNls String componentPropertySetterName, final @NotNull @NonNls String componentPropertyClassName ) { if( !String.class.getName().equals(componentPropertyClassName) && !int.class.getName().equals(componentPropertyClassName) && !float.class.getName().equals(componentPropertyClassName) && !double.class.getName().equals(componentPropertyClassName) && !long.class.getName().equals(componentPropertyClassName) && !boolean.class.getName().equals(componentPropertyClassName) && !char.class.getName().equals(componentPropertyClassName) && !byte.class.getName().equals(componentPropertyClassName) && !short.class.getName().equals(componentPropertyClassName) ){ throw new IllegalArgumentException("unknown componentPropertyClassName: " +componentPropertyClassName); } myLwComponent = component; myComponentPropertyGetterName = componentPropertyGetterName; myComponentPropertySetterName = componentPropertySetterName; myComponentPropertyClassName = componentPropertyClassName; }
@Override public void generateComponentLayout(final LwComponent component, final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { GridBagConstraints gbc; if (component.getCustomLayoutConstraints() instanceof GridBagConstraints) { gbc = (GridBagConstraints) component.getCustomLayoutConstraints(); } else { gbc = new GridBagConstraints(); } GridBagConverter.constraintsToGridBag(component.getConstraints(), gbc); generateGridBagConstraints(generator, gbc, variable, parentVariable); }
private static void addNewGridConstraints(final FormSourceCodeGenerator generator, final LwComponent component) { final GridConstraints constraints = component.getConstraints(); generator.startConstructor(GridConstraints.class.getName()); generator.push(constraints.getRow()); generator.push(constraints.getColumn()); generator.push(constraints.getRowSpan()); generator.push(constraints.getColSpan()); generator.push(constraints.getAnchor(), myAnchors); generator.push(constraints.getFill(), myFills); pushSizePolicy(generator, constraints.getHSizePolicy()); pushSizePolicy(generator, constraints.getVSizePolicy()); generator.newDimensionOrNull(constraints.myMinimumSize); generator.newDimensionOrNull(constraints.myPreferredSize); generator.newDimensionOrNull(constraints.myMaximumSize); generator.push(constraints.getIndent()); generator.push(constraints.isUseParentLayout()); generator.endConstructor(); }
public boolean generateCustomSetValue(final LwComponent lwComponent, final InstrumentationClassFinder.PseudoClass componentClass, final LwIntrospectedProperty property, final GeneratorAdapter generator, final int componentLocal, final String formClassName) { FontDescriptor descriptor = (FontDescriptor) property.getPropertyValue(lwComponent); if (descriptor.isFixedFont() && !descriptor.isFullyDefinedFont()) { generator.loadLocal(componentLocal); generatePushFont(generator, componentLocal, lwComponent, descriptor, property.getReadMethodName()); Method setFontMethod = new Method(property.getWriteMethodName(), Type.VOID_TYPE, new Type[] { ourFontType } ); Type componentType = AsmCodeGenerator.typeFromClassName(lwComponent.getComponentClassName()); generator.invokeVirtual(componentType, setFontMethod); return true; } return false; }
public static void setPreviewBindings(final LwRootContainer rootContainer, final String classToBindName) { // 1. Prepare form to preview. We have to change container so that it has only one binding. rootContainer.setClassToBind(classToBindName); FormEditingUtil.iterate( rootContainer, new FormEditingUtil.ComponentVisitor<LwComponent>() { public boolean visit(final LwComponent iComponent) { iComponent.setBinding(null); return true; } } ); if (rootContainer.getComponentCount() == 1) { //noinspection HardCodedStringLiteral ((LwComponent)rootContainer.getComponent(0)).setBinding(PREVIEW_BINDING_FIELD); } }
public void generateComponentLayout(final LwComponent lwComponent, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { generator.loadLocal(parentLocal); generator.loadLocal(componentLocal); generator.invokeVirtual(ourContainerType, ourAddNoConstraintMethod); }
public void generateComponentLayout(final LwComponent lwComponent, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { generator.loadLocal(parentLocal); generator.loadLocal(componentLocal); if (LwSplitPane.POSITION_LEFT.equals(lwComponent.getCustomLayoutConstraints())) { generator.invokeVirtual(mySplitPaneType, mySetLeftMethod); } else { generator.invokeVirtual(mySplitPaneType, mySetRightMethod); } }
public void generateComponentLayout(final LwComponent lwComponent, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { generator.loadLocal(parentLocal); generator.loadLocal(componentLocal); generator.push((String) lwComponent.getCustomLayoutConstraints()); generator.invokeVirtual(ourContainerType, ourAddMethod); }
public void generateComponentLayout(final LwComponent lwComponent, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { generator.loadLocal(parentLocal); final LwTabbedPane.Constraints tabConstraints = (LwTabbedPane.Constraints)lwComponent.getCustomLayoutConstraints(); if (tabConstraints == null){ throw new IllegalArgumentException("tab constraints cannot be null: " + lwComponent.getId()); } AsmCodeGenerator.pushPropValue(generator, String.class.getName(), tabConstraints.myTitle); if (tabConstraints.myIcon == null) { generator.push((String) null); } else { AsmCodeGenerator.pushPropValue(generator, Icon.class.getName(), tabConstraints.myIcon); } generator.loadLocal(componentLocal); if (tabConstraints.myToolTip == null) { generator.push((String) null); } else { AsmCodeGenerator.pushPropValue(generator, String.class.getName(), tabConstraints.myToolTip); } generator.invokeVirtual(myTabbedPaneType, myAddTabMethod); int index = lwComponent.getParent().indexOfComponent(lwComponent); if (tabConstraints.myDisabledIcon != null) { generator.loadLocal(parentLocal); generator.push(index); AsmCodeGenerator.pushPropValue(generator, Icon.class.getName(), tabConstraints.myDisabledIcon); generator.invokeVirtual(myTabbedPaneType, mySetDisabledIconAtMethod); } if (!tabConstraints.myEnabled) { generator.loadLocal(parentLocal); generator.push(index); generator.push(tabConstraints.myEnabled); generator.invokeVirtual(myTabbedPaneType, mySetEnabledAtMethod); } }
public void generateComponentLayout(final LwComponent lwComponent, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { generator.loadLocal(parentLocal); generator.loadLocal(componentLocal); generator.invokeVirtual(myScrollPaneType, mySetViewportViewMethod); }
public void generateComponentLayout(final LwComponent lwComponent, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { generator.loadLocal(parentLocal); generator.loadLocal(componentLocal); addNewGridConstraints(generator, lwComponent); generator.invokeVirtual(ourContainerType, ourAddMethod); }
private static void addNewGridConstraints(final GeneratorAdapter generator, final LwComponent lwComponent) { final GridConstraints constraints = lwComponent.getConstraints(); generator.newInstance(myGridConstraintsType); generator.dup(); generator.push(constraints.getRow()); generator.push(constraints.getColumn()); generator.push(constraints.getRowSpan()); generator.push(constraints.getColSpan()); generator.push(constraints.getAnchor()); generator.push(constraints.getFill()); generator.push(constraints.getHSizePolicy()); generator.push(constraints.getVSizePolicy()); newDimensionOrNull(generator, constraints.myMinimumSize); newDimensionOrNull(generator, constraints.myPreferredSize); newDimensionOrNull(generator, constraints.myMaximumSize); if (constraints.isUseParentLayout()) { generator.push(constraints.getIndent()); generator.push(constraints.isUseParentLayout()); generator.invokeConstructor(myGridConstraintsType, myInitConstraintsIndentParentMethod); } else if (constraints.getIndent() != 0) { generator.push(constraints.getIndent()); generator.invokeConstructor(myGridConstraintsType, myInitConstraintsIndentMethod); } else { generator.invokeConstructor(myGridConstraintsType, myInitConstraintsMethod); } }
public void generateComponentLayout(final LwComponent lwComponent, final GeneratorAdapter generator, final int componentLocal, final int parentLocal) { generator.loadLocal(parentLocal); generator.loadLocal(componentLocal); generator.invokeVirtual(ourContainerType, ourAddMethod); }
@Override public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters params, RunnerSettings runnerSettings) { if (!isApplicableFor(configuration)) { return; } ApplicationConfiguration appConfiguration = (ApplicationConfiguration) configuration; SnapShooterConfigurationSettings settings = appConfiguration.getUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY); if (settings == null) { settings = new SnapShooterConfigurationSettings(); appConfiguration.putUserData(SnapShooterConfigurationSettings.SNAP_SHOOTER_KEY, settings); } if (appConfiguration.ENABLE_SWING_INSPECTOR) { settings.setLastPort(NetUtils.tryToFindAvailableSocketPort()); } if (appConfiguration.ENABLE_SWING_INSPECTOR && settings.getLastPort() != -1) { params.getProgramParametersList().prepend(appConfiguration.MAIN_CLASS_NAME); params.getProgramParametersList().prepend(Integer.toString(settings.getLastPort())); // add +1 because idea_rt.jar will be added as the last entry to the classpath params.getProgramParametersList().prepend(Integer.toString(params.getClassPath().getPathList().size() + 1)); Set<String> paths = new TreeSet<String>(); paths.add(PathUtil.getJarPathForClass(SnapShooter.class)); // ui-designer-impl paths.add(PathUtil.getJarPathForClass(BaseComponent.class)); // appcore-api paths.add(PathUtil.getJarPathForClass(ProjectComponent.class)); // openapi paths.add(PathUtil.getJarPathForClass(LwComponent.class)); // UIDesignerCore paths.add(PathUtil.getJarPathForClass(GridConstraints.class)); // forms_rt paths.add(PathUtil.getJarPathForClass(PaletteGroup.class)); // openapi paths.add(PathUtil.getJarPathForClass(LafManagerListener.class)); // ui-impl paths.add(PathUtil.getJarPathForClass(DataProvider.class)); // action-system-openapi paths.add(PathUtil.getJarPathForClass(XmlStringUtil.class)); // idea paths.add(PathUtil.getJarPathForClass(Navigatable.class)); // pom paths.add(PathUtil.getJarPathForClass(AreaInstance.class)); // extensions paths.add(PathUtil.getJarPathForClass(FormLayout.class)); // jgoodies paths.addAll(PathManager.getUtilClassPath()); for(String path: paths) { params.getClassPath().addFirst(path); } params.setMainClass("com.intellij.uiDesigner.snapShooter.SnapShooter"); } }
public void generateComponentLayout(final LwComponent component, final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { generator.startMethodCall(parentVariable, "add"); generator.pushVar(variable); generator.push((String) component.getCustomLayoutConstraints()); generator.endMethod(); }
public void generateComponentLayout(final LwComponent component, final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { final LwTabbedPane.Constraints tabConstraints = (LwTabbedPane.Constraints)component.getCustomLayoutConstraints(); if (tabConstraints == null){ throw new IllegalArgumentException("tab constraints cannot be null: " + component.getId()); } generator.startMethodCall(parentVariable, "addTab"); generator.push(tabConstraints.myTitle); if (tabConstraints.myIcon != null || tabConstraints.myToolTip != null) { if (tabConstraints.myIcon == null) { generator.pushVar(PsiKeyword.NULL); } else { generator.pushIcon(tabConstraints.myIcon); } } generator.pushVar(variable); if (tabConstraints.myToolTip != null) { generator.push(tabConstraints.myToolTip); } generator.endMethod(); int index = component.getParent().indexOfComponent(component); if (tabConstraints.myDisabledIcon != null) { generator.startMethodCall(parentVariable, "setDisabledIconAt"); generator.push(index); generator.pushIcon(tabConstraints.myDisabledIcon); generator.endMethod(); } if (!tabConstraints.myEnabled) { generator.startMethodCall(parentVariable, "setEnabledAt"); generator.push(index); generator.push(tabConstraints.myEnabled); generator.endMethod(); } }
public void generateComponentLayout(final LwComponent component, final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { generator.startMethodCall(parentVariable, "add"); generator.pushVar(variable); generator.endMethod(); }
public void generateComponentLayout(final LwComponent component, @NonNls final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { generator.startMethodCall(parentVariable, "add"); generator.pushVar(variable); generator.checkParameter(); generator.append("BorderLayout." + ((String) component.getCustomLayoutConstraints()).toUpperCase()); generator.endMethod(); }
public void generateComponentLayout(final LwComponent component, final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { generator.startMethodCall(parentVariable, "add"); generator.pushVar(variable); addNewGridConstraints(generator, component); generator.endMethod(); }
public void generateComponentLayout(final LwComponent component, final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { @NonNls final String methodName = LwSplitPane.POSITION_LEFT.equals(component.getCustomLayoutConstraints()) ? "setLeftComponent" : "setRightComponent"; generator.startMethodCall(parentVariable, methodName); generator.pushVar(variable); generator.endMethod(); }
public void generateComponentLayout(final LwComponent component, final FormSourceCodeGenerator generator, final String variable, final String parentVariable) { generator.startMethodCall(parentVariable, "setViewportView"); generator.pushVar(variable); generator.endMethod(); }