com.google.gwt.dom.client.Style.Display Java Examples

The following examples show how to use com.google.gwt.dom.client.Style.Display. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InputDatePicker.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void redrawMonthPicker() {
	this.monthPicker.getStyle().setWidth(this.calendarTable.getClientWidth(), Unit.PX);
	this.calendarTable.getStyle().setDisplay(Display.NONE);
	this.monthPicker.getStyle().clearDisplay();

	int currentYear = this.cursor.getYear() + InputDatePicker.YEAR_OFFSET;
	if (this.monthPickerInner.getChildCount() == 0) {
		for (int year = currentYear - 100; year < currentYear + 100; year++) {
			DivElement yearDiv = Document.get().createDivElement();
			yearDiv.setInnerText(String.valueOf(year));
			StyleUtils.addStyle(yearDiv, InputDatePicker.STYLE_YEAR_BUTTON);
			Event.sinkEvents(yearDiv, Event.ONCLICK);
			this.monthPickerInner.appendChild(yearDiv);
			yearDiv.setAttribute(InputDatePicker.ATTRIBUTE_DATA_YEAR, String.valueOf(year));
		}
	}
	this.openMonthOfYear(this.cursor.getYear() + InputDatePicker.YEAR_OFFSET);
}
 
Example #2
Source File: SuggestionButton.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
public SuggestionButton(final ContentElement element) {
  Widget clickButton =
      ButtonFactory.createIconClickButton(IconButtonStyle.LIGHTBULB, TOOLTIP,
      new ClickButtonListener() {
        @Override
        public void onClick() {
          HasSuggestions suggestion =
              element.getProperty(SuggestionRenderer.HAS_SUGGESTIONS_PROP);
          element.getSuggestionsManager().showSuggestionsFor(suggestion);
        }
      });
  clickButton.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
  // Logically attach it to the root panel to listen to events, but then
  // manually move the dom to the desired location.
  RootPanel.get().add(clickButton);
  this.element = clickButton.getElement();
  NodeManager.setTransparency(this.element, Skip.DEEP);
  DomHelper.makeUnselectable(this.element);
  this.element.setAttribute("contentEditable", "false");
}
 
Example #3
Source File: SuggestionButton.java    From swellrt with Apache License 2.0 6 votes vote down vote up
public SuggestionButton(final ContentElement element) {
  Widget clickButton =
      ButtonFactory.createIconClickButton(IconButtonStyle.LIGHTBULB, TOOLTIP,
      new ClickButtonListener() {
        @Override
        public void onClick() {
          HasSuggestions suggestion =
              element.getProperty(SuggestionRenderer.HAS_SUGGESTIONS_PROP);
          element.getSuggestionsManager().showSuggestionsFor(suggestion);
        }
      });
  clickButton.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
  // Logically attach it to the root panel to listen to events, but then
  // manually move the dom to the desired location.
  RootPanel.get().add(clickButton);
  this.element = clickButton.getElement();
  NodeManager.setTransparency(this.element, Skip.DEEP);
  DomHelper.makeUnselectable(this.element);
  this.element.setAttribute("contentEditable", "false");
}
 
Example #4
Source File: FullStructure.java    From swellrt with Apache License 2.0 6 votes vote down vote up
@Override
public ParticipantView append(
    ParticipantsDomImpl impl, Conversation conv, ParticipantId participant) {
  Element t = getRenderer().render(conv, participant);
  DomViewHelper.attachBefore(impl.getParticipantContainer(), impl.getSimpleMenu(), t);
  // Kick Webkit, because of its incremental layout bugs.
  if (UserAgent.isWebkit()) {

    String oldDisplay = impl.getElement().getStyle().getDisplay();

    // Erase layout. Querying getOffsetParent() forces layout.
    impl.getElement().getStyle().setDisplay(Display.NONE);
    impl.getElement().getOffsetParent();

    // Restore layout.
    impl.getElement().getStyle().setProperty("display", oldDisplay);
  }
  return asParticipant(t);
}
 
