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

The following examples show how to use com.google.gwt.dom.client.Style.Position. 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: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Clear the diagram (connections and widgets)
 */
public void clearDiagram() {
	connections.clear();
	widgetShapeMap.clear();
	functionsMap.clear();
	shapes.clear();
	startFunctionWidget = null;
	buildConnection = null;

	// Restart widgetPane
	if (scrollPanel != null)
		scrollPanel.clear();
	widgetPanel.clear();
	widgetPanel.add(topCanvas.asWidget());
	topCanvas.getElement().getStyle().setPosition(Position.ABSOLUTE);
	showGrid(showGrid);
}
 
Example #2
Source File: TimelineWidget.java    From gantt with Apache License 2.0 6 votes vote down vote up
private void fillDayResolutionBlock(DivElement resBlock, Date date, int index, boolean weekend, int left) {
    resBlock.setInnerText(getLocaleDataProvider().formatDate(date, getDayDateTimeFormat()));

    if (showCurrentTime && getLocaleDataProvider().formatDate(date, DAY_CHECK_FORMAT).equals(currentDate)) {
        resBlock.addClassName(STYLE_NOW);
    } else {
        resBlock.removeClassName(STYLE_NOW);
    }
    if (weekend) {
        resBlock.addClassName(STYLE_WEEKEND);
    } else {
        resBlock.removeClassName(STYLE_WEEKEND);
    }

    if (styleElementForLeft == null && isTimelineOverflowingHorizontally()) {
        resBlock.getStyle().setPosition(Position.RELATIVE);
        resBlock.getStyle().setLeft(left, Unit.PX);
    }
}
 
Example #3
Source File: Arrow.java    From bitcoin-transaction-explorer with MIT License 6 votes vote down vote up
public Arrow(final Orientation orientation, final int borderWidth) {
  setElement(d);
  this.orientation = orientation;
  this.borderWidth = borderWidth;
  d.appendChild(d1);
  d.appendChild(d2);
  d.getStyle().setPosition(Position.ABSOLUTE);
  d1.getStyle().setPosition(Position.ABSOLUTE);
  d1.getStyle().setHeight(0, Unit.PX);
  d1.getStyle().setWidth(0, Unit.PX);
  d1.getStyle().setPropertyPx(orientation.pos, 0);
  d1.getStyle().setPropertyPx(orientation.altPos, 0);
  d1.getStyle().setBorderStyle(BorderStyle.SOLID);
  d2.getStyle().setPosition(Position.ABSOLUTE);
  d2.getStyle().setHeight(0, Unit.PX);
  d2.getStyle().setWidth(0, Unit.PX);
  d2.getStyle().setPropertyPx(orientation.pos, borderWidth);
  d2.getStyle().setPropertyPx(orientation.altPos, borderWidth);
  d2.getStyle().setBorderStyle(BorderStyle.SOLID);
  topBottom = orientation == Orientation.TOP || orientation == Orientation.BOTTOM;
}
 
Example #4
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 #5
Source File: BasicToolBar.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Widget asWidget() {
	if (widget == null) {
		widget = new VerticalLayoutContainer();

		widget.getElement().getStyle().setPosition(Position.ABSOLUTE);
		widget.getElement().getStyle().setRight(5, Unit.PX);
		widget.getElement().getStyle().setBottom(5, Unit.PX);
		widget.setHeight("120px");
		widget.setWidth("420px");
		ScrollSupport scrollSupport = widget.getScrollSupport();
		scrollSupport.setScrollMode(ScrollMode.AUTOX);

		widget.add(w3wPanel);
		widget.add(toolBar);
		widget.setVisible(true);
	}
	return widget;
}
 
Example #6
Source File: MenuPanelWidget.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Widget asWidget() {

	if (panel == null) {
		panel = new ContentPanel();
		panel.setBorders(true);
		panel.setPixelSize(300, 590);
		panel.setHeaderVisible(false);
		panel.setPosition(0, 50);
		panel.getElement().getStyle().setPosition(Position.ABSOLUTE);

		VerticalLayoutContainer groupsContainer = getVerticalGroupButtons();
		groupsContainer.setAdjustForScroll(true);
		groupsContainer.setScrollMode(ScrollMode.AUTOY);
		panel.setWidget(groupsContainer);

		panel.setVisible(false);
		createButtonGroup();
	}
	return panel;
}
 
