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

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


  // Editing
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  protected void openDialog(Property property) throws Exception {
    GwtState state = getGWTState(property);
    ImageSelectionDialog dialog =
        new ImageSelectionDialog(getParentShell(),
            state.getResourcesProvider(),
            state.getModuleDescription(),
            property.getTitle());
    if (dialog.open() == Window.OK) {
      String resourcePath = dialog.getSelectedResourcePath();
      property.setValue(resourcePath);
    }
View Full Code Here


    super.setJavaInfo(javaInfo);
    // evaluation
    m_javaInfo.addBroadcastListener(new JavaInfosetObjectBefore() {
      public void invoke(JavaInfo target, Object[] objectRef) throws Exception {
        if (target == m_javaInfo) {
          GwtState state = ((RootPanelInfo) m_javaInfo).getState();
          objectRef[0] = state.getUIObjectUtils().getRootPanel();
        }
      }
    });
  }
View Full Code Here

  /**
   * Fills {@link #m_widgetHandles}.
   */
  private void prepareWidgetHandles() throws Exception {
    GwtState state = getState();
    DOMUtils dom = state.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

  public 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.getDOMElement());
    return state.getAbsoluteBounds(parentElement).height != 0;
  }
View Full Code Here

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

    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

  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.getDOMElement();
      Rectangle itemBounds = state.getAbsoluteBounds(itemElement);
      absoluteToRelative(itemBounds);
      item.setBounds(itemBounds);
    }
  }
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 = getWidgetIndex(widget);
      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

  /**
   * Fetch cells information.
   */
  private void fetchCells() throws Exception {
    GwtState state = getState();
    DOMUtils dom = getDOMUtils();
    m_widgetToCells.clear();
    // prepare map: Element -> Widget_Info
    Map<Object, WidgetInfo> elementToWidgetMap = Maps.newHashMap();
    for (WidgetInfo widget : getChildrenWidgets()) {
      Object widgetObject = widget.getObject();
      Object widgetElement = state.getUIObjectUtils().getElement(widgetObject);
      elementToWidgetMap.put(widgetElement, widget);
    }
    // prepare cells used by each Widget_Info
    m_columnIntervals = new Interval[m_status.getColumnCount()];
    m_rowIntervals = new Interval[m_status.getRowCount()];
    Map<Interval, Interval> spannedColumnIntervals = Maps.newHashMap();
    Map<Interval, Interval> spannedRowIntervals = Maps.newHashMap();
    for (int row = 0; row < m_status.getRowCount(); row++) {
      for (int cell = 0, column = 0; column < m_status.getColumnCount(); cell++) {
        // FlexTableHelper may remove cells in row below spanned
        if (!m_status.isExistingCell(row, cell)) {
          column++;
          continue;
        }
        // prepare cell information
        int fixedCell = m_status.fixCellAfterRowSpan(row, cell);
        Object td = m_status.getElement(row, fixedCell);
        int colSpan = m_status.getColSpan(row, cell);
        int rowSpan = m_status.getRowSpan(row, cell);
        // remember widget cells
        if (dom.getChildCount(td) == 1) {
          Object tdChild = dom.getChild(td, 0);
          tdChild = dom.unwrapElement(tdChild);
          WidgetInfo widget = elementToWidgetMap.get(tdChild);
          if (widget != null) {
            m_widgetToCells.put(widget, new Rectangle(column, row, colSpan, rowSpan));
          }
        }
        // prepare row interval
        if (m_rowIntervals[row] == null) {
          Object trElement = dom.getParent(td);
          Rectangle trBounds = state.getAbsoluteBounds(trElement);
          absoluteToRelative(trBounds);
          Interval trInterval = new Interval(trBounds.y, trBounds.height);
          if (rowSpan == 1) {
            m_rowIntervals[row] = trInterval;
          } else {
            Rectangle tdBounds = state.getAbsoluteBounds(td);
            Interval spannedInterval = new Interval(trBounds.y, tdBounds.height);
            spannedRowIntervals.put(new Interval(row, rowSpan), spannedInterval);
          }
        }
        // prepare column interval
        if (m_columnIntervals[column] == null) {
          Rectangle tdBounds = state.getAbsoluteBounds(td);
          absoluteToRelative(tdBounds);
          Interval columnInterval = new Interval(tdBounds.x, tdBounds.width);
          if (colSpan == 1) {
            m_columnIntervals[column] = columnInterval;
          } else {
View Full Code Here

  @Override
  public void refresh_dispose() throws Exception {
    // remember Object & State
    Object object = getObject();
    GwtState state = getState();
    // dispose children
    super.refresh_dispose();
    // destroy object after all disposed
    if (object != null && !isPlaceholder() && state != null && !state.isDisposed()) {
      SmartClientUtils.destroyDataSource(object);
    }
  }
View Full Code Here

TOP

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

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.