Example #5
Source File: CollapsibleDomImpl.java    From swellrt with Apache License 2.0 6 votes vote down vote up
public void setCollapsed(boolean collapsed) {
  if (collapsed) {
    self.setAttribute(COLLAPSED_ATTRIBUTE, COLLAPSED_VALUE);

    // Webkit's incremental layout is incorrect, so we have to kick it a bit.
    if (UserAgent.isWebkit()) {
      self.getStyle().setDisplay(Display.INLINE_BLOCK);
      // Force layout.
      self.getOffsetParent();
      // Revert to CSS display property (layed out correctly now).
      self.getStyle().clearDisplay();
    }
  } else {
    self.removeAttribute("c");
  }
  updatedCssClassNames();
}
 
Example #6
Source File: FullStructure.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
@Override
public ParticipantView append(
    ParticipantsDomImpl impl, Conversation conv, ParticipantId participant) {
  Element t = getRenderer().render(conv, participant);
  DomViewHelper.attachBefore(impl.getParticipantContainer(), impl.getSimpleMenu(), t);
  // Kick Webkit, because of its incremental layout bugs.
  if (UserAgent.isWebkit()) {

    String oldDisplay = impl.getElement().getStyle().getDisplay();

    // Erase layout. Querying getOffsetParent() forces layout.
    impl.getElement().getStyle().setDisplay(Display.NONE);
    impl.getElement().getOffsetParent();

    // Restore layout.
    impl.getElement().getStyle().setProperty("display", oldDisplay);
  }
  return asParticipant(t);
}
 
Example #7
Source File: CollapsibleDomImpl.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
public void setCollapsed(boolean collapsed) {
  if (collapsed) {
    self.setAttribute(COLLAPSED_ATTRIBUTE, COLLAPSED_VALUE);

    // Webkit's incremental layout is incorrect, so we have to kick it a bit.
    if (UserAgent.isWebkit()) {
      self.getStyle().setDisplay(Display.INLINE_BLOCK);
      // Force layout.
      self.getOffsetParent();
      // Revert to CSS display property (layed out correctly now).
      self.getStyle().clearDisplay();
    }
  } else {
    self.removeAttribute("c");
  }
  updatedCssClassNames();
}
 
Example #8
Source File: MaterialCutOut.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
/**
 * Closes the cut out.
 *
 * @param autoClosed Notifies with the dialog was auto closed or closed by user action
 */
public void close(boolean autoClosed) {
    //restore the old overflow of the page
    Document.get().getDocumentElement().getStyle().setProperty("overflow", viewportOverflow);

    getElement().getStyle().setDisplay(Display.NONE);

    getHandlerRegistry().clearHandlers();

    // if the component added himself to the document, it must remove
    // himself too
    if (autoAddedToDocument) {
        this.removeFromParent();
        autoAddedToDocument = false;
    }
    CloseEvent.fire(this, this, autoClosed);
}
 
Example #9
Source File: GanttWidget.java    From gantt with Apache License 2.0 6 votes vote down vote up
private void updateMoveElementFor(Element target) {
    if (target == null) {
        moveElement.getStyle().setDisplay(Display.NONE);
    }
    moveElement.getStyle().clearDisplay();

    String styleLeft = target.getStyle().getLeft();
    // user capturePointLeftPx as default
    double left = capturePointLeftPx;
    if (styleLeft != null && styleLeft.length() > 2 && styleLeft.endsWith("px")) {
        // if target's 'left' is pixel value like '123px', use that.
        // When target is already moved, then it's using pixel values. If
        // it's not moved yet, it may use percentage value.
        left = parseSize(styleLeft, "px");
    }
    if (isSubBar(target)) {
        left += target.getParentElement().getOffsetLeft();
    }
    moveElement.getStyle().setProperty("left", left + "px");
    moveElement.getStyle().setProperty("width", target.getClientWidth() + "px");
}
 