Example #7
Source File: ZoomStatusWidget.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Widget asWidget() {
	if (widget == null) {
		final String width = "60px";
		final String height = "10px";
		widget = new HorizontalLayoutContainer();
		widget.getElement().getStyle().setPosition(Position.ABSOLUTE);
		widget.getElement().getStyle().setLeft(10, Unit.PX);
		widget.getElement().getStyle().setBottom(90, Unit.PX);
		widget.setSize(width, height);
		
		hp = new HorizontalPanel();
		hp.setSpacing(2);
		hp.getElement().getStyle().setBackgroundColor("#FFFFFF");
		hp.setSize(width, height);
		
		hp.add(getZoomLabel());
		
		widget.add(hp);
	}
	return widget;
}
 
Example #8
Source File: TimetableGrid.java    From unitime with Apache License 2.0 5 votes vote down vote up
public Background(TimetableGridBackground background) {
	super();
	setStyleName("background");
	iBackground = background;
	
	getElement().getStyle().setPosition(Position.ABSOLUTE);
	if (background.hasBackground())
		getElement().getStyle().setBackgroundColor(background.getBackground());
}
 
Example #9
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Add a widget as a decoration on a connection
 * 
 * @param decoration widget that will be in the middle of the connection
 * @param decoratedConnection the connection where the decoration will be
 *        put
 */
public void addDecoration(Widget decoration, Connection decoratedConnection) {
	decoration.getElement().getStyle().setZIndex(10);
	decoration.getElement().getStyle().setPosition(Position.ABSOLUTE);
	widgetPanel.add(decoration);
	decoratedConnection.setDecoration(new DecorationShape(this, decoration));
	decoratedConnection.setSynchronized(false);
}
 
Example #10
Source File: TimeGrid.java    From unitime with Apache License 2.0 5 votes vote down vote up
public SelectionPanel(boolean fixed) {
	setStyleName(fixed ? "selection" : "active-selection");
	if (fixed) {
		iRemove = new P("x"); iRemove.setHTML("×");
		iRemove.addMouseDownHandler(new MouseDownHandler() {
			@Override
			public void onMouseDown(MouseDownEvent event) {
				iSelections.remove(SelectionPanel.this);
				if (iSelection != null)
					iAllSelections.remove(iSelection);
			}
		});
		if (iRTL) {
			iRemove.getElement().getStyle().setLeft(2, Unit.PX);
		} else {
			iRemove.getElement().getStyle().setRight(2, Unit.PX);
		}
		iRemove.getElement().getStyle().setTop(2, Unit.PX);
		iRemove.getElement().getStyle().setPosition(Position.ABSOLUTE);
		add(iRemove);
		iText = new P("text");
		add(iText, 0, 0);
	}
	
	sinkEvents(Event.ONMOUSEDOWN);
	sinkEvents(Event.ONMOUSEUP);
	sinkEvents(Event.ONMOUSEMOVE);
}
 
Example #11
Source File: PasteBufferImpl.java    From swellrt with Apache License 2.0 5 votes vote down vote up
protected void positionPasteBuffer(Element element) {
  if (SHOW_DEBUG_PASTEBUFFER) {
    element.getStyle().setPosition(Position.ABSOLUTE);
    element.getStyle().setHeight(150, Unit.PX);
    element.getStyle().setLeft(1000, Unit.PX);
    element.getStyle().setTop(10, Unit.PX);
  } else {
    element.getStyle().setPosition(Position.ABSOLUTE);
    element.getStyle().setTop(-100, Unit.PX); // arbitrary numbers
    element.getStyle().setHeight(50, Unit.PX);
  }
}
 
