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

Examples of com.google.gdt.eclipse.designer.model.widgets.panels.ILayoutPanelInfo.Anchor


    anchor_removeEmptyLine_inEditor();
    frame.refresh();
    WidgetInfo button = getJavaInfoByName("button");
    // initial anchor
    {
      Anchor anchor = frame.getAnchor(button, horizontal);
      assertSame(initialAnchor, anchor);
      assertNotNull(anchor.getImage(horizontal));
      assertNotNull(anchor.getSmallImage(horizontal));
    }
    // set new anchor
    frame.command_ANCHOR(button, horizontal, newAnchor);
    anchor_assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootLayoutPanel rootPanel = RootLayoutPanel.get();",
        "    {",
        "      Button button = new Button();",
        "      rootPanel.add(button);",
        "      " + getAnchorLine(expectedDesc),
        "    }",
        "  }",
        "}");
    {
      Anchor anchor = frame.getAnchor(button, horizontal);
      assertSame(newAnchor, anchor);
    }
  }
View Full Code Here


  //
  ////////////////////////////////////////////////////////////////////////////
  public Anchor getAnchor(List<W> widgets, boolean horizontal) {
    Set<Anchor> anchors = Sets.newHashSet();
    for (W widget : widgets) {
      Anchor anchor = m_panel.getAnchor(widget, horizontal);
      anchors.add(anchor);
    }
    return anchors.size() == 1 ? anchors.iterator().next() : null;
  }
View Full Code Here

    }
    return anchors.size() == 1 ? anchors.iterator().next() : null;
  }

  public void addAnchorActions_horizontal(List<Object> actions, List<W> widgets) {
    Anchor anchor = getAnchor(widgets, true);
    actions.add(new AnchorAction(widgets, Anchor.NONE, true, "none", anchor));
    actions.add(new AnchorAction(widgets, Anchor.LEADING, true, "left + width", anchor));
    actions.add(new AnchorAction(widgets, Anchor.TRAILING, true, "right + width", anchor));
    actions.add(new AnchorAction(widgets, Anchor.BOTH, true, "left + right", anchor));
  }
View Full Code Here

    actions.add(new AnchorAction(widgets, Anchor.TRAILING, true, "right + width", anchor));
    actions.add(new AnchorAction(widgets, Anchor.BOTH, true, "left + right", anchor));
  }

  public void addAnchorActions_vertical(List<Object> actions, List<W> widgets) {
    Anchor anchor = getAnchor(widgets, false);
    actions.add(new AnchorAction(widgets, Anchor.NONE, false, "none", anchor));
    actions.add(new AnchorAction(widgets, Anchor.LEADING, false, "top + height", anchor));
    actions.add(new AnchorAction(widgets, Anchor.TRAILING, false, "bottom + height", anchor));
    actions.add(new AnchorAction(widgets, Anchor.BOTH, false, "top + bottom", anchor));
  }
View Full Code Here

  private void installSupport_AlignmentFigures() {
    new AlignmentActionsHelper<W>(this) {
      @Override
      protected Figure createAlignmentFigure(final W widget, final boolean horizontal) {
        IEditPartViewer viewer = getHost().getViewer();
        final Anchor anchor = m_panel.getAnchor(widget, horizontal);
        if (horizontal) {
          return new AbstractPopupFigure(viewer, 16, 8) {
            @Override
            protected Image getImage() {
              return anchor != null ? anchor.getSmallImage(horizontal) : null;
            }

            @Override
            protected void fillMenu(IMenuManager manager) {
              addAlignmentActions(manager, widget, horizontal);
            }
          };
        } else {
          return new AbstractPopupFigure(viewer, 8, 16) {
            @Override
            protected Image getImage() {
              return anchor != null ? anchor.getSmallImage(horizontal) : null;
            }

            @Override
            protected void fillMenu(IMenuManager manager) {
              addAlignmentActions(manager, widget, horizontal);
View Full Code Here

            "</ui:UiBinder>");
    refresh();
    WidgetInfo button = getObjectByName("button");
    // initial anchor
    {
      Anchor anchor = frame.getAnchor(button, horizontal);
      assertSame(initialAnchor, anchor);
      assertNotNull(anchor.getImage(horizontal));
      assertNotNull(anchor.getSmallImage(horizontal));
    }
    // set new anchor
    frame.command_ANCHOR(button, horizontal, newAnchor);
    assertXML(
        "// filler filler filler filler filler",
        "<ui:UiBinder>",
        "  <g:LayoutPanel>",
        "    <g:layer" + getAnchorLine(expectedDesc) + ">",
        "      <g:Button wbp:name='button'/>",
        "    </g:layer>",
        "  </g:LayoutPanel>",
        "</ui:UiBinder>");
    {
      Anchor anchor = frame.getAnchor(button, horizontal);
      assertSame(newAnchor, anchor);
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.widgets.panels.ILayoutPanelInfo.Anchor

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.