Example #10
Source File: VSliderPanel.java    From vaadin-sliderpanel with MIT License 6 votes vote down vote up
@Override
protected void onStart() {
    VSliderPanel.this.contentNode.getStyle()
                                 .setDisplay(Display.BLOCK);
    if (VSliderPanel.this.componentSize == null || VSliderPanel.this.componentSize <= 0) {
        if (VSliderPanel.this.mode.isVertical()) {
            VSliderPanel.this.contentNode.getStyle()
                                         .clearWidth();
            if (VSliderPanel.this.contentNode.getFirstChildElement() != null) {
                VSliderPanel.this.componentSize = VSliderPanel.this.contentNode.getFirstChildElement()
                                                                               .getOffsetWidth();
            }
        }
        else {
            VSliderPanel.this.contentNode.getStyle()
                                         .clearHeight();
            if (VSliderPanel.this.contentNode.getFirstChildElement() != null) {
                VSliderPanel.this.componentSize = VSliderPanel.this.contentNode.getFirstChildElement()
                                                                               .getOffsetHeight();
            }
        }
    }
}
 
Example #11
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
/**
 * Should paging be enabled. If paging is enabled then only a certain
 * amount of items are visible at a time and a scrollbar or buttons are
 * visible to change page. If paging is turned of then all options are
 * rendered into the popup menu.
 *
 * @param paging
 *            Should the paging be turned on?
 */
public void setPagingEnabled(boolean paging) {
	debug("VComboBoxMultiselect.SP: setPagingEnabled(" + paging + ")");
	if (this.isPagingEnabled == paging) {
		return;
	}
	if (paging) {
		this.down.getStyle()
			.clearDisplay();
		this.up.getStyle()
			.clearDisplay();
		this.status.getStyle()
			.clearDisplay();
	} else {
		this.down.getStyle()
			.setDisplay(Display.NONE);
		this.up.getStyle()
			.setDisplay(Display.NONE);
		this.status.getStyle()
			.setDisplay(Display.NONE);
	}
	this.isPagingEnabled = paging;
}
 
Example #12
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
/**
 * Should paging be enabled. If paging is enabled then only a certain
 * amount of items are visible at a time and a scrollbar or buttons are
 * visible to change page. If paging is turned of then all options are
 * rendered into the popup menu.
 *
 * @param paging
 *            Should the paging be turned on?
 */
public void setPagingEnabled(boolean paging) {
	debug("VComboBoxMultiselect.SP: setPagingEnabled(" + paging + ")");
	if (this.isPagingEnabled == paging) {
		return;
	}
	if (paging) {
		this.down.getStyle()
			.clearDisplay();
		this.up.getStyle()
			.clearDisplay();
		this.status.getStyle()
			.clearDisplay();
	} else {
		this.down.getStyle()
			.setDisplay(Display.NONE);
		this.up.getStyle()
			.setDisplay(Display.NONE);
		this.status.getStyle()
			.setDisplay(Display.NONE);
	}
	this.isPagingEnabled = paging;
}
 
Example #13
Source File: Modal.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void show() {
	this.ensureDismissButton();
	this.redraw();
	this.visible = true;

	Widget modal = getContainerWidget();

	if (modal.isAttached()) {
		modal.removeFromParent();
	}

	Modal.MODAL_BACKDROP.show();
	this.getElement().getStyle().setDisplay(Display.BLOCK);
	RootPanel rootPanel = RootPanel.get();
	rootPanel.add(modal);
	StyleUtils.addStyle(rootPanel, Modal.STYLE_MODAL_OPEN);

	Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
		@Override
		public boolean execute() {
			StyleUtils.addStyle(Modal.this, Modal.STYLE_VISIBLE);
			return false;
		}
	}, 150);
}
 
Example #14
Source File: DescribeGrid.java    From EasyML with Apache License 2.0 6 votes vote down vote up
public DescribeGrid(String[][] labarr, String type) {
	categoryPanel = new CategoryPanel(type);
	categoryPanel.hide();
	mask.addStyleName("alertBack");
	mask.getElement().getStyle().setDisplay(Display.NONE);
	this.add(mask);

	this.setStyleName("bda-descgrid");
	this.labarr = labarr;
	this.type = type;
	this.add(leftPanel);
	this.add(rightPanel);
	leftPanel.setStyleName("bda-descgrid-left");
	rightPanel.setStyleName("bda-descgrid-right");
	init();
}
 
Example #15
Source File: DemoUtils.java    From gwt-ol with Apache License 2.0 6 votes vote down vote up
/**
 * Create a MapBox logo.
 *
 * @return MapBox logo
 */