Example #12
Source File: InputDatePicker.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void popup(Widget container, Widget relativeTo) {
	this.setVisible(true);
	StyleUtils.addStyle(this, InputDatePicker.STYLE_POPUP);
	RootPanel.get().add(this);

	Element positioningElement = this.getElement();
	Element relativeElement = relativeTo.getElement();

	int targetHeight = relativeElement.getOffsetHeight();
	int targetTop = relativeElement.getAbsoluteTop();

	int positioningWidth = positioningElement.getOffsetWidth();
	int targetRight = relativeElement.getAbsoluteRight();

	Style elementStyle = positioningElement.getStyle();
	elementStyle.setPosition(Position.ABSOLUTE);
	elementStyle.setLeft(targetRight - positioningWidth, Unit.PX);
	elementStyle.setTop(targetTop + targetHeight, Unit.PX);

	StyleUtils.addStyle(this, InputDatePicker.STYLE_FADE);
	StyleUtils.addStyle(this, InputDatePicker.STYLE_SHOW);

	this.setFocus(true);

	if (this.popupBlurHandler == null) {
		this.popupBlurHandler = this.addBlurHandler(new BlurHandler() {

			@Override
			public void onBlur(BlurEvent event) {
				InputDatePicker.this.hide();
			}
		});
	}
}
 
Example #13
Source File: AbstractHover.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void resetPosition(Element toPositionedElement, Widget relativeTo, Placement placement) {
	Element relativeElement = relativeTo.getElement();

	com.google.gwt.dom.client.Style elementStyle = toPositionedElement.getStyle();
	int tooltipWidth = toPositionedElement.getOffsetWidth();
	int tooltipHeight = toPositionedElement.getOffsetHeight();

	int targetWidth = relativeElement.getOffsetWidth();
	int targetHeight = relativeElement.getOffsetHeight();
	int targetTop = relativeElement.getOffsetTop();
	int targetLeft = relativeElement.getOffsetLeft();

	elementStyle.setPosition(Position.ABSOLUTE);
	switch (placement) {
		case TOP:
			elementStyle.setLeft(targetLeft + targetWidth / 2 - tooltipWidth / 2, Unit.PX);
			elementStyle.setTop(targetTop - tooltipHeight, Unit.PX);
			break;
		case BOTTOM:
			elementStyle.setLeft(targetLeft + targetWidth / 2 - tooltipWidth / 2, Unit.PX);
			elementStyle.setTop(targetTop + targetHeight, Unit.PX);
			break;
		case LEFT:
			elementStyle.setLeft(targetLeft - tooltipWidth, Unit.PX);
			elementStyle.setTop(targetTop + targetHeight / 2 - tooltipHeight / 2, Unit.PX);
			break;
		case RIGHT:
			elementStyle.setLeft(targetLeft + targetWidth, Unit.PX);
			elementStyle.setTop(targetTop + targetHeight / 2 - tooltipHeight / 2, Unit.PX);
			break;
		default:
			break;
	}
}
 
Example #14
Source File: Affix.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void toggleAffix(Affixed affix) {
	Element e = this.getElement();
	Style style = e.getStyle();

	if (this.affixed != affix) {
		this.clearElementStyle();
		this.affixed = affix;
		StyleUtils.addStyle(e, this.affixed);
	}

	switch (affix) {
		case AFFIX:
			style.setTop(this.offsetTop, Unit.PX);
			style.setWidth(this.offsetWidth, Unit.PX);
			style.setHeight(this.offsetHeight, Unit.PX);
			style.setZIndex(this.layerIndex);
			e.getParentElement().getStyle().setPaddingTop(this.offsetHeight, Unit.PX);
			break;
		case BOTTOM:
			int docHeigth = Document.get().getScrollHeight();
			int scrollTop = Window.getScrollTop();

			int bottom = this.offsetBottom - (docHeigth - scrollTop - this.clientHeigth);
			if (this.fixBottom != Integer.MIN_VALUE) {
				bottom = Math.max(bottom, this.fixBottom);
			}
			style.setPosition(Position.FIXED);
			style.setBottom(bottom, Unit.PX);
			style.setWidth(this.offsetWidth, Unit.PX);
			style.setHeight(this.offsetHeight, Unit.PX);
			style.setZIndex(this.layerIndex);
			break;
		default:
			break;
	}
}
 
