Examples of DocumentElement


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

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

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

        });
    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

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

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

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

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

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

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

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

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

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

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

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

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

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

    }

    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

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

          WidgetInfo widget = (WidgetInfo) object;
          // reorder, use same "position" element
          {
            Position position = getPosition(m_widget, widget);
            if (position == Position.this) {
              DocumentElement targetElement = target.getElement();
              int targetIndex = target.getIndex();
              targetElement.moveChild(object.getElement().getParent(), targetIndex);
              return;
            }
          }
          // create new "position" element
          target = prepareTarget(target);
          super.move(object, target, oldParent, newParent);
        }

        private ElementTarget prepareTarget(ElementTarget target) {
          // prepare "position" element
          String tag = m_widget.getElement().getTagNS() + m_description.getTag();
          DocumentElement positionElement = new DocumentElement(tag);
          // add "position" element
          DocumentElement targetElement = target.getElement();
          int targetIndex = target.getIndex();
          targetElement.addChild(positionElement, targetIndex);
          // prepare new target
          return new ElementTarget(positionElement, 0);
        }
      };
    }
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.