public static Control createMapboxLogo() {

    ControlOptions controlOptions = new ControlOptions();

    LinkElement mapboxLogo = Document.get().createLinkElement();
    mapboxLogo.setHref("https://mapbox.com/about/maps");
    mapboxLogo.setTarget("_blank");

    mapboxLogo.getStyle().setPosition(Position.ABSOLUTE);
    mapboxLogo.getStyle().setLeft(2, Unit.PX);
    mapboxLogo.getStyle().setBottom(5, Unit.PX);
    mapboxLogo.getStyle().setWidth(126, Unit.PX);
    mapboxLogo.getStyle().setHeight(40, Unit.PX);
    mapboxLogo.getStyle().setDisplay(Display.BLOCK);
    mapboxLogo.getStyle().setOverflow(Overflow.HIDDEN);

    mapboxLogo.getStyle().setBackgroundImage("url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAAoCAMAAAAFWtJHAAAAwFBMVEUAAAAAAAAAAABtbW0AAAAAAAAAAAAAAAAAAAAAAAClpaUAAADp6ekAAAD5+fna2toAAAAMDAzv7+/Nzc0AAAA2Njb8/Pz9/f3T09MAAAAAAAD7+/sAAAArKyuxsbH39/fs7OwbGxuIiIjz8/N8fHyenp7u7u74+PgAAAC8vLxWVlbx8fF1dXXl5eVcXFyUlJTQ0NDFxcVCQkLAwMC4uLj19fXo6OjW1tarq6ve3t77+/vi4uL6+vrKysrNzc3///8w7gSSAAAAP3RSTlMAOQNdPSYBPywKexLLGPCxNEHXnzFL+v2nGwf1IEiE6dBFad9jd9PuLo1V2mDDV3Cjl06SiuXIq4C3973ym6BQMVUPAAAEXElEQVR4Ae2WCVP6OBiH05L0l1IqrVbkKHJ54I0oHn+PfP9vtUle0z/YdhbH2XVnd58ZnRJIeHiPJOx//mH4vQSAN+8FjAhFxgHIaPvJeZ99hxwEElon5iAQbj85Y98g8ODwjEOMAvGFyeE3FEKgodTBqj0BJGN9DhyNd5Ta3ean9QEopfaA+LsKhnEKRExqg4FSP6Og7oEkAjBWnxSCgBX4xF+kcLoPcOBQrSv0e5kH7s1j37jECQieCTPiFGxL5VHw2zQWCeeJiPt6kjRQw0XSkIdVChf67xGa4alSnZlT6HEQ8CK9ANbhvXUF9xlDkBfTuHDWScgC9+z5FQpPI12TlwC6+sV7ixR8CUMKiwjm2GQeOQWHMGuHGdbnObJAwCEqFJpNU5H6uaPUaEIKiQfg+PHk1+u4OwW9PlWW2ctbA4BHCtp+cNK+H8Jos4gDmC5ar4Nx9waaG/2B13NgDqS7+vm2RgEtEws82P+kwIHhs/pgkQKcFIhfd7CogtGNjYMHTLpurD0ERbYFw4JaD3GlQuNAL/JEsSAF4HqlCnaHACk4WhOn4OgCkMD5hSpYNYDJTD8Y46n+jsE1kPhVCuR6QBXhFK7MUOu9O6b1SWF3b+/9ZVWMGOlu93E8UDaAhgc7bfH+0DHqKXCkHzoNDFfU+zxiVQrUC9QXTuHYtKpN59OA3IxCG4b7jh6ZFuVockaNTW09mkJzOaPU49a6mE9cAchZpQJNpUWcwgV9r6FJswsFKrITp2B5pMBMdnS0z2HZNy2+BNKxSZxZfglkrFYBJxQnpzA5sN/HheR2aFQoZBLAi149dQoyAYYjW0hHlHguBAdMcR0DuDZ5omevX6+AI8qcU7ikKT3GBHCnXwydgmCC0tRwCnGQ2Wp6Be71yNIWfQSkOl9vAI1SBCNWrwC01RROgX7BuT2HI4r7tFAw086p/NwZEdOEa7R1uAFuNmQPuKAEAjYNQ0CyeoUEWHYBnpQVQgpvc0Ph+gsKlAnKg1+vEHsw5LKciLKCAJobiWBzYFGbCKpHqkZZrxBFHEASyFI59vJPCskcwNVGOWZAOqsrR+pKbaNeAMT1CixMEtlnsqopNxUMzVJT3tY35aXZm6a6Y9QhwMN6BUJWbE1lhbMO1WehkO7poO0sK7em9MJGxp1XSbC1gtugzzSLQmGsX7VntJGSwsPZ2d2z3bIPKzdoOp3Wzqt8G4XyMVUoFIxLx1S7+piaHtCvR3FeRVsq0GFdp9C5TbGpcNqsPqyHKxcfd14h21KhuLKUFU4f3osrC7F6uV3WXFnadL7wyAPeKDXw2RoJCO5GY4DouYvb/gepVXheLoewzPseQG9N/vzilrMIjoStE3++zvle4eSurw7XEe76ynI4aq+v7lEyt1x5awiFlFLQbHKIpabnM3eJLym4Szzzc/du7SU+zOXv9UNpECH7IoH/gecURPlN9vdQpeD47yhIFNX0U0QgvID9nENm+yxk/xb+AGAjNfRZuk9qAAAAAElFTkSuQmCC)");

    controlOptions.setElement(mapboxLogo);

    return new Control(controlOptions);
}
 