Example #15
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
public SvgArrowWidget() {
    Element predecessorArrow = createSVGElementNS("svg");
    addStyleName(predecessorArrow, "arrow");
    predecessorArrow.getStyle().setPosition(Position.ABSOLUTE);
    predecessorArrow.getStyle().setZIndex(2);
    predecessorArrow.getStyle().setProperty("pointerEvents", "none");

    Element g = createSVGElementNS("g");
    setAttributeNS(g, "stroke", "black");
    setAttributeNS(g, "stroke-width", "1");
    curve = createSVGElementNS("path");
    addStyleName(curve, "curve-line");
    setAttributeNS(curve, "fill", "none");
    startingPoint = createSVGElementNS("circle");
    startingPoint.getStyle().setProperty("pointerEvents", "visiblePainted");
    addStyleName(startingPoint, "start-p");
    setAttributeNS(startingPoint, "stroke-width", "2");
    setAttributeNS(startingPoint, "r", "7");
    setAttributeNS(startingPoint, "fill", "black");
    endingPoint = createSVGElementNS("circle");
    endingPoint.getStyle().setProperty("pointerEvents", "visiblePainted");
    addStyleName(endingPoint, "end-p");
    setAttributeNS(endingPoint, "stroke-width", "2");
    setAttributeNS(endingPoint, "r", "5");
    setAttributeNS(endingPoint, "fill", "black");
    DOM.appendChild(g, curve);
    DOM.appendChild(g, startingPoint);
    DOM.appendChild(g, endingPoint);
    DOM.appendChild(predecessorArrow, g);
    setElement(predecessorArrow);

}
 
Example #16
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
protected Element createSnapshotElement(Point point) {
    int deltaX = (int) (point.getX() - capturePoint.getX());
    int deltaY = (int) (point.getY() - capturePoint.getY());
    int scrollDeltaY = getElement().getParentElement().getParentElement()
            .getScrollTop()
            - capturePointScrollTop;
    int scrollDeltaX = getElement().getParentElement().getParentElement()
            .getScrollLeft()
            - capturePointScrollLeft;

    int originalTopPoint = selectPredecessorMode ? originalData
            .calcStartPointY() : originalData.calcEndPointY();
    int originalLeftPoint = selectPredecessorMode ? originalData
            .calcStartPointX() : originalData.calcEndPointX();

    movePointElement.getStyle().setVisibility(Visibility.HIDDEN);
    movePointElement.getStyle().setPosition(Position.ABSOLUTE);
    movePointElement.getStyle().setTop(
            Math.max(0, originalData.getTop() + originalTopPoint + deltaY
                    + scrollDeltaY), Unit.PX);
    movePointElement.getStyle().setLeft(
            Math.max(0, originalData.getLeft() + originalLeftPoint + deltaX
                    + scrollDeltaX), Unit.PX);
    movePointElement.getStyle().setWidth(2, Unit.PX);
    movePointElement.getStyle().setHeight(2, Unit.PX);

    return movePointElement;
}
 
Example #17
Source File: TimelineWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
private void fillWeekResolutionBlock(DivElement resBlock, boolean fillWeekBlock, Date date, int index,
        Weekday weekDay, boolean firstWeek,
        boolean lastBlock, int left, boolean even) {
    if (fillWeekBlock) {
        resBlock.setInnerText(formatWeekCaption(date));

        if (even) {
            resBlock.addClassName(STYLE_EVEN);
        } else {
            resBlock.removeClassName(STYLE_EVEN);
        }

        if (styleElementForLeft == null && isTimelineOverflowingHorizontally()) {
            resBlock.getStyle().setPosition(Position.RELATIVE);
            resBlock.getStyle().setLeft(left, Unit.PX);
        }

        resBlock.removeClassName(STYLE_FIRST);
        resBlock.removeClassName(STYLE_LAST);
    }

    if (firstWeek && (weekDay == Weekday.Last || lastBlock)) {
        Element firstEl = resolutionDiv.getFirstChildElement();
        if (!firstEl.hasClassName(STYLE_FIRST)) {
            firstEl.addClassName(STYLE_FIRST);
        }
    } else if (lastBlock) {
        Element lastEl = Element.as(resolutionDiv.getLastChild());
        if (!lastEl.hasClassName(STYLE_LAST)) {
            lastEl.addClassName(STYLE_LAST);
        }
    }
}
 
