List of usage examples for com.google.gwt.dom.client Style setProperty
public void setProperty(String name, String value)
From source file:geogebra.web.gui.app.docklayout.LayoutImpl.java
License:Apache License
public void layout(Layer layer) { Style style = layer.container.getStyle(); if (layer.visible) { style.clearDisplay();/*from w ww . j a v a 2 s.c o m*/ } else { style.setDisplay(Display.NONE); } style.setProperty("left", layer.setLeft ? (layer.left + layer.leftUnit.getType()) : ""); style.setProperty("top", layer.setTop ? (layer.top + layer.topUnit.getType()) : ""); style.setProperty("right", layer.setRight ? (layer.right + layer.rightUnit.getType()) : ""); style.setProperty("bottom", layer.setBottom ? (layer.bottom + layer.bottomUnit.getType()) : ""); style.setProperty("width", layer.setWidth ? (layer.width + layer.widthUnit.getType()) : ""); style.setProperty("height", layer.setHeight ? (layer.height + layer.heightUnit.getType()) : ""); style = layer.child.getStyle(); switch (layer.hPos) { case BEGIN: style.setLeft(0, Unit.PX); style.clearRight(); break; case END: style.clearLeft(); style.setRight(0, Unit.PX); break; case STRETCH: style.setLeft(0, Unit.PX); style.setRight(0, Unit.PX); break; } switch (layer.vPos) { case BEGIN: style.setTop(0, Unit.PX); style.clearBottom(); break; case END: style.clearTop(); style.setBottom(0, Unit.PX); break; case STRETCH: style.setTop(0, Unit.PX); style.setBottom(0, Unit.PX); break; } }
From source file:gwt.material.design.addins.client.cutout.MaterialCutOut.java
License:Apache License
/** * Opens the dialog cut out taking all the screen. The target element should * be set before calling this method.//from w w w. ja v a 2s. co m * * @throws IllegalStateException if the target element is <code>null</code> * @see #setTarget(Widget) */ public void open() { setCutOutStyle(); if (targetElement == null) { throw new IllegalStateException("The target element should be set before calling open()."); } targetElement.scrollIntoView(); if (computedBackgroundColor == null) { setupComputedBackgroundColor(); } //temporarily disables scrolling by setting the overflow of the page to hidden Style docStyle = Document.get().getDocumentElement().getStyle(); viewportOverflow = docStyle.getOverflow(); docStyle.setProperty("overflow", "hidden"); if (backgroundSize == null) { backgroundSize = body().width() + 300 + "px"; } setupTransition(); if (animated) { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px 0rem " + computedBackgroundColor); //the animation will take place after the boxshadow is set by the deferred command Scheduler.get().scheduleDeferred(() -> { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); }); } else { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); } if (circle) { focusElement.getStyle().setProperty("WebkitBorderRadius", "50%"); focusElement.getStyle().setProperty("borderRadius", "50%"); // Temporary fixed for the IOS Issue on recalculation of the border radius focusElement.getStyle().setProperty("webkitBorderTopLeftRadius", "49.9%"); focusElement.getStyle().setProperty("borderTopLeftRadius", "49.9%"); } else { focusElement.getStyle().clearProperty("WebkitBorderRadius"); focusElement.getStyle().clearProperty("borderRadius"); focusElement.getStyle().clearProperty("webkitBorderTopLeftRadius"); focusElement.getStyle().clearProperty("borderTopLeftRadius"); } setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle); setupWindowHandlers(); getElement().getStyle().clearDisplay(); // verify if the component is added to the document (via UiBinder for // instance) if (getParent() == null) { autoAddedToDocument = true; RootPanel.get().add(this); } OpenEvent.fire(this, this); }
From source file:gwt.material.design.addins.client.cutout.MaterialCutOut.java
License:Apache License
protected void setCutOutStyle() { Style style = getElement().getStyle(); style.setWidth(100, Unit.PCT);//from ww w .j a v a 2 s .c om 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); }
From source file:gwt.material.design.addins.client.ui.MaterialCutOut.java
License:Apache License
public MaterialCutOut() { super(Document.get().createDivElement()); focus = Document.get().createDivElement(); getElement().appendChild(focus);/*from www . j av a 2 s . c om*/ setStyleName("material-cutout"); 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.setOverflow(Overflow.HIDDEN); style.setZIndex(10000); style.setDisplay(Display.NONE); focus.setClassName("material-cutout-focus"); style = focus.getStyle(); style.setProperty("content", "\'\'"); style.setPosition(Position.ABSOLUTE); style.setZIndex(-1); }
From source file:gwt.material.design.addins.client.ui.MaterialCutOut.java
License:Apache License
/** * Opens the modal cut out taking all the screen. The target element should * be set before calling this method./*from ww w . ja v a2s . c o m*/ * * @throws IllegalStateException * if the target element is <code>null</code> * @see #setTargetElement(Element) */ public void openCutOut() { if (targetElement == null) { throw new IllegalStateException("The target element should be set before calling openCutOut()."); } targetElement.scrollIntoView(); if (computedBackgroundColor == null) { setupComputedBackgroundColor(); } //temporarily disables scrolling by setting the overflow of the page to hidden Style docStyle = Document.get().getDocumentElement().getStyle(); viewportOverflow = docStyle.getOverflow(); docStyle.setProperty("overflow", "hidden"); setupTransition(); if (animated) { focus.getStyle().setProperty("boxShadow", "0px 0px 0px 0rem " + computedBackgroundColor); //the animation will take place after the boxshadow is set by the deferred command Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { focus.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); } }); } else { focus.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); } if (circle) { focus.getStyle().setProperty("WebkitBorderRadius", "50%"); focus.getStyle().setProperty("borderRadius", "50%"); } else { focus.getStyle().clearProperty("WebkitBorderRadius"); focus.getStyle().clearProperty("borderRadius"); } setupCutOutPosition(focus, targetElement, cutOutPadding, circle); setupWindowHandlers(); getElement().getStyle().clearDisplay(); // verify if the component is added to the document (via UiBinder for // instance) if (getParent() == null) { autoAddedToDocument = true; RootPanel.get().add(this); } }
From source file:gwt.material.design.client.data.BaseRenderer.java
License:Apache License
@Override public TableRow drawRow(DataView<T> dataView, RowComponent<T> rowComponent, Object valueKey, List<Column<T, ?>> columns, boolean redraw) { T data = rowComponent.getData();// ww w .ja va2 s . c o m TableRow row = rowComponent.getWidget(); boolean draw = true; if (row == null) { // Create a new row element row = new TableRow(); Style style = row.getElement().getStyle(); style.setDisplay(Display.NONE); style.setProperty("height", getExpectedRowHeight() + "px"); style.setProperty("maxHeight", getExpectedRowHeight() + "px"); style.setProperty("minHeight", getExpectedRowHeight() + "px"); row.setStyleName(TableCssName.DATA_ROW); rowComponent.setWidget(row); if (!dataView.getSelectionType().equals(SelectionType.NONE)) { TableData selection = drawSelectionCell(); row.add(selection); } } else if (!redraw && !rowComponent.isRedraw()) { draw = false; } if (draw) { // Build the columns int colOffset = dataView.getColumnOffset(); int colSize = columns.size(); for (int c = 0; c < colSize; c++) { int colIndex = c + colOffset; Context context = new Context(rowComponent.getIndex(), colIndex, valueKey); drawColumn(row, context, data, columns.get(c), colIndex, dataView.isHeaderVisible(colIndex)); } rowComponent.setRedraw(false); } if (dataView.isUseRowExpansion()) { if (!row.hasExpansionColumn()) { TableData expand = new TableData(); expand.setId("colex"); MaterialIcon expandIcon = new MaterialIcon(); expandIcon.setId("expand"); expandIcon.setWidth("100%"); expandIcon.setIconType(IconType.KEYBOARD_ARROW_DOWN); expandIcon.setWaves(WavesType.LIGHT); expandIcon.getElement().getStyle().setCursor(Cursor.POINTER); expand.add(expandIcon); row.add(expand); } } else if (row.hasExpansionColumn()) { row.removeExpansionColumn(); } Scheduler.get().scheduleDeferred(() -> { calculateRowHeight(rowComponent); }); return row; }
From source file:gwt.material.design.client.data.BaseRenderer.java
License:Apache License
@Override @SuppressWarnings("unchecked") public TableData drawColumn(TableRow row, Context context, T rowValue, Column<T, ?> column, int beforeIndex, boolean visible) { TableData data = null;//from ww w. j av a 2 s . c om if (row != null && rowValue != null) { data = row.getColumn(beforeIndex); if (data == null) { data = new TableData(); row.insert(data, beforeIndex); } else { data.clear(); } Div wrapper = new Div(); // Render the column cell if (column instanceof WidgetColumn) { wrapper.setStyleName(TableCssName.WIDGET_CELL); wrapper.add(((WidgetColumn) column).render(context, rowValue)); } else { SafeHtmlBuilder sb = new SafeHtmlBuilder(); column.render(context, rowValue, sb); wrapper.getElement().setInnerHTML(sb.toSafeHtml().asString()); wrapper.setStyleName(TableCssName.CELL); } data.add(wrapper); data.setId("col" + beforeIndex); data.setDataTitle(column.getName()); HideOn hideOn = column.getHideOn(); if (hideOn != null) { data.setHideOn(hideOn); } TextAlign textAlign = column.getTextAlign(); if (textAlign != null) { data.setTextAlign(textAlign); } if (column.isNumeric()) { data.addStyleName(TableCssName.NUMERIC); } // Apply the style properties Style style = data.getElement().getStyle(); Map<StyleName, String> styleProps = column.getStyleProperties(); if (styleProps != null) { styleProps.forEach((s, v) -> style.setProperty(s.styleName(), v)); } // Hide if defined as not visible // This can be the case when a header is toggled off. if (!visible) { data.$this().hide(); } } return data; }
From source file:gwt.material.design.client.data.BaseRenderer.java
License:Apache License
@Override public TableHeader drawColumnHeader(Column<T, ?> column, String header, int index) { MaterialIcon sortIcon = new MaterialIcon(); sortIcon.setIconSize(sortIconSize);/*from w w w . j av a2 s . com*/ TableHeader th = new TableHeader(sortIcon); th.setId("col" + index); th.setHeader(header); HideOn hideOn = column.getHideOn(); if (hideOn != null) { th.setHideOn(hideOn); } TextAlign textAlign = column.getTextAlign(); if (textAlign != null) { th.setTextAlign(textAlign); } if (column.isNumeric()) { th.addStyleName(TableCssName.NUMERIC); } // Apply the style properties Style style = th.getElement().getStyle(); Map<StyleName, String> styleProps = column.getStyleProperties(); if (styleProps != null) { styleProps.forEach((s, v) -> style.setProperty(s.styleName(), v)); } // Set the headers width String width = column.getWidth(); if (width != null) { th.setWidth(width); } th.setVisible(true); return th; }
From source file:gwt.material.design.demo.client.application.menu.MenuView.java
License:Apache License
@Inject MenuView(Binder uiBinder) {/*from w ww . ja va 2 s . co m*/ initWidget(uiBinder.createAndBindUi(this)); sideNav.addHandler(new SideNavPushHandler() { @Override public void onPush(SideNavPushEvent event) { int duration = event.getDuration(); int width = event.getWidth(); Style style = navBar.getElement().getStyle(); style.setProperty("transition", duration + "ms"); style.setProperty("mozTransition", duration + "ms"); style.setProperty("webkitTransition", duration + "ms"); navBar.getElement().getStyle().setProperty("width", "calc(100% - " + width + "px)"); navBarSearch.getElement().getStyle().setProperty("width", "calc(100% - " + width + "px)"); } }, SideNavPushEvent.TYPE); // search close event txtSearch.addCloseHandler(new CloseHandler<String>() { @Override public void onClose(CloseEvent<String> event) { navBar.setVisible(true); navBarSearch.setVisible(false); } }); initSearches(); }
From source file:ilarkesto.gwt.client.desktop.BuilderPanel.java
License:Open Source License
private SimplePanel horizontalWrapper(IsWidget child, String width) { SimplePanel wrapper = new SimplePanel(child.asWidget()); wrapper.setStyleName("goon-horizontalWrapper"); Style style = wrapper.getElement().getStyle(); style.setProperty("display", "table-cell"); if (childTextAlign != null) style.setTextAlign(childTextAlign); if (width != null) wrapper.setWidth(width);/*w w w .j a v a2 s .c o m*/ return wrapper; }