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

Examples of com.google.gdt.eclipse.designer.model.widgets.support.GwtState


  /**
   * Fills {@link #m_widgetHandles}.
   */
  private void prepareWidgetHandles() throws Exception {
    GwtState state = getState();
    DOMUtils dom = state.getDomUtils();
    m_widgetHandles.clear();
    m_widgetToHandleBounds.clear();
    // prepare table row with tabs
    Object tabBarRowElement;
    {
      Object panelObject = getObject();
      Object tabBarWidget = ReflectionUtils.invokeMethod(panelObject, "getTabBar()");
      Object tabBarElement = state.getUIObjectUtils().getElement(tabBarWidget);
      Object tabBarBodyElement = dom.getChild(tabBarElement, 0);
      tabBarRowElement = dom.getChild(tabBarBodyElement, 0);
    }
    // fetch tabs bounds for each widget
    List<WidgetInfo> widgets = getChildrenWidgets();
    for (int index = 0; index < widgets.size(); index++) {
      WidgetInfo widget = widgets.get(index);
      // use "1 +" because first TD is "gwt-TabBarFirst"
      Object tabElement = dom.getChild(tabBarRowElement, 1 + index);
      tabElement = dom.getChild(tabElement, 0);
      Rectangle tabBounds = state.getAbsoluteBounds(tabElement);
      absoluteToRelative(tabBounds);
      // remember tab and bounds
      m_widgetHandles.add(new WidgetHandle(widget));
      m_widgetToHandleBounds.put(widget, tabBounds);
    }
View Full Code Here


    }
    return absoluteBounds;
  }

  protected void fetchImage(Object element) throws Exception {
    GwtState state = getState();
    Image browserScreenshot = state.createBrowserScreenshot();
    // prepare bounds of image
    Rectangle imageBounds = m_absoluteBounds;
    if (state.isStrictMode() && state.isBrowserExplorer()) {
      imageBounds = imageBounds.getTranslated(2, 2);
    }
    // set image
    Image objectImage = UiUtils.getCroppedImage(browserScreenshot, imageBounds.getSwtRectangle());
    setImage(objectImage);
View Full Code Here

  /**
   * Fetch spacing of UI Object.
   */
  protected void fetchSpacing() throws Exception {
    GwtState state = getState();
    Object element = getDOMElement();
    m_margins = state.getMargins(element);
    m_borders = state.getBorders(element);
    m_paddings = state.getPaddings(element);
    // prepare "clientAreaInsets"
    if (!getState().isBody(element)) {
      fetchClientAreaInsets();
    }
  }
View Full Code Here

  // TopBoundsSupport
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  public void apply() throws Exception {
    GwtState state = m_widget.getState();
    Dimension size = getResourceSize();
    // IE in strict mode always has border 2px
    if (state.isStrictMode() && state.isBrowserExplorer()) {
      size.expand(2 + 2, 2 + 2);
    }
    // prepare Shell
    IBrowserShell shell = state.getShell();
    shell.prepare();
    // set Shell size
    {
      Rectangle shellBounds = shell.computeTrim(0, 0, size.width, size.height);
      shell.setSize(shellBounds.width, shellBounds.height);
View Full Code Here

      reparseOnStateModification(object);
    }
  }

  private void reparseOnStateModification(UIObjectInfo object) {
    final GwtState state = object.getState();
    object.addBroadcastListener(new EditorActivatedListener() {
      public void invoke(EditorActivatedRequest request) throws Exception {
        if (state.isModified()) {
          request.requestRefresh();
        }
        state.activate();
      }
    });
  }
View Full Code Here

      Set<Integer> filledColumns,
      int row,
      int cell,
      int column) throws Exception {
    Object object = m_panel.getObject();
    GwtState state = m_panel.getState();
    // do fill
    {
      Object label = state.getUIObjectUtils().createLabel();
      String labelWidth = filledColumns.contains(column) ? "1px" : EMPTY_SIZE;
      String labelHeight = filledRows.contains(row) ? "1px" : EMPTY_SIZE;
      invokeMethod(label, "setSize(java.lang.String,java.lang.String)", labelWidth, labelHeight);
      invokeMethod(
          object,
View Full Code Here

  /**
   * Fills {@link #m_widgetHandles}.
   */
  private void prepareWidgetHandles() throws Exception {
    GwtState state = getState();
    DOMUtils dom = state.getDomUtils();
    m_widgetHandles.clear();
    m_widgetToHandleBounds.clear();
    // prepare table row with tabs
    Object tabBarRowElement;
    {
      Object panelObject = getObject();
      Object tabBarWidget = ReflectionUtils.invokeMethod(panelObject, "getTabBar()");
      Object tabBarElement = state.getUIObjectUtils().getElement(tabBarWidget);
      Object tabBarBodyElement = dom.getChild(tabBarElement, 0);
      tabBarRowElement = dom.getChild(tabBarBodyElement, 0);
    }
    // fetch tabs bounds for each widget
    List<WidgetInfo> widgets = getChildrenWidgets();
    for (int index = 0; index < widgets.size(); index++) {
      WidgetInfo widget = widgets.get(index);
      // use "1 +" because first TD is "gwt-TabBarFirst"
      Object tabElement = dom.getChild(tabBarRowElement, 1 + index);
      tabElement = dom.getChild(tabElement, 0);
      Rectangle tabBounds = state.getAbsoluteBounds(tabElement);
      absoluteToRelative(tabBounds);
      // remember tab and bounds
      m_widgetHandles.add(new WidgetHandle(widget));
      m_widgetToHandleBounds.put(widget, tabBounds);
    }
View Full Code Here

      addButtonForCSS(object);
    }
  }

  private void reparseOnStateModification(UIObjectInfo object) {
    final GwtState state = object.getState();
    object.addBroadcastListener(new EditorActivatedListener() {
      public void invoke(EditorActivatedRequest request) throws Exception {
        if (state.isModified()) {
          request.requestRefresh();
        }
        state.activate();
      }
    });
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  private static final int SIZE_EXPAND = 50;

  @Override
  public void apply() throws Exception {
    GwtState state = m_rootPanel.getState();
    Dimension size = getSize();
    // prepare Shell
    IBrowserShell shell = state.getShell();
    shell.prepare();
    // set Shell size
    {
      Rectangle shellBounds = shell.computeTrim(0, 0, size.width, size.height);
      if (state.isStrictMode() && !state.isBrowserWebKit()) {
        shellBounds.width += SIZE_EXPAND;
        shellBounds.height += SIZE_EXPAND;
      }
      shell.setSize(shellBounds.width, shellBounds.height);
    }
    // in "strict" mode RootPanel (i.e. "body") has size required by widgets, so force size
    if (state.isStrictMode()) {
      Insets margins = state.getMargins(m_rootPanel.getElement());
      Insets borders = state.getBorders(m_rootPanel.getElement());
      int width = size.width - margins.getWidth() - borders.getWidth();
      int height = size.height - margins.getHeight() - borders.getHeight();
      ReflectionUtils.invokeMethod(m_rootPanel.getObject(), "setPixelSize(int,int)", width, height);
    }
  }
View Full Code Here

  /**
   * Fills {@link #m_widgetHandles}.
   */
  private void prepareWidgetHandles() throws Exception {
    GwtState state = getState();
    m_widgetHandles.clear();
    //
    List<?> tabs = (List<?>) ReflectionUtils.getFieldObject(getObject(), "tabs");
    for (WidgetInfo widget : getChildrenWidgets()) {
      int index =
          (Integer) ReflectionUtils.invokeMethod(
              getObject(),
              "getWidgetIndex(com.google.gwt.user.client.ui.Widget)",
              widget.getObject());
      Object tabWidget = tabs.get(index);
      Object tabElement = state.getUIObjectUtils().getElement(tabWidget);
      // prepare bounds
      Rectangle tabBounds = state.getAbsoluteBounds(tabElement);
      absoluteToRelative(tabBounds);
      // add handle object
      m_widgetHandles.add(new WidgetHandle(widget));
      m_widgetToHandleBounds.put(widget, tabBounds);
    }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.widgets.support.GwtState

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.