Package com.google.gdt.eclipse.designer.model.widgets

Examples of com.google.gdt.eclipse.designer.model.widgets.WidgetInfo


  VariableSupport materialize() throws Exception {
    String source = m_javaInfo.getDescription().getCreation(null).getSource();
    // prepare Container.add(component) invocation
    MethodInvocation invocation;
    {
      WidgetInfo component = (WidgetInfo) m_javaInfo.getParent();
      InvocationChildAssociation componentAssociation =
          (InvocationChildAssociation) component.getAssociation();
      invocation = componentAssociation.getInvocation();
      Assert.isTrue(
          invocation.arguments().size() == 1,
          "Invalid number of association arguments. %s for %s.",
          invocation,
View Full Code Here


   */
  private static List<LayoutDataInfo> getLayoutDataList(List<ObjectInfo> objects) {
    ArrayList<LayoutDataInfo> layoutDataList = Lists.newArrayList();
    for (ObjectInfo object : objects) {
      if (object instanceof WidgetInfo) {
        WidgetInfo widget = (WidgetInfo) object;
        LayoutDataInfo layoutData = LayoutInfo.getLayoutData(widget);
        if (layoutData != null) {
          layoutDataList.add(layoutData);
        }
      }
View Full Code Here

  //
  // Access
  //
  ////////////////////////////////////////////////////////////////////////////
  public int getActiveIndex() {
    WidgetInfo activeWidget = m_stackContainer.getActive();
    return activeWidget != null ? getChildrenWidgets().indexOf(activeWidget) : 0;
  }
View Full Code Here

          throws Exception {
        // add new LayoutData - remove existing one
        if (parent instanceof WidgetInfo
            && child instanceof LayoutDataInfo
            && isActiveOnContainer(parent.getParent())) {
          WidgetInfo widget = (WidgetInfo) parent;
          LayoutDataInfo existingLayoutData = getLayoutData(widget);
          if (existingLayoutData != null) {
            widget.removeChild(existingLayoutData);
          }
        }
      }
    });
    addBroadcastListener(new ObjectInfoChildAddAfter() {
      public void invoke(ObjectInfo parent, ObjectInfo child) throws Exception {
        ContainerInfo container = getContainer();
        // add this layout
        if (child == m_this) {
          // implicit layouts are bound to its parent
          if (getCreationSupport() instanceof IImplicitCreationSupport) {
            targetBroadcastListener(parent);
          }
          // create virtual LayoutData's
          for (WidgetInfo widget : container.getChildrenWidgets()) {
            ensureLayoutData(widget);
          }
        }
      }
    });
    addBroadcastListener(new ObjectInfoDelete() {
      @Override
      public void before(ObjectInfo parent, ObjectInfo child) throws Exception {
        // delete this layout
        if (child == m_this) {
          onDelete();
        }
        // delete Widget_Info from this container
        if (isActiveOnContainer(parent) && child instanceof WidgetInfo) {
          onWidgetRemoveBefore((WidgetInfo) child);
        }
      }

      @Override
      public void after(ObjectInfo parent, ObjectInfo child) throws Exception {
        // LayoutData was deleted - create virtual
        if (parent instanceof WidgetInfo
            && child instanceof LayoutDataInfo
            && shouldCreateLayoutData((WidgetInfo) parent)
            && isActiveOnContainer(parent.getParent())) {
          WidgetInfo widget = (WidgetInfo) parent;
          ensureLayoutData(widget);
        }
        // Widget_Info was deleted
        if (isActiveOnContainer(parent) && child instanceof WidgetInfo) {
          WidgetInfo widget = (WidgetInfo) child;
          if (widget.isDeleted()) {
            onWidgetRemoveAfter(widget);
          }
        }
      }
    });
    addBroadcastListener(new JavaEventListener() {
      @Override
      public void addAfter(JavaInfo parent, JavaInfo child) throws Exception {
        // new Widget_Info added, ensure layout data
        if (isActiveOnContainer(parent) && child instanceof WidgetInfo) {
          ensureLayoutData((WidgetInfo) child);
        }
      }

      @Override
      public void moveBefore(JavaInfo child, ObjectInfo oldParent, JavaInfo newParent)
          throws Exception {
        // move Widget_Info FROM this container
        if (isActiveOnContainer(oldParent) && child instanceof WidgetInfo && newParent != oldParent) {
          WidgetInfo widget = (WidgetInfo) child;
          onWidgetRemoveBefore(widget);
          deleteLayoutData(widget);
        }
      }
View Full Code Here

    List<WidgetInfo> widgets = getContainer().getChildrenWidgets();
    int columnCount = (Integer) getPropertyByTitle("columns").getValue();
    int rowCount = (int) Math.ceil((double) widgets.size() / columnCount);
    for (int column = 0; column < columnCount; column++) {
      if (isEmptyColumn(column) && column < widgets.size()) {
        WidgetInfo widget = widgets.get(column);
        ReflectionUtils.invokeMethod(widget.getObject(), "setWidth(java.lang.String)", "25px");
      }
    }
    for (int row = 0; row < rowCount; row++) {
      if (isEmptyRow(row)) {
        WidgetInfo widget = widgets.get(row * columnCount);
        ReflectionUtils.invokeMethod(widget.getObject(), "setHeight(java.lang.String)", "25px");
      }
    }
    ReflectionUtils.invokeMethod(getContainer().getObject(), "doLayout()");
    getContainer().getState().runMessagesLoop();
  }
View Full Code Here

              && removingData.x <= column
              && column < removingData.x + removingData.width;
      // check if empty
      boolean isEmpty = true;
      for (int row = 0; row < grid.length; row++) {
        WidgetInfo widget = grid[row][column];
        isEmpty &= isFiller(widget);
      }
      // delete if empty
      if (isEmpty && (!deleteOnlyIfIsRemovingColumn || isRemovingColumn)) {
        command_deleteColumn(column, false);
View Full Code Here

              && removingData.y <= row
              && row < removingData.y + removingData.height;
      // check if empty
      boolean isEmpty = true;
      for (int column = 0; column < grid[row].length; column++) {
        WidgetInfo widget = grid[row][column];
        isEmpty &= isFiller(widget);
      }
      // delete if empty
      if (isEmpty && (!deleteOnlyIfIsRemovingRow || isRemovingRow)) {
        command_deleteRow(row, false);
View Full Code Here

          tableData.x = cells.x;
          tableData.y = cells.y;
        }
        // move model
        {
          WidgetInfo reference = getReferenceWidget(cells.y, cells.x, widget);
          command_MOVE(widget, reference);
        }
      }
      // set span
      {
        tableData.setColSpan(cells.width);
        tableData.setRowSpan(cells.height);
      }
      // remove fillers
      for (Point cell : cellsToRemoveFillers) {
        WidgetInfo filler = grid[cell.y][cell.x];
        filler.delete();
      }
      // add fillers
      for (Point cell : cellsToAddFillers) {
        addFiller(cell.x, cell.y);
      }
View Full Code Here

   */
  private void addFiller(int column, int row) throws Exception {
    // prepare creation support
    ConstructorCreationSupport creationSupport = new ConstructorCreationSupport("empty", false);
    // prepare filler
    WidgetInfo filler =
        (WidgetInfo) JavaInfoUtils.createJavaInfo(
            getEditor(),
            "com.gwtext.client.widgets.form.Label",
            creationSupport);
    // add filler
    WidgetInfo reference = getReferenceWidget(row, column, null);
    JavaInfoUtils.add(
        filler,
        new EmptyInvocationVariableSupport(filler, "%parent%.add(%child%)", 0),
        PureFlatStatementGenerator.INSTANCE,
        AssociationObjects.invocationChildNull(),
View Full Code Here

   */
  private static List<LayoutDataInfo> getLayoutDataList(List<ObjectInfo> objects) {
    ArrayList<LayoutDataInfo> layoutDataList = Lists.newArrayList();
    for (ObjectInfo object : objects) {
      if (object instanceof WidgetInfo) {
        WidgetInfo widget = (WidgetInfo) object;
        LayoutDataInfo layoutData = LayoutInfo.getLayoutData(widget);
        if (layoutData != null) {
          layoutDataList.add(layoutData);
        }
      }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.widgets.WidgetInfo

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.