Example #16
Source File: ImageThumbnailWidget.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
public void execute() {
  Style style = menuButtonContainer.getElement().getStyle();
  if (resizeButtonVisible) {
    style.setDisplay(Display.BLOCK);
  } else {
    style.setDisplay(Display.NONE);
  }
}
 
Example #17
Source File: ToDoView.java    From blog with MIT License 5 votes vote down vote up
private void displayOrHide(Element element, boolean hide) {
	if (hide) {
		element.getStyle().setDisplay(Display.NONE);
	} else {
		element.getStyle().setDisplay(Display.BLOCK);
	}
}
 
Example #18
Source File: GwtKnobsView.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
private void show(boolean isVisible) {
  this.isVisible = isVisible;
  if (isVisible) {
    knobs.getElement().getStyle().clearDisplay();
    button.setText("-");
  } else {
    knobs.getElement().getStyle().setDisplay(Display.NONE);
    button.setText("+");
  }
}
 
Example #19
Source File: FullStructure.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
@Override
public void remove(ParticipantNameDomImpl impl) {
  Element container = impl.getElement().getParentElement();
  impl.remove();

  // Kick Webkit, because of its incremental layout bugs.
  if (UserAgent.isWebkit()) {
    // Erase layout. Querying getOffsetParent() forces layout.
    container.getStyle().setDisplay(Display.NONE);
    container.getOffsetParent();
    // Restore layout.
    container.getStyle().clearDisplay();
  }
}
 
Example #20
Source File: CellTreeNodeView.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void replaceAllChildren(List<C> values, SelectionModel<? super C> selectionModel, boolean stealFocus) {
  // Render the children.
  SafeHtmlBuilder sb = new SafeHtmlBuilder();
  render(sb, values, 0, selectionModel);

  // Hide the child container so we can animate it.
  if (nodeView.tree.isAnimationEnabled()) {
    nodeView.ensureAnimationFrame().getStyle().setDisplay(Display.NONE);
  }

  // Replace the child nodes.
  nodeView.tree.isRefreshing = true;
  Map<Object, CellTreeNodeView<?>> savedViews = saveChildState(values, 0);
  AbstractHasData.replaceAllChildren(nodeView.tree, childContainer, sb.toSafeHtml());
  nodeView.tree.isRefreshing = false;

  // Trim the list of children.
  int size = values.size();
  int childCount = nodeView.children.size();
  while (childCount > size) {
    childCount--;
    CellTreeNodeView<?> deleted = nodeView.children.remove(childCount);
    deleted.cleanup(true);
  }

  // Reattach the open nodes.
  loadChildState(values, 0, savedViews);

  // If this is the root node, move keyboard focus to the first child.
  if (nodeView.isRootNode() && nodeView.tree.getKeyboardSelectedNode() == nodeView && values.size() > 0) {
    nodeView.tree.keyboardSelect(nodeView.children.get(0), false);
  }

  // Animate the child container open.
  if (nodeView.tree.isAnimationEnabled()) {
    nodeView.tree.maybeAnimateTreeNode(nodeView);
  }
}
 