Example #18
Source File: TimelineWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
private void fillHourResolutionBlock(DivElement resBlock, Date date, int index, int hourCounter, boolean lastBlock,
        int left, boolean even) {
    resBlock.setInnerText(formatHourCaption(date));

    if (showCurrentTime
            && getLocaleDataProvider().formatDate(date, HOUR_CHECK_FORMAT).equals(currentDate + currentHour)) {
        resBlock.addClassName(STYLE_NOW);
    } else {
        resBlock.removeClassName(STYLE_NOW);
    }
    if (even) {
        resBlock.addClassName(STYLE_EVEN);
    } else {
        resBlock.removeClassName(STYLE_EVEN);

    }

    if (firstDay && (hourCounter == 24 || lastBlock)) {
        firstDay = false;
        firstResBlockCount = index + 1;
    } else if (lastBlock) {
        lastResBlockCount = (index + 1 - firstResBlockCount) % 24;
    }

    if (styleElementForLeft == null && isTimelineOverflowingHorizontally()) {
        resBlock.getStyle().setPosition(Position.RELATIVE);
        resBlock.getStyle().setLeft(left, Unit.PX);
    }
}
 
Example #19
Source File: PasteBufferImpl.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
protected void positionPasteBuffer(Element element) {
  if (SHOW_DEBUG_PASTEBUFFER) {
    element.getStyle().setPosition(Position.ABSOLUTE);
    element.getStyle().setHeight(150, Unit.PX);
    element.getStyle().setLeft(1000, Unit.PX);
    element.getStyle().setTop(10, Unit.PX);
  } else {
    element.getStyle().setPosition(Position.ABSOLUTE);
    element.getStyle().setTop(-100, Unit.PX); // arbitrary numbers
    element.getStyle().setHeight(50, Unit.PX);
  }
}
 
Example #20
Source File: MaterialCutOut.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the computed background color, based on the backgroundColor CSS
 * class.
 */
protected void setupComputedBackgroundColor() {
    // temp is just a widget created to evaluate the computed background
    // color
    MaterialWidget temp = new MaterialWidget(Document.get().createDivElement());
    temp.setBackgroundColor(backgroundColor);

    // setting a style to make it invisible for the user
    Style style = temp.getElement().getStyle();
    style.setPosition(Position.FIXED);
    style.setWidth(1, Unit.PX);
    style.setHeight(1, Unit.PX);
    style.setLeft(-10, Unit.PX);
    style.setTop(-10, Unit.PX);
    style.setZIndex(-10000);

    // adding it to the body (on Chrome the component must be added to the
    // DOM before getting computed values).
    String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor);

    // convert rgb to rgba, considering the opacity field
    if (opacity < 1 && computed.startsWith("rgb(")) {
        computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")");
    }

    computedBackgroundColor = computed;
}
 
Example #21
Source File: TimetableGrid.java    From unitime with Apache License 2.0 5 votes vote down vote up
private Meeting(TimetableGridCell cell, boolean showRoom, boolean showInstructor, boolean showTime, boolean showPreference, boolean showDate) {
	super();
	iCell = cell;
	
       setStyleName("meeting");
       if (cell.hasBackground())
       	getElement().getStyle().setBackgroundColor(cell.getBackground());
       
       P header = new P("header", "label");
       header.setHeight(sLineHeight * cell.getNrNames());
       header.setHTML(cell.getName("<br>"));
       header.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
       if (cell.isItalics())
       	header.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
       add(header);

       P footer = new P("footer");
       String notes = "";
       if (showTime && cell.hasTime()) notes += (notes.isEmpty() ? "" : "<br>") + cell.getTime();
       if (showDate && cell.hasDate()) notes += (notes.isEmpty() ? "" : "<br>") + cell.getDate();
       if (showRoom && cell.getNrRooms() > 0) notes += (notes.isEmpty() ? "" : "<br>") + cell.getRoom("<br>");
       if (showInstructor && cell.getNrInstructors() > 0) notes += (notes.isEmpty() ? "" : "<br>") + cell.getInstructor("<br>");
       if (showPreference && cell.hasPreference()) notes += (notes.isEmpty() ? "" : "<br>") + "<span style='color:rgb(200,200,200)'>" + cell.getPreference() + "</span>";
       footer.setHTML(notes);
       footer.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
       add(footer);
       
       sinkEvents(Event.ONCLICK);
	sinkEvents(Event.ONMOUSEOVER);
	sinkEvents(Event.ONMOUSEOUT);
	
	getElement().getStyle().setPosition(Position.ABSOLUTE);
}
 
