示例#1
0
  private void render() {

    getElement().setClassName(appearance.css().menuItemClass());
    getElement().addClassName("appkit-menu-item");
    getElement().setAttribute("role", "menuitem");
    getElement().setTabIndex(0);

    titleElement = DOM.createDiv();
    titleElement.setClassName(appearance.css().menuItemTitleClass());
    getElement().appendChild(titleElement);

    accessoryElement = DOM.createDiv();
    accessoryElement.setClassName(appearance.css().menuItemAccessoryClass());
    getElement().appendChild(accessoryElement);

    markerElement = DOM.createDiv();
    markerElement.setClassName(appearance.css().menuItemMarkerClass());
    getElement().appendChild(markerElement);

    subMenuVisible = false;

    sinkEvents(
        Event.ONMOUSEDOWN
            | Event.ONTOUCHSTART
            | Event.ONTOUCHEND
            | Event.ONMOUSEOVER
            | Event.ONMOUSEOUT
            | Event.ONCLICK);
  }
示例#2
0
  /**
   * Use this constructor when the rootElement is already a valid taggedEntity.
   *
   * @param root
   */
  public TaggedEntity(Element root) {
    assert root != null;
    this.rootElement = root;

    if (getLemma().isEmpty()) setLemma(getText());
    root.setDraggable(Element.DRAGGABLE_TRUE);
    root.setClassName("nerve-taggedEntity");
  }
示例#3
0
文件: TopBar.java 项目: nublic/Nublic
  public TopBar() {
    initWidget(uiBinder.createAndBindUi(this));
    elementsInPrimaryTab = new HashMap<String, Element>();
    elementsInSecondaryTab = new HashMap<String, Element>();
    mapTextsInPrimaryTab = new HashMap<String, String>();
    mapTextsInSecondaryTab = new HashMap<String, String>();
    textsInPrimaryTab = new ArrayList<String>();
    textsInSecondaryTab = new ArrayList<String>();

    // Create hierarchy of elements
    Element top = DOM.createDiv();
    top.setClassName("navbar");
    top.addClassName("navbar-fixed-top");
    Element topInner = DOM.createDiv();
    topInner.setClassName("navbar-inner");
    Element containerInner = DOM.createDiv();
    containerInner.addClassName("container-fluid");
    topInner.appendChild(containerInner);
    top.appendChild(topInner);
    // Create title
    Element titleAnchor = DOM.createAnchor();
    titleAnchor.addClassName("brand");
    titleAnchor.setAttribute("style", "height: 16px; margin-top: -5px;");
    titleAnchor.setAttribute("href", "#welcome");
    Element logoImage = DOM.createImg();
    logoImage.setAttribute("src", "images/logo.png");
    titleAnchor.appendChild(logoImage);
    // titleAnchor.setInnerText("Nublic");
    containerInner.appendChild(titleAnchor);
    // Primary navigation
    primaryNav = DOM.createElement("ul");
    primaryNav.setClassName("nav");
    containerInner.appendChild(primaryNav);
    // Separation
    /* Element separation = DOM.createDiv();
    separation.setClassName("pull-left");
    containerInner.appendChild(separation);*/
    // Secondary navigation
    secondaryNav = DOM.createElement("ul");
    secondaryNav.setClassName("nav");
    secondaryNav.addClassName("secondary-nav");
    secondaryNav.addClassName("pull-right");
    containerInner.appendChild(secondaryNav);

    root.getElement().appendChild(top);
  }
示例#4
0
 /**
  * Creates an editor.
  *
  * @return New Editor instance
  */
 public static Editor create() {
   Element e = Document.get().createDivElement();
   e.setClassName("editor");
   return UserAgent.isMobileWebkit()
       ? // \u2620
       new EditorImplWebkitMobile(true, e)
       : new EditorImpl(true, e);
 }
示例#5
0
  public void addTab(String text) {
    Element button = DOM.createDiv();

    button.setClassName(getStylePrimaryName() + "-Item");

    button.setInnerText(text);

    getElement().insertBefore(button, clear);
  }
示例#6
0
  /**
   * When enabled, the background will be blocked with a semi-transparent pane the next time it is
   * shown. If the PopupPanel is already visible, the glass will not be displayed until it is hidden
   * and shown again.
   *
   * @param enabled true to enable, false to disable
   */
  public void setGlassEnabled(boolean enabled) {
    this.isGlassEnabled = enabled;
    if (enabled && glass == null) {
      glass = Document.get().createDivElement();
      glass.setClassName(glassStyleName);

      glass.getStyle().setPosition(Position.ABSOLUTE);
      glass.getStyle().setLeft(0, Unit.PX);
      glass.getStyle().setTop(0, Unit.PX);
    }
  }