Example #21
Source File: CellTreeNodeView.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Show or hide an element.
 *
 * @param element the element to show or hide
 * @param show    true to show, false to hide
 */
private static void showOrHide(Element element, boolean show) {
  if (show) {
    element.getStyle().clearDisplay();
  }
  else {
    element.getStyle().setDisplay(Display.NONE);
  }
}
 
Example #22
Source File: CellTreeNodeView.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Ensure that the animation frame exists and return it.
 *
 * @return the animation frame
 */
Element ensureAnimationFrame() {
  if (animationFrame == null) {
    animationFrame = Document.get().createDivElement();
    animationFrame.getStyle().setOverflow(Overflow.HIDDEN);
    animationFrame.getStyle().setDisplay(Display.NONE);
    getElement().appendChild(animationFrame);
  }
  return animationFrame;
}
 
Example #23
Source File: GalleryImage.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
@UiConstructor
public GalleryImage(String url) {
    setElement(Document.get().createAnchorElement());
    getElement().setAttribute("data-gallery", "data-gallery");
    getElement().getStyle().setDisplay(Display.INLINE_TABLE);

    setHref(url);

    image = new Image(url);
    add(image);
}
 
Example #24
Source File: IndexPage.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Init account roles 
 */
private void init() {
	accountSrv.isLogin(new AsyncCallback<Account>() {

		@Override
		public void onFailure(Throwable caught) {
			RootPanel.get("bda-login").getElement().getStyle().setDisplay(Display.INLINE);
		}

		@Override
		public void onSuccess(Account result) {
			if (result != null) {
				if(result.getEmail() != "guest"){
					RootPanel.get("bda-logout").getElement().getStyle().setDisplay(Display.INLINE);
					RootPanel.get("bda-workstage").getElement().getStyle().setDisplay(Display.INLINE);
					if(result.getUsername() != null){
						RootPanel.get("bda-account").getElement().setInnerText(result.getUsername());
					}else{
						RootPanel.get("bda-account").getElement().setInnerText(result.getEmail());
					}
					if(result.getEmail().equals("admin") || result.getEmail().equals("guest")){
						RootPanel.get("bda-account").getElement().removeAttribute("href");
					}else{
						RootPanel.get("bda-account").getElement().setAttribute("href", "EMLStudio.html#account");
					}
				}else{
					RootPanel.get("bda-login").getElement().getStyle().setDisplay(Display.INLINE);
				}
			} else {
				RootPanel.get("bda-login").getElement().getStyle().setDisplay(Display.INLINE);
			}
		}
	});
}
 
Example #25
Source File: InlineAnchorLiveRenderer.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
@Override
public Element createDomImpl(Renderable element) {
  // HTML does not allow block elements inside inline elements, so it has to
  // be divs all the way, not spans.
  Element e = Document.get().createDivElement();
  e.getStyle().setDisplay(Display.INLINE);
  // Do the things that the doodad API should be doing by default.
  DomHelper.setContentEditable(e, false, false);
  DomHelper.makeUnselectable(e);
  // ContentElement attempts this, and fails, so we have to do this ourselves.
  e.getStyle().setProperty("whiteSpace", "normal");
  e.getStyle().setProperty("lineHeight", "normal");
  return e;
}
 
Example #26
Source File: GanttWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
/**
 * Hide empty spacing in horizontal scrollbar's position.
 */
public void hideHorizontalScrollbarSpacer() {
    if (scrollbarSpacer.getStyle().getDisplay().isEmpty()) {
        scrollbarSpacer.getStyle().setDisplay(Display.NONE);
        notifyHeightChanged(getOffsetHeight());
    }
}
 
