Package com.google.gdt.eclipse.designer.gwtext.model.layout

Examples of com.google.gdt.eclipse.designer.gwtext.model.layout.ColumnLayoutDataInfo


    if (widget.getAssociation() instanceof InvocationChildAssociation) {
      InvocationChildAssociation association = (InvocationChildAssociation) widget.getAssociation();
      MethodInvocation invocation = association.getInvocation();
      // set percent
      if (value.endsWith("%")) {
        ColumnLayoutDataInfo columnData;
        if (association.getDescription().getSignature().endsWith(",int)")) {
          columnData = setWidth_addColumnLayoutData(widget, invocation);
        } else {
          columnData = widget.getChildren(ColumnLayoutDataInfo.class).get(0);
        }
        // set "columnWidth" property
        {
          value = StringUtils.substring(value, 0, -1);
          double weight = Integer.parseInt(value) / 100.0;
          columnData.setWidth(weight);
        }
        // done
        return;
      }
      // set absolute value
      {
        Expression expression = DomGenerics.arguments(invocation).get(1);
        editor.replaceExpression(expression, value);
        editor.replaceInvocationBinding(invocation);
        for (JavaInfo columnData : widget.getChildren(ColumnLayoutDataInfo.class)) {
          columnData.delete();
        }
      }
    }
  }
View Full Code Here


  }

  private ColumnLayoutDataInfo setWidth_addColumnLayoutData(WidgetInfo widget,
      MethodInvocation invocation) throws Exception {
    AstEditor editor = getEditor();
    ColumnLayoutDataInfo columnData =
        (ColumnLayoutDataInfo) JavaInfoUtils.createJavaInfo(
            editor,
            "com.gwtext.client.widgets.layout.ColumnLayoutData",
            new ConstructorCreationSupport());
    // set CreationSupport
    Expression expression;
    {
      expression = DomGenerics.arguments(invocation).get(1);
      String contentSource = columnData.getCreationSupport().add_getSource(null);
      expression = editor.replaceExpression(expression, contentSource);
      columnData.getCreationSupport().add_setSourceExpression(expression);
      columnData.addRelatedNode(expression);
    }
    // set Association
    columnData.setAssociation(new InvocationSecondaryAssociation(invocation));
    editor.replaceInvocationBinding(invocation);
    // set VariableSupport
    VariableSupport variableSupport = new EmptyVariableSupport(columnData, expression);
    columnData.setVariableSupport(variableSupport);
    // add content ColumnLayoutData as child
    widget.addChild(columnData);
    return columnData;
  }
View Full Code Here

        "{this: com.gwtext.client.widgets.Panel} {this} {/setLayout(new ColumnLayout())/ /add(label)/}",
        "  {new: com.gwtext.client.widgets.layout.ColumnLayout} {empty} {/setLayout(new ColumnLayout())/}",
        "  {new: com.gwtext.client.widgets.form.Label} {local-unique: label} {/new Label()/ /add(label)/}",
        "    {virtual-layout_data: com.gwtext.client.widgets.layout.ColumnLayoutData} {virtual-layout-data} {}");
    WidgetInfo label = panel.getChildrenWidgets().get(0);
    ColumnLayoutDataInfo layoutData = ColumnLayoutInfo.getColumnData(label);
    assertNotNull(layoutData);
    // set width
    {
      layoutData.setWidth(0.2);
      assertEditor(
          "public class Test extends Panel {",
          "  public Test() {",
          "    setLayout(new ColumnLayout());",
          "    {",
          "      Label label = new Label();",
          "      add(label, new ColumnLayoutData(0.2));",
          "    }",
          "  }",
          "}");
    }
    // ColumnLayoutData should have top level "width" property
    {
      Property widthProperty = layoutData.getPropertyByTitle("width");
      assertNotNull(widthProperty);
      assertEquals(0.2d, widthProperty.getValue());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.gwtext.model.layout.ColumnLayoutDataInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.