示例#7
0
  protected void updateStyleNames(String styleName, boolean isPrimaryStyleName) {

    feedbackPopup.removeStyleName(getStylePrimaryName() + "-feedback");
    removeStyleName(getStylePrimaryName() + "-vertical");

    if (isPrimaryStyleName) {
      super.setStylePrimaryName(styleName);
    } else {
      super.setStyleName(styleName);
    }

    feedbackPopup.addStyleName(getStylePrimaryName() + "-feedback");
    base.setClassName(getStylePrimaryName() + "-base");
    handle.setClassName(getStylePrimaryName() + "-handle");
    smaller.setClassName(getStylePrimaryName() + "-smaller");
    bigger.setClassName(getStylePrimaryName() + "-bigger");

    if (isVertical()) {
      addStyleName(getStylePrimaryName() + "-vertical");
    }
  }
示例#8
0
  private void processHandleEvent(Event event) {
    switch (DOM.eventGetType(event)) {
      case Event.ONMOUSEDOWN:
      case Event.ONTOUCHSTART:
        if (!disabled && !readonly) {
          focus();
          feedbackPopup.show();
          dragging = true;
          handle.setClassName(getStylePrimaryName() + "-handle");
          handle.addClassName(getStylePrimaryName() + "-handle-active");

          DOM.setCapture(getElement());
          DOM.eventPreventDefault(event); // prevent selecting text
          DOM.eventCancelBubble(event, true);
          event.stopPropagation();
        }
        break;
      case Event.ONMOUSEMOVE:
      case Event.ONTOUCHMOVE:
        if (dragging) {
          setValueByEvent(event, false);
          updateFeedbackPosition();
          event.stopPropagation();
        }
        break;
      case Event.ONTOUCHEND:
        feedbackPopup.hide();
      case Event.ONMOUSEUP:
        // feedbackPopup.hide();
        dragging = false;
        handle.setClassName(getStylePrimaryName() + "-handle");
        DOM.releaseCapture(getElement());
        setValueByEvent(event, true);
        event.stopPropagation();
        break;
      default:
        break;
    }
  }
示例#9
0
  @Override
  public void render(Element element) {

    setTabIndex(0);

    element.setAttribute("role", "slider");

    range = DOM.createDiv();
    range.setClassName(APPEARANCE.css().vSliderRange());

    getElement().appendChild(range);

    addView(handle);
  }
示例#10
0
 @Override
 public void visitTag(Tag tag) {
   Element e = Document.get().createElement(tag.getTagName());
   map.put(tag, e);
   for (Object o : tag.getAttributesEx()) {
     Attribute a = (Attribute) o;
     if ("id".equalsIgnoreCase(a.getName())) {
       e.setId(a.getValue());
     } else if ("style".equalsIgnoreCase(a.getName())) {
       processStyle(e, a.getValue());
     } else if ("class".equalsIgnoreCase(a.getName())) {
       e.setClassName(a.getValue());
     } else if (!a.isEmpty() && !a.isWhitespace() && a.isValued()) {
       e.setAttribute(a.getName(), a.getValue());
     }
   }
   Element parent = getParent(tag.getParent());
   parent.appendChild(e);
 }
  public NetworkTimeLineDetailView(
      Container parent, NetworkVisualization viz, NetworkTimeLineDetailView.Resources resources) {
    super(parent, viz);
    this.resources = resources;
    NetworkTimeLineDetailView.Css css = resources.networkTimeLineDetailViewCss();
    Element elem = getElement();
    elem.setClassName(css.resourcePanel());
    elem.getStyle().setProperty("backgroundPosition", Constants.GRAPH_PIXEL_OFFSET + "px 0");
    displayed = new ArrayList<ResourceRow>();
    DocumentExt document = elem.getOwnerDocument().cast();
    Element contentWrapper = document.createDivWithClassName(css.contentWrapper());
    Element contentElement = document.createDivWithClassName(css.content());
    contentWrapper.appendChild(contentElement);
    contentContainer = new DefaultContainerImpl(contentElement);

    // nice border going the height of the element
    Element filler = document.createDivWithClassName(css.heightFiller());
    filler.getStyle().setPropertyPx("width", Constants.GRAPH_PIXEL_OFFSET);

    elem.appendChild(filler);
    elem.appendChild(contentWrapper);

    ResizeEvent.addResizeListener(this, Window.get(), this);
  }
示例#12
0
 private void setStyleHovered(Element tr) {
   tr.setClassName(POPUP_RESOURCES.popup().popupMenuItemOver());
 }
示例#13
0
 /**
  * Sets the style name to be used on the glass element. By default, this is "gwt-PopupPanelGlass".
  *
  * @param glassStyleName the glass element's style name
  */
 public void setGlassStyleName(String glassStyleName) {
   this.glassStyleName = glassStyleName;
   if (glass != null) {
     glass.setClassName(glassStyleName);
   }
 }