Examples of DocumentElement


Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

    }
    return null;
  }

  public void setSize(WidgetInfo widget, double size) throws Exception {
    DocumentElement dockElement = widget.getElement().getParent();
    String sizeString = SIZE_FORMAT.format(size);
    dockElement.setAttribute("size", sizeString);
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

      return getValue() != UNKNOWN_VALUE;
    }

    @Override
    public Object getValue() throws Exception {
      DocumentElement headerElement = getHeaderElement(false);
      if (headerElement == null) {
        return UNKNOWN_VALUE;
      }
      return headerElement.getTextNode().getText();
    }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

      return headerElement.getTextNode().getText();
    }

    @Override
    protected void setValueEx(Object value) throws Exception {
      DocumentElement headerElement = getHeaderElement(true);
      if (value instanceof String) {
        String text = (String) value;
        headerElement.setText(text, false);
      } else {
        headerElement.remove();
      }
    }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

        headerElement.remove();
      }
    }

    private DocumentElement getHeaderElement(boolean ensure) {
      DocumentElement element = getElement();
      String tag = element.getTagNS() + "header";
      DocumentElement headerElement = element.getChild(tag, false);
      if (headerElement == null && ensure) {
        headerElement = new DocumentElement(tag);
        element.addChild(headerElement, 0);
      }
      return headerElement;
    }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

  /**
   * @return the name of direction.
   */
  private static String getDirection(WidgetInfo widget) {
    DocumentElement dockElement = widget.getElement().getParent();
    return dockElement.getAttribute("direction");
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

    DocumentElement dockElement = widget.getElement().getParent();
    return dockElement.getAttribute("direction");
  }

  public void setDirection(WidgetInfo widget, String direction) throws Exception {
    DocumentElement dockElement = widget.getElement().getParent();
    dockElement.setAttribute("direction", direction);
    ExecutionUtils.refresh(this);
  }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

    LocationValue size;
  }

  private Location getLocation(WidgetInfo widget, boolean horizontal) {
    UiBinderContext context = widget.getContext();
    DocumentElement layerElement = widget.getElement().getParent();
    Location location = new Location();
    location.layer = layerElement;
    if (horizontal) {
      location.leading = getLocationValue(context, layerElement, "left");
      location.trailing = getLocationValue(context, layerElement, "right");
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

    ExecutionUtils.refresh(this);
  }

  private void command_LOCATION_X(WidgetInfo widget, int x) throws Exception {
    Location location = getLocation(widget, true);
    DocumentElement layer = location.layer;
    // LeftWidth
    if (location.leading != null && location.size != null) {
      setPixels(location.leading, x);
      return;
    }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

    }
  }

  private void command_LOCATION_Y(WidgetInfo widget, int y) throws Exception {
    Location location = getLocation(widget, false);
    DocumentElement layer = location.layer;
    // TopHeight
    if (location.leading != null && location.size != null) {
      setPixels(location.leading, y);
      return;
    }
View Full Code Here

Examples of org.eclipse.wb.internal.core.utils.xml.DocumentElement

  }

  private void command_SIZE_X(WidgetInfo widget, int width, ResizeDirection direction)
      throws Exception {
    Location location = getLocation(widget, true);
    DocumentElement layer = location.layer;
    Rectangle bounds = widget.getBounds();
    // LeftWidth
    if (location.leading != null && location.size != null) {
      if (direction == ResizeDirection.LEADING) {
        int oldLeft = bounds.left();
        int deltaWidth = width - bounds.width;
        int left = oldLeft - deltaWidth;
        setPixels(location.leading, left);
      }
      setPixels(location.size, width);
      return;
    }
    // RightWidth
    if (location.trailing != null && location.size != null) {
      if (direction == ResizeDirection.TRAILING) {
        int oldRight = getBounds().width - bounds.right();
        int deltaWidth = width - bounds.width;
        int right = oldRight - deltaWidth;
        setPixels(location.trailing, right);
      }
      setPixels(location.size, width);
      return;
    }
    // LeftRight
    if (location.leading != null && location.trailing != null) {
      if (direction == ResizeDirection.LEADING) {
        int oldLeft = bounds.left();
        int deltaWidth = width - bounds.width;
        int left = oldLeft - deltaWidth;
        setPixels(location.leading, left);
      }
      if (direction == ResizeDirection.TRAILING) {
        int oldRight = getBounds().width - bounds.right();
        int deltaWidth = width - bounds.width;
        int right = oldRight - deltaWidth;
        setPixels(location.trailing, right);
      }
      return;
    }
    // new, use LeftWidth
    if (direction == ResizeDirection.TRAILING) {
      layer.setAttribute("left", "0px");
      layer.setAttribute("width", width + "px");
    }
  }
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.