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

Examples of com.google.gdt.eclipse.designer.smart.model.CanvasInfo


        placementsSupport.commitAdd();
        for (IAbstractComponentInfo widget : models) {
          Rectangle bounds = widget.getModelBounds();
          WidgetInfo component = (WidgetInfo) widget;
          m_canvas.command_absolute_MOVE(component, null);
          CanvasInfo boundsCanvas = getBoundsCanvas(component);
          if (boundsCanvas != null) {
            m_canvas.command_BOUNDS(boundsCanvas, bounds.getLocation(), null);
          }
        }
      }
View Full Code Here


      protected void executeEdit() throws Exception {
        for (EditPart editPart : request.getEditParts()) {
          IAbstractComponentInfo widget = (IAbstractComponentInfo) editPart.getModel();
          Rectangle bounds = widget.getModelBounds();
          WidgetInfo component = (WidgetInfo) widget;
          CanvasInfo boundsCanvas = getBoundsCanvas(component);
          if (boundsCanvas != null) {
            m_canvas.command_BOUNDS(boundsCanvas, bounds.getLocation(), bounds.getSize());
          }
        }
      }
View Full Code Here

  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected Dimension getLivePreferredSize() {
    Dimension size = super.getLivePreferredSize();
    CanvasInfo canvas = getCanvas();
    if (size == null && canvas != null) {
      size = canvas.getPreferredSize();
    }
    return size;
  };
View Full Code Here

          m_form.command_BOUNDS(item, widgetModelBounds.getLocation(), widgetModelBounds.getSize());
        }
      };
    }
    if (newObject instanceof CanvasInfo) {
      final CanvasInfo canvas = (CanvasInfo) newObject;
      return new EditCommand(m_form) {
        @Override
        protected void executeEdit() throws Exception {
          placementsSupport.commitAdd();
          Rectangle widgetModelBounds = canvas.getModelBounds();
          m_form.command_CREATE(canvas, null);
          m_form.command_BOUNDS(
              (FormItemInfo) canvas.getParentJava(),
              widgetModelBounds.getLocation(),
              widgetModelBounds.getSize());
        }
      };
    }
View Full Code Here

          item,
          pasteLocation.getTranslated(widgetBounds.getLocation()),
          widgetBounds.getSize());
    }
    if (component instanceof CanvasInfo) {
      CanvasInfo canvas = (CanvasInfo) component;
      // create
      m_form.command_CREATE(canvas, null);
      Rectangle widgetBounds = pastedWidget.getBounds();
      m_form.command_BOUNDS(
          (FormItemInfo) canvas.getParentJava(),
          pasteLocation.getTranslated(widgetBounds.getLocation()),
          widgetBounds.getSize());
    }
  }
View Full Code Here

        placementsSupport.commitAdd();
        Rectangle widgetModelBounds = component.getModelBounds();
        m_canvas.command_absolute_CREATE(component, null);
        Point location = widgetModelBounds.getLocation();
        Dimension size = getSize(widgetModelBounds);
        CanvasInfo boundsCanvas = getBoundsCanvas(component);
        if (boundsCanvas != null) {
          m_canvas.command_BOUNDS(boundsCanvas, location, size);
        }
      }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected CanvasInfo createLiveComponent() throws Exception {
    m_utils.setLiveManager(true);
    // prepare empty RootPanel
    final CanvasInfo parentCanvas;
    {
      String[] sourceLines =
          new String[]{
              "  com.google.gwt.user.client.ui.RootPanel __wbp_panel = com.google.gwt.user.client.ui.RootPanel.get();",
              "  com.smartgwt.client.widgets.Canvas __wbp_canvas = new com.smartgwt.client.widgets.Canvas();",
              "  __wbp_canvas.setTitle(\"__wbp_liveWidget\");",
              "  __wbp_panel.add(__wbp_canvas);",
              "  __wbp_panel.setPixelSize(800, 600);",};
      RootPanelInfo panel = (RootPanelInfo) parse(sourceLines);
      parentCanvas = (CanvasInfo) panel.getChildrenWidgets().get(0);
    }
    // prepare component
    CanvasInfo canvas = createClone();
    // add component on Canvas
    parentCanvas.command_absolute_CREATE(canvas, null);
    parentCanvas.command_BOUNDS(canvas, new Point(10, 10), null);
    // check for forced size
    {
      String width = canvas.getDescription().getParameter("liveComponent.forcedSize.width");
      String height = canvas.getDescription().getParameter("liveComponent.forcedSize.height");
      if (!StringUtils.isEmpty(width) && !StringUtils.isEmpty(height)) {
        m_shouldSetSize = true;
        canvas.getSizeSupport().setSize(width, height);
      }
    }
    // ready to get live values
    return canvas;
  }
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_parse() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    MenuBar menuBar = new MenuBar();",
            "    Menu menu = new Menu();",
            "    MenuItem menuItem = new MenuItem('New MenuItem');",
            "    menu.addItem(menuItem);",
            "    menuBar.setMenus(new Menu[] { menu });",
            "    canvas.addChild(menuBar);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    MenuBarInfo menuBar = canvas.getChildren(MenuBarInfo.class).get(0);
    //
    assertThat(menuBar.getMenusArrayInfo()).isNotNull();
    List<MenuInfo> menus = menuBar.getMenus();
    assertThat(menus.size()).isEqualTo(1);
    assertThat(menus.get(0).getItems().size()).isEqualTo(1);
View Full Code Here

    assertThat(menus.size()).isEqualTo(1);
    assertThat(menus.get(0).getItems().size()).isEqualTo(1);
  }

  public void test_parse_empty() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    MenuBar menuBar = new MenuBar();",
            "    canvas.addChild(menuBar);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    MenuBarInfo menuBar = canvas.getChildren(MenuBarInfo.class).get(0);
    //
    assertThat(menuBar.getMenusArrayInfo()).isNotNull();
    List<MenuInfo> menus = menuBar.getMenus();
    assertThat(menus).isEmpty();
  }
View Full Code Here

    List<MenuInfo> menus = menuBar.getMenus();
    assertThat(menus).isEmpty();
  }

  public void test_CREATE() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    //
    MenuBarInfo menuBar = createJavaInfo("com.smartgwt.client.widgets.menu.MenuBar");
    // check "live" image
    assertThat(menuBar.getImage()).isNotNull();
    // do create
    canvas.command_absolute_CREATE(menuBar, null);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    Canvas canvas = new Canvas();",
        "    {",
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.smart.model.CanvasInfo

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.