Examples of GwtState


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

  // 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

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

    Dimension popupSize = getPopupSize(popup);
    return new Rectangle(50, 50, popupSize.width, popupSize.height);
  }

  private Dimension getPopupSize(Object popup) throws Exception {
    GwtState state = getState();
    Object popupElement = state.getUIObjectUtils().getElement(popup);
    return state.getAbsoluteBounds(popupElement).getSize();
  }
View Full Code Here

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

  private static void setPopupPosition(Object popup, int left, int top) throws Exception {
    ReflectionUtils.invokeMethod(popup, "setPopupPosition(int,int)", left, top);
  }

  private void fetchItemBounds() throws Exception {
    GwtState state = getState();
    for (UIObjectInfo item : getAllItems()) {
      Object itemElement = item.getElement();
      Rectangle itemBounds = state.getAbsoluteBounds(itemElement);
      absoluteToRelative(itemBounds);
      item.setBounds(itemBounds);
    }
  }
View Full Code Here

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

    r.width = Math.min(r.width, 3072);
    r.height = Math.min(r.height, 3072);
  }

  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

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

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

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 = getDOMUtils();
    m_widgetHandles.clear();
    // prepare Table body
    Object bodyElement;
    {
      Object panelObject = getObject();
      Object tableElement = state.getUIObjectUtils().getElement(panelObject);
      bodyElement = dom.getChild(tableElement, 0);
    }
    // prepare handle object for each widget
    List<WidgetInfo> widgets = getChildrenWidgets();
    for (int index = 0; index < widgets.size(); index++) {
      WidgetInfo widget = widgets.get(index);
      Object headerElement = dom.getChild(bodyElement, 2 * index + 0);
      // prepare bounds
      Rectangle headerBounds = state.getAbsoluteBounds(headerElement);
      absoluteToRelative(headerBounds);
      // add handle object
      m_widgetHandles.add(new WidgetHandle(widget));
      m_widgetToHandleBounds.put(widget, headerBounds);
    }
View Full Code Here

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

  private void showWidget(WidgetInfo widget) {
    m_stackContainer.setActive(widget);
  }

  public static boolean isVisible(WidgetInfo widget) throws Exception {
    GwtState state = widget.getState();
    Object parentElement = state.getDomUtils().getParent(widget.getElement());
    return state.getAbsoluteBounds(parentElement).height != 0;
  }
View Full Code Here

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

  /**
   * Fills {@link #m_widgetHandles}.
   */
  private void prepareWidgetHandles() throws Exception {
    GwtState state = getState();
    m_widgetHandles.clear();
    //
    List<?> layoutDataList = (List<?>) ReflectionUtils.getFieldObject(getObject(), "layoutData");
    List<WidgetInfo> widgets = getChildrenWidgets();
    for (int index = 0; index < widgets.size(); index++) {
      WidgetInfo widget = widgets.get(index);
      Object headerWidget = ReflectionUtils.getFieldObject(layoutDataList.get(index), "header");
      Object headerElement = state.getUIObjectUtils().getElement(headerWidget);
      // prepare bounds
      Rectangle headerBounds = state.getAbsoluteBounds(headerElement);
      absoluteToRelative(headerBounds);
      // add handle object
      m_widgetHandles.add(new WidgetHandle(widget));
      m_widgetToHandleBounds.put(widget, headerBounds);
    }
View Full Code Here

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

      return m_shared_GWTState.getClassLoader();
    }
    // use same GwtState for same editor
    boolean hasCurrentEditor = GwtEditorLifeCycleListener.hasCurrentEditor();
    if (hasCurrentEditor) {
      GwtState state = GwtEditorLifeCycleListener.getCurrentEditorState();
      if (state != null) {
        editor.putGlobalValue(UIObjectInfo.STATE_KEY, state);
        rememberVariable_isStrictMode(editorState, state);
        state.activate();
        return state.getClassLoader();
      }
    }
    // prepare module
    ModuleDescription moduleDescription = Utils.getSingleModule(modelUnit);
    if (moduleDescription == null) {
      throw new DesignerException(IExceptionConstants.NO_MODULE_FILE);
    }
    // always include standard D2 ClassLoader's
    CompositeClassLoader parentClassLoader;
    {
      parentClassLoader = createClassLoader_parent(editor);
      initializeClassLoader_parent(editor, parentClassLoader);
      // add ClassLoader to use only for loading resources
      {
        ClassLoader resourcesClassLoader = moduleDescription.getClassLoader();
        parentClassLoader.add(resourcesClassLoader, ImmutableList.<String>of(), null);
      }
    }
    // initialize GWTState
    final GwtState state = new GwtState(parentClassLoader, moduleDescription);
    try {
      state.initialize();
      editor.putGlobalValue(UIObjectInfo.STATE_KEY, state);
      rememberVariable_isStrictMode(editorState, state);
    } catch (Throwable e) {
      state.dispose();
      ReflectionUtils.propagate(e);
    }
    // remember shared state
    if (m_sharedUse) {
      state.setShared(true);
      m_shared_GWTState = state;
    }
    // remember editor GwtState
    GwtEditorLifeCycleListener.setCurrentEditorState(state);
    // remember ClassLoader
    ClassLoader gwtClassLoader = state.getClassLoader();
    // validate
    try {
      validate(javaProject, state);
    } catch (Throwable e) {
      state.dispose();
      ReflectionUtils.propagate(e);
    }
    // dispose GWTState during hierarchy dispose
    if (!hasCurrentEditor) {
      editorState.getBroadcast().addListener(null, new ObjectEventListener() {
        @Override
        public void dispose() throws Exception {
          state.dispose();
        }
      });
    }
    // final result
    return gwtClassLoader;
View Full Code Here

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

    GenericProperty property = (GenericProperty) _property;
    JavaInfo javaInfo = property.getJavaInfo();
    Property[] properties = (Property[]) javaInfo.getArbitraryValue(this);
    if (properties == null) {
      Shell shell = Display.getCurrent().getActiveShell();
      GwtState state = getState(javaInfo);
      properties = new Property[2];
      properties[0] = new UrlProperty(shell, property, state);
      properties[1] = new Bundle_Property(shell, property);
      javaInfo.putArbitraryValue(this, properties);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.