public void generateContainerLayout(final LwContainer lwContainer, final GeneratorAdapter generator, final int componentLocal) { FormLayout formLayout = (FormLayout) lwContainer.getLayout(); generator.loadLocal(componentLocal); generator.newInstance(ourFormLayoutType); generator.dup(); generator.push(FormLayoutUtils.getEncodedColumnSpecs(formLayout)); generator.push(FormLayoutUtils.getEncodedRowSpecs(formLayout)); generator.invokeConstructor(ourFormLayoutType, ourFormLayoutConstructor); generateGroups(generator, formLayout.getRowGroups(), ourSetRowGroupsMethod); generateGroups(generator, formLayout.getColumnGroups(), ourSetColumnGroupsMethod); generator.invokeVirtual(ourContainerType, ourSetLayoutMethod); }
public void generateContainerLayout(final LwContainer lwContainer, final GeneratorAdapter generator, final int componentLocal) { if (lwContainer.isGrid()) { // arg 0: object generator.loadLocal(componentLocal); // arg 1: layout final GridLayoutManager layout = (GridLayoutManager)lwContainer.getLayout(); generator.newInstance(myGridLayoutManagerType); generator.dup(); generator.push(layout.getRowCount()); generator.push(layout.getColumnCount()); AsmCodeGenerator.pushPropValue(generator, "java.awt.Insets", layout.getMargin()); generator.push(layout.getHGap()); generator.push(layout.getVGap()); generator.push(layout.isSameSizeHorizontally()); generator.push(layout.isSameSizeVertically()); generator.invokeConstructor(myGridLayoutManagerType, ourGridLayoutManagerConstructor); generator.invokeVirtual(ourContainerType, ourSetLayoutMethod); } }
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 void generateContainerLayout(final LwContainer lwContainer, final GeneratorAdapter generator, final int componentLocal) { generator.loadLocal(componentLocal); FlowLayout flowLayout = (FlowLayout) lwContainer.getLayout(); generator.newInstance(ourFlowLayoutType); generator.dup(); generator.push(flowLayout.getAlignment()); generator.push(flowLayout.getHgap()); generator.push(flowLayout.getVgap()); generator.invokeConstructor(ourFlowLayoutType, ourConstructor); generator.invokeVirtual(ourContainerType, ourSetLayoutMethod); }
public void generateContainerLayout(final LwContainer lwContainer, final GeneratorAdapter generator, final int componentLocal) { generator.loadLocal(componentLocal); generator.newInstance(myLayoutType); generator.dup(); generator.push(Utils.getHGap(lwContainer.getLayout())); generator.push(Utils.getVGap(lwContainer.getLayout())); generator.invokeConstructor(myLayoutType, ourConstructor); generator.invokeVirtual(ourContainerType, ourSetLayoutMethod); }
public void generateContainerLayout(final LwContainer lwContainer, final GeneratorAdapter generator, final int componentLocal) { generator.loadLocal(componentLocal); generator.newInstance(ourGridBagLayoutType); generator.dup(); generator.invokeConstructor(ourGridBagLayoutType, ourDefaultConstructor); generator.invokeVirtual(ourContainerType, ourSetLayoutMethod); }
@Override public void generateContainerLayout(final LwContainer component, final FormSourceCodeGenerator generator, final String variable) { generator.startMethodCall(variable, "setLayout"); FlowLayout layout = (FlowLayout) component.getLayout(); generator.startConstructor(FlowLayout.class.getName()); generator.push(layout.getAlignment(), myAlignMap); generator.push(layout.getHgap()); generator.push(layout.getVgap()); generator.endConstructor(); generator.endMethod(); }
@Override public void generateContainerLayout(final LwContainer container, final FormSourceCodeGenerator generator, final String variable) { generator.startMethodCall(variable, "setLayout"); generator.startConstructor(GridBagLayout.class.getName()); generator.endConstructor(); generator.endMethod(); }
protected void generateLayoutWithGaps(final LwContainer component, final FormSourceCodeGenerator generator, final String variable, final Class<? extends LayoutManager> layoutClass) { generator.startMethodCall(variable, "setLayout"); generator.startConstructor(layoutClass.getName()); generator.push(Utils.getHGap(component.getLayout())); generator.push(Utils.getVGap(component.getLayout())); generator.endConstructor(); generator.endMethod(); }
@Override public void generateContainerLayout(final LwContainer component, final FormSourceCodeGenerator generator, final String variable) { FormLayout layout = (FormLayout) component.getLayout(); generator.startMethodCall(variable, "setLayout"); generator.startConstructor(FormLayout.class.getName()); generator.push(FormLayoutUtils.getEncodedColumnSpecs(layout)); generator.push(FormLayoutUtils.getEncodedRowSpecs(layout)); generator.endConstructor(); generator.endMethod(); generateGroups(generator, variable, "setRowGroups", layout.getRowGroups()); generateGroups(generator, variable, "setColumnGroups", layout.getColumnGroups()); }
public void generateContainerLayout(final LwContainer lwContainer, final GeneratorAdapter generator, final int componentLocal) { }
@Override public void generateContainerLayout(final LwContainer component, final FormSourceCodeGenerator generator, final String variable) { generateLayoutWithGaps(component, generator, variable, CardLayout.class); }
public void generateContainerLayout(final LwContainer component, final FormSourceCodeGenerator generator, final String variable) { }
@Override public void generateContainerLayout(final LwContainer component, final FormSourceCodeGenerator generator, final String variable) { generateLayoutWithGaps(component, generator, variable, BorderLayout.class); }
@Override public void generateContainerLayout(final LwContainer container, final FormSourceCodeGenerator generator, final String variable) { if (container.isXY()) { if (container.getComponentCount() != 0) { throw new IllegalStateException("only empty xys are accepted"); } // no layout needed } else { if (container.isGrid()) { final GridLayoutManager layout = (GridLayoutManager)container.getLayout(); generator.startMethodCall(variable, "setLayout"); generator.startConstructor(GridLayoutManager.class.getName()); generator.push(layout.getRowCount()); generator.push(layout.getColumnCount()); generator.newInsets(layout.getMargin()); generator.push(layout.getHGap()); generator.push(layout.getVGap()); if (layout.isSameSizeHorizontally() || layout.isSameSizeVertically()) { // values differ from the defaults - use appropriate constructor generator.push(layout.isSameSizeHorizontally()); generator.push(layout.isSameSizeVertically()); } generator.endConstructor(); // GridLayoutManager generator.endMethod(); } else if (container.isXY()) { throw new IllegalArgumentException("XY is not supported"); } else { throw new IllegalArgumentException("unknown layout: " + container.getLayout()); } } }
public void readLayout(LwContainer lwContainer, RadContainer radContainer) throws Exception { }
@Override public void readLayout(LwContainer lwContainer, RadContainer radContainer) throws Exception { String defaultCard = (String)lwContainer.getClientProperty(UIFormXmlConstants.LAYOUT_CARD); DefaultCardProperty.INSTANCE.setValue(radContainer, defaultCard); }