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

The following examples show how to use com.google.gwt.dom.client.Style.Display. These examples are extracted from open source projects. 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 Project: EasyML   Source File: DescribeGrid.java    License: 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 2
/**
 * 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 3
/**
 * 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 4
Source Project: vaadin-sliderpanel   Source File: VSliderPanel.java    License: 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 5
Source Project: gwt-material-addins   Source File: MaterialCutOut.java    License: 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 6
Source Project: swellrt   Source File: SuggestionButton.java    License: 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 7
Source Project: swellrt   Source File: FullStructure.java    License: 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 8
Source Project: swellrt   Source File: CollapsibleDomImpl.java    License: 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 9
Source Project: gwt-ol   Source File: DemoUtils.java    License: 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 10
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 11
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 12
Source Project: gantt   Source File: GanttWidget.java    License: 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 13
Source Project: incubator-retired-wave   Source File: SuggestionButton.java    License: 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 14
Source Project: incubator-retired-wave   Source File: FullStructure.java    License: 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 15
Source Project: incubator-retired-wave   Source File: CollapsibleDomImpl.java    License: 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 16
Source Project: EasyML   Source File: IndexPage.java    License: 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 17
Source Project: EasyML   Source File: AdminPresenter.java    License: Apache License 2.0 5 votes vote down vote up
private void init(){
	adminView.setAccount(AppController.username, AppController.email);		
	
	//Admin user have no workbench visit
	if(AppController.email.equals("admin")){										
		adminView.getWorkStage().getElement().getStyle().setDisplay(Display.NONE);
		adminView.getWorkStage().getElement().removeAttribute("href");
	}

	programLoader = new ProgramLoader(adminView);								
	datasetLoader = new DatasetLoader(adminView);
	accountLoader = new AccountLoader(adminView);
	categoryLoader = new CategoryLoader(adminView);
	programLoader.go();														
}
 
Example 18
Source Project: EasyML   Source File: AlertPanel.java    License: Apache License 2.0 5 votes vote down vote up
public AlertPanel() {
	bind();

	title.setStyleName("alertTitle");
	close.setStyleName("alertClose");
	alertHeader.add(title);
	alertHeader.add(close);
	alertHeader.addStyleName("alertTitleBG");

	content.removeStyleName("gwt-Label");
	content.addStyleName("alertBody");
	alertContent.add(content);
	alertContent.addStyleName("alertBodyBG");

	confirmBtn.removeStyleName("gwt-Button");
	alertButton.add(confirmBtn);
	alertButton.addStyleName("alertButton1");

	vPanel.add(alertHeader);
	vPanel.add(alertContent);
	vPanel.add(alertButton);

	vPanel.addStyleName("alertBox");
	mask.addStyleName("alertBack");

	mask.addStyleName("alertBack");
	mask.getElement().getStyle().setDisplay(Display.NONE);
	vPanel.add(mask);

	root.add(mask);
	root.add(vPanel);
	this.add(root);
	this.removeStyleName("gwt-PopupPanel");
	this.getElement().getStyle().setPosition(Position.FIXED);
	this.getElement().getStyle().setZIndex(999999999);
}
 
Example 19
Source Project: calendar-component   Source File: DateCell.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void recalculateTimeBarPosition() {
    int h = today.getHours();
    int m = today.getMinutes();
    if (h >= firstHour && h <= lastHour) {
        int pixelTop = weekgrid.getPixelTopFor(m + 60 * h);
        todaybar.getStyle().clearDisplay();
        todaybar.getStyle().setTop(pixelTop, Unit.PX);
    } else {
        todaybar.getStyle().setDisplay(Display.NONE);
    }
}
 
Example 20
Source Project: calendar-component   Source File: DateCell.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void updatePositionFor(DateCellDayItem dayItem, Date targetDay, CalendarItem calendarItem) {

    if (shouldDisplay(calendarItem)) {
        dayItem.getElement().getStyle().clearDisplay();

        Date fromDt = calendarItem.getStartTime();
        int h = fromDt.getHours();
        int m = fromDt.getMinutes();
        long range = calendarItem.getRangeInMinutesForDay(targetDay);

        boolean onDifferentDays = calendarItem.isTimeOnDifferentDays();
        if (onDifferentDays) {
            if (calendarItem.getStart().compareTo(targetDay) != 0) {
                // Current day slot is for the end date and all in-between
                // days. Lets fix also the start & end times.
                h = 0;
                m = 0;
            }
        }

        int startFromMinutes = (h * 60) + m;
        dayItem.updatePosition(startFromMinutes, range);
    } else {
        dayItem.getElement().getStyle().setDisplay(Display.NONE);
    }
}
 
Example 21
Source Project: gwt-material   Source File: MaterialCheckBox.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onLoad() {
    super.onLoad();

    getElement().getStyle().setDisplay(isVisible() ? Display.BLOCK : Display.NONE);
    handlerRegistry.registerHandler(addClickHandler(event -> {
        if (isAsynchronous()) {
            load(getAsyncCallback());
            event.preventDefault();
            event.stopPropagation();
        }
    }));
}
 
Example 22
Source Project: gwt-material-addins   Source File: MaterialCutOut.java    License: Apache License 2.0 5 votes vote down vote up
public MaterialCutOut() {
    super(Document.get().createDivElement(), AddinsCssName.MATERIAL_CUTOUT);

    focusElement = Document.get().createDivElement();
    getElement().appendChild(focusElement);

    getElement().getStyle().setOverflow(Overflow.HIDDEN);
    getElement().getStyle().setDisplay(Display.NONE);
}
 
Example 23
Source Project: swellrt   Source File: ImageThumbnailWidget.java    License: 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 24
Source Project: swellrt   Source File: ImageThumbnailWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setFullSizeMode(boolean isOn) {
  isFullSize = isOn;
  button.setOn(isOn);
  if (isOn) {
    chromeContainer.getElement().getStyle().setDisplay(Display.NONE);
  } else {
    chromeContainer.getElement().getStyle().clearDisplay();
  }
  setImageSize();
}
 
Example 25
Source Project: swellrt   Source File: GwtKnobsView.java    License: 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 26
Source Project: swellrt   Source File: ImeExtractor.java    License: 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 27
Source Project: swellrt   Source File: FullStructure.java    License: 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 28
Source Project: swellrt   Source File: CollapsibleDomImpl.java    License: Apache License 2.0 5 votes vote down vote up
public void setUnreadBlipCount(int unreadBlipCount) {
  self.setAttribute(UNREAD_BLIPS_ATTRIBUTE, "" + unreadBlipCount);
  Element unread = getCountUnread();
  unread.setInnerText("(" + unreadBlipCount + ")");
  if (unreadBlipCount > 0) {
    unread.getStyle().clearDisplay();
  } else {
    unread.getStyle().setDisplay(Display.NONE);
  }
  updatedCssClassNames();
}
 
Example 29
Source Project: swellrt   Source File: InlineAnchorLiveRenderer.java    License: 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 30
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;
}