Package org.eclipse.wb.internal.core.utils.xml

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


  /**
   * @return the existing or new "header" element of "tab".
   */
  private static DocumentElement getHeaderElement(XmlObjectInfo widget) {
    DocumentElement widgetElement = widget.getElement();
    DocumentElement tabElement = widgetElement.getParent();
    int widgetIndex = tabElement.indexOf(widgetElement);
    if (widgetIndex == 0) {
      String tag = tabElement.getTagNS() + "header";
      DocumentElement headerElement = new DocumentElement(tag);
      tabElement.addChild(headerElement, 0);
      return headerElement;
    } else {
      return tabElement.getChildAt(0);
    }
View Full Code Here


   */
  private void setLocation(WidgetInfo widget, Point location) throws Exception {
    String xString = IntegerConverter.INSTANCE.toSource(this, location.x);
    String yString = IntegerConverter.INSTANCE.toSource(this, location.y);
    //
    DocumentElement positionElement = widget.getElement().getParent();
    positionElement.setAttribute("left", xString);
    positionElement.setAttribute("top", yString);
  }
View Full Code Here

        });
    ReflectionUtils.setField(binder, "dtObjectHandler", handler);
  }

  private void createModel(String path, Object object) throws Exception {
    DocumentElement xmlElement = m_pathToElementMap.get(path);
    XmlObjectInfo objectInfo =
        XmlObjectUtils.createObject(
            m_context,
            object.getClass(),
            new ElementCreationSupport(xmlElement));
View Full Code Here

  /**
   * @return the path of our {@link DocumentElement}.
   */
  public static String getPath(DocumentElement element) {
    DocumentElement parent = element.getParent();
    if (parent == null) {
      return "0";
    } else {
      int index = parent.indexOf(element);
      return getPath(parent) + "/" + index;
    }
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * @return the full name (including namespace) for "field" attribute.
   */
  private String getNameAttribute() {
    DocumentElement rootElement = m_object.getElement().getRoot();
    return rootElement.getTagNS() + "field";
  }
View Full Code Here

  /**
   * @return the {@link DocumentElement}s with "ui:with" tag.
   */
  private List<DocumentElement> getExternalStyleElements() {
    List<DocumentElement> elements = Lists.newArrayList();
    DocumentElement rootElement = m_context.getRootElement();
    String uiName = NamespacesHelper.getName(rootElement, "urn:ui:com.google.gwt.uibinder");
    for (DocumentElement withElement : rootElement.getChildren()) {
      if (withElement.getTag().equals(uiName + ":with")) {
        String field = withElement.getAttribute("field");
        String typeName = withElement.getAttribute("type");
        if (field != null && typeName != null) {
          elements.add(withElement);
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * Creates {@link ContextDescription} for "<ui:style>" element.
   */
  private void createLocalContextDescription() throws Exception {
    DocumentElement styleElement = getLocalStyleElement();
    if (styleElement != null) {
      DocumentTextNode textNode = styleElement.getTextNode();
      String cssSource = textNode != null ? textNode.getRawText() : "";
      IDocument cssDocument = new Document(cssSource);
      CssEditContext cssContext = new CssEditContext(cssDocument);
      ContextDescription contextDescription =
          new UiBinderLocalContextDescription(m_context, styleElement, cssContext);
View Full Code Here

  /**
   * @return the "<ui:style>" element, may be <code>null</code>.
   */
  private DocumentElement getLocalStyleElement() {
    DocumentElement rootElement = m_context.getRootElement();
    String uiName = NamespacesHelper.getName(rootElement, "urn:ui:com.google.gwt.uibinder");
    return rootElement.getChild(uiName + ":style", true);
  }
View Full Code Here

  /**
   * @return the {@link Position} to which given child is bound, may be <code>null</code>.
   */
  private Position getPosition(WidgetInfo widget, WidgetInfo child) throws Exception {
    Map<String, Position> tagToPosition = getPositions(widget);
    DocumentElement childElementParent = child.getElement().getParent();
    String tag = childElementParent.getTagLocal();
    return tagToPosition.get(tag);
  }
View Full Code Here

    }

    private List<WidgetInfo> getWidgets() {
      List<WidgetInfo> widgets = Lists.newArrayList();
      for (WidgetInfo child : m_widget.getChildren(WidgetInfo.class)) {
        DocumentElement childElementParent = child.getElement().getParent();
        String tag = childElementParent.getTagLocal();
        String positionTag = m_description.getTag();
        if (tag.equals(positionTag)) {
          widgets.add(child);
        }
      }
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.utils.xml.DocumentElement

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.