Example #27
Source File: ImeExtractor.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/***/
public ImeExtractor() {
  NodeManager.setTransparency(imeContainer, Skip.DEEP);
  NodeManager.setMayContainSelectionEvenWhenDeep(imeContainer, true);
  if (QuirksConstants.SUPPORTS_CARET_IN_EMPTY_SPAN) {
    // For browsers that support putting the caret in an empty span,
    // we do just that (it's simpler).
    imeInput = imeContainer;
  } else {
    // For other browsers, we use inline block so we can reuse the
    // paragraph logic to keep the ime extractor span open (i.e. to
    // allow the cursor to live inside it when it contains no text).
    // see #clearContainer()
    imeContainer.getStyle().setDisplay(Display.INLINE_BLOCK);
    DomHelper.setContentEditable(imeContainer, false, false);

    imeInput = Document.get().createSpanElement();
    imeInput.getStyle().setDisplay(Display.INLINE_BLOCK);
    imeInput.getStyle().setProperty("outline", "0");
    DomHelper.setContentEditable(imeInput, true, false);
    NodeManager.setTransparency(imeInput, Skip.DEEP);
    NodeManager.setMayContainSelectionEvenWhenDeep(imeInput, true);

    imeContainer.appendChild(imeInput);
  }
  clearContainer();
}
 
Example #28
Source File: TimelineWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
private DivElement createSpacerBlock(String className) {
    DivElement block = DivElement.as(DOM.createDiv());
    block.setClassName(STYLE_ROW + " " + STYLE_YEAR);
    block.addClassName(STYLE_SPACER);
    block.setInnerText(" ");
    block.getStyle().setDisplay(Display.NONE); // not visible by default
    spacerBlocks.add(block);
    return block;
}
 
Example #29
Source File: AbstractHover.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void changeVisibility(Visibility visibilityChange) {
	Visibility order = visibilityChange;
	if (order == Visibility.TOGGLE) {
		order = this.visibilityChange == Visibility.HIDE ? Visibility.SHOW : Visibility.HIDE;
	}
	final Element toDisplayElement = this.getHoverWidget().getElement();
	final Element target = this.getWidget().getElement();
	final Element parent = target.getParentElement();
	if (parent == null) {
		return;
	}
	switch (order) {
		case SHOW:
			parent.insertAfter(toDisplayElement, target);
			toDisplayElement.getStyle().setDisplay(Display.BLOCK);
			this.resetPosition(toDisplayElement, this.getWidget(), this.placement);
			StyleUtils.addStyle(this.getHoverWidget(), this.placement);
			StyleUtils.addStyle(toDisplayElement, Visibility.SHOW);
			break;
		case HIDE:
			StyleUtils.removeStyle(toDisplayElement, Visibility.SHOW);
			Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

				@Override
				public boolean execute() {
					toDisplayElement.getStyle().clearDisplay();
					toDisplayElement.removeFromParent();
					return false;
				}
			}, 200);
			break;
		default:
			break;
	}
	this.visibilityChange = order;
}
 
Example #30
Source File: GanttWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
public GanttWidget() {

        setElement(DivElement.as(DOM.createDiv()));
        setStyleName(STYLE_GANTT);

        nowElement.setClassName(STYLE_NOW_ELEMENT);

        moveElement.setClassName(STYLE_MOVE_ELEMENT);
        // not visible by default
        moveElement.getStyle().setDisplay(Display.NONE);

        timeline = GWT.create(TimelineWidget.class);

        container = DivElement.as(DOM.createDiv());
        container.setClassName(STYLE_GANTT_CONTAINER);

        content = DivElement.as(DOM.createDiv());
        content.setClassName(STYLE_GANTT_CONTENT);
        container.appendChild(content);

        content.appendChild(moveElement);
        content.appendChild(nowElement);

        scrollbarSpacer = DivElement.as(DOM.createDiv());
        scrollbarSpacer.getStyle().setHeight(AbstractNativeScrollbar.getNativeScrollbarHeight(), Unit.PX);
        scrollbarSpacer.getStyle().setDisplay(Display.NONE);

        getElement().appendChild(timeline.getElement());
        getElement().appendChild(container);
        getElement().appendChild(scrollbarSpacer);
    }