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 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(); } }