Example #22
Source File: MaterialCutOut.java    From gwt-material-addins with Apache License 2.0 5 votes vote down vote up
protected void setCutOutStyle() {
    Style style = getElement().getStyle();
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);
    style.setPosition(Position.FIXED);
    style.setTop(0, Unit.PX);
    style.setLeft(0, Unit.PX);
    style.setZIndex(10000);

    focusElement.setClassName(AddinsCssName.MATERIAL_CUTOUT_FOCUS);
    style = focusElement.getStyle();
    style.setProperty("content", "\'\'");
    style.setPosition(Position.ABSOLUTE);
    style.setZIndex(-1);
}
 
Example #23
Source File: DiagramController.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Clear the canvas in the diagram.
 */
public void clear() {
	widgets.clear();
	connDrawSet.clear();
	widgetPanel.clear();
	widgetPanel.getElement().getStyle().setWidth(topCanvas.getWidth(), Unit.PX);
	widgetPanel.getElement().getStyle()
	.setHeight(topCanvas.getHeight(), Unit.PX);
	widgetPanel.add(topCanvas.asWidget());
	svgPanel = new SVGPanel();
	widgetPanel.add(svgPanel);
	topCanvas.getElement().getStyle().setPosition(Position.ABSOLUTE);
	showGrid(showGrid);
}
 
Example #24
Source File: AlertPanel.java    From EasyML with 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 #25
Source File: LayerManagerWidget.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
public Widget asWidget() {

		if (panel == null) {

			panel = new FramedPanel();
			panel.setAnimCollapse(true);

			panel.setPixelSize(300, 350);
			panel.getHeader().setIcon(ImageProvider.INSTANCE.layer16());
			panel.setHeadingText(UIMessages.INSTANCE.lmHeadingText());
			panel.setAllowTextSelection(false);

			panel.setPosition(300, 50);
			panel.getElement().getStyle().setPosition(Position.ABSOLUTE);
			panel.getElement().getStyle().setBorderWidth(1.0, Unit.PX);

			tabPanel = new PlainTabPanel();
			tabPanel.setPixelSize(300, 250);
			for (final String titleTab : layerTrees.keySet()) {				
				tabPanel.add(createContainerTab(titleTab), createTab(titleTab));
			}
			
			final VerticalLayoutContainer panelLayout = new VerticalLayoutContainer();
			panelLayout.add(tabPanel);
			panelLayout.add(getFoot());
			panel.add(panelLayout);
			panel.setVisible(false);

			new Draggable(panel, panel.getHeader());
			final ToolButton tButton = new ToolButton(ToolButton.CLOSE);
			addCloseSelectHandler(tButton);
			panel.getHeader().addTool(tButton);
			panel.setCollapsible(true);

		}

		return panel;
	}
 
Example #26
Source File: DateCellDayItem.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
public DateCellDayItem(DateCell dateCell, WeekGrid parent, CalendarItem calendarItem) {
    super();
    this.dateCell = dateCell;

    handlers = new LinkedList<>();

    setStylePrimaryName("v-calendar-event");

    setCalendarItem(calendarItem);

    weekGrid = parent;

    Style s = getElement().getStyle();
    if (calendarItem.getStyleName().length() > 0) {
        addStyleDependentName(calendarItem.getStyleName());
    }
    s.setPosition(Position.ABSOLUTE);

    caption = DOM.createDiv();
    caption.addClassName("v-calendar-event-caption");
    getElement().appendChild(caption);

    eventContent = DOM.createDiv();
    eventContent.addClassName("v-calendar-event-content");
    getElement().appendChild(eventContent);

    if (weekGrid.getCalendar().isItemResizeAllowed() && getCalendarItem().isResizeable()) {
        topResizeBar = DOM.createDiv();
        bottomResizeBar = DOM.createDiv();

        topResizeBar.addClassName("v-calendar-event-resizetop");
        bottomResizeBar.addClassName("v-calendar-event-resizebottom");

        getElement().appendChild(topResizeBar);
        getElement().appendChild(bottomResizeBar);
    }

    eventIndex = calendarItem.getIndex();

}
 
Example #27
Source File: ActionBar.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
public ActionBar() {
	super();
	setWidth(300);
	setHeaderVisible(false);
	addStyleName(ThemeStyles.get().style().borderBottom());
	setPosition(0, 0);
	getElement().getStyle().setPosition(Position.ABSOLUTE);
	HorizontalPanel horizontalGroup = new HorizontalPanel();
	horizontalGroup.add(getMenuButton());
	horizontalGroup.add(new SeparatorToolItem());
	Image image = new Image(ImageProvider.INSTANCE.menulogoGeowe());
	horizontalGroup.add(image);
	horizontalGroup.add(new SeparatorToolItem());
	horizontalGroup.add(new SeparatorToolItem());						
	horizontalGroup.add(getGeocodingButton());
	setWidget(horizontalGroup);		
}
 
Example #28
Source File: VDDGridLayout.java    From cuba with Apache License 2.0 5 votes vote down vote up
/**
 * Emphasizes a component container when user is hovering a dragged
 * component over the container.
 * 
 * @param cell
 *            The container
 * @param event
 */
protected void emphasis(CellDetails cell, VDragEvent event) {

    Style shadowStyle = dragShadow.getElement().getStyle();
    shadowStyle.setPosition(Position.ABSOLUTE);
    shadowStyle.setWidth(cell.width, Unit.PX);
    shadowStyle.setHeight(cell.height, Unit.PX);
    shadowStyle.setLeft(cell.x, Unit.PX);
    shadowStyle.setTop(cell.y, Unit.PX);

    // Remove any existing empasis
    deEmphasis();

    // Ensure we are not dragging ourself into ourself
    ComponentConnector draggedConnector = (ComponentConnector) event
            .getTransferable()
            .getData(Constants.TRANSFERABLE_DETAIL_COMPONENT);

    if (draggedConnector != null
            && draggedConnector.getWidget() == VDDGridLayout.this) {
        return;
    }

    HorizontalDropLocation hl = getHorizontalDropLocation(cell, event);
    VerticalDropLocation vl = getVerticalDropLocation(cell, event);

    // Apply over style
    setStyleName(dragShadow.getElement(), OVER, true);

    // Add vertical location dependent style
    setStyleName(dragShadow.getElement(),
            OVER + "-" + vl.toString().toLowerCase(), true);

    // Add horizontal location dependent style
    setStyleName(dragShadow.getElement(),
            OVER + "-" + hl.toString().toLowerCase(), true);

}
 
Example #29
Source File: LinksWidget.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Widget asWidget() {
	if (widget == null) {
		//String width="320px";
		String width="370px";
		String height="50px";
		widget = new HorizontalLayoutContainer();
		widget.getElement().getStyle().setPosition(Position.ABSOLUTE);
		widget.getElement().getStyle().setRight(5, Unit.PX);
		widget.getElement().getStyle().setTop(0, Unit.PX);
		widget.setSize(width, height);
		
		hp = new HorizontalPanel();
		hp.setSpacing(10);
		StyleInjector.inject(".linkPanel { " + "background: #FFFFFF;"
				+ "border-radius: 5px 10px;" + "opacity: 0.8}");
		hp.setStyleName("linkPanel");
		hp.setSize(width, height);
		
		ScrollSupport scrollSupport = widget.getScrollSupport();
		scrollSupport.setScrollMode(ScrollMode.AUTOX);
		
		setDefaultLinks();
		
		widget.add(hp);
	}
	return widget;
}
 
Example #30
Source File: VerticalLegend.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
protected void create() {
	setSize(WIDTH, HEIGHT);
	setVisible(false);
	getElement().getStyle().setPosition(Position.ABSOLUTE);
	getElement().getStyle().setRight(5, Unit.PX);
	getElement().getStyle().setTop(70, Unit.PX);
	ScrollSupport scrollSupport = getScrollSupport();
	scrollSupport.setScrollMode(ScrollMode.AUTO);
	createContentPanel();
	add(contentPanel);

	new Draggable(this);
}