List of usage examples for com.google.gwt.user.client.ui Widget addStyleName
public void addStyleName(String style)
From source file:org.xwiki.gwt.wysiwyg.client.plugin.macro.input.InputFactory.java
License:Open Source License
/** * Creates a new input control that collects user data of the specified type. Common types are {@code * java.lang.String} and {@code boolean}. * //from w w w. j a va 2s.co m * @param type the type of a macro parameter * @return the newly created input control */ public static Widget createInput(ParameterType type) { // TODO: This needs to be improved! // NOTE: We hard-code the class names to be able to compile the GWT code with the disableClassMetadata flag on. // This way we can reduce the size of the generated JavaScript code. String className = type.getName(); if ("java.lang.StringBuffer".equals(className)) { // Large string, let's use a text area. return new TextInput(new TextArea()); } else if ("boolean".equals(className) || "java.lang.Boolean".equals(className)) { return createBooleanInput(); } else if (type.isEnum()) { return createChoiceInput(type.getEnumConstants()); } else { // By default we use an input box. Widget input = new TextInput(new TextBox()); input.addStyleName("textInput"); return input; } }
From source file:org.zanata.webtrans.client.view.AppView.java
License:Open Source License
private void setSelectedTab(Widget tab) { editorTab.removeStyleName(style.selectedTab()); searchAndReplaceTab.removeStyleName(style.selectedTab()); documentListTab.removeStyleName(style.selectedTab()); tab.addStyleName(style.selectedTab()); }
From source file:org.zanata.webtrans.client.view.AppView.java
License:Open Source License
private void enableTab(Widget tab, boolean enable) { if (enable) { tab.removeStyleName(style.disableTab()); } else {/* w w w.j av a2s . c o m*/ tab.addStyleName(style.disableTab()); } }
From source file:pl.balon.gwt.diagramsexample.client.examples.DiagramBuilderExample.java
License:Apache License
private Widget createToolboxNode(String label, String style) { Widget node = new Label(label); node.setStyleName("toolbox-node"); node.addStyleName(style); toolbox.add(node);/*from www .j a v a2 s . co m*/ toolboxDragController.makeDraggable(node); return node; }
From source file:pl.balon.gwt.diagramsexample.client.examples.DiagramBuilderExample.java
License:Apache License
protected void select(Widget w) { if (selected.isEmpty()) { w.addStyleName("selected-connector"); Collection cons = UIObjectConnector.getWrapper(w).getConnections(); for (Iterator i = cons.iterator(); i.hasNext();) { // TODO list iterator ? Connection c = (Connection) i.next(); c.remove();/*from w ww . j a va2 s .c o m*/ remove(c); // TODO maybe in one } selected.add(w); } else if (selected.contains(w)) { w.removeStyleName("selected-connector"); selected.remove(w); } else if (selected.size() == 1) { Widget w2 = (Widget) selected.get(0); w.removeStyleName("selected-connector"); w2.removeStyleName("selected-connector"); Collection cons = UIObjectConnector.getWrapper(w).getConnections(); for (Iterator i = cons.iterator(); i.hasNext();) { // TODO list iterator ? Connection c = (Connection) i.next(); c.remove(); remove(c); // TODO maybe in one } connect(UIObjectConnector.getWrapper(w2), UIObjectConnector.getWrapper(w)); selected.clear(); } }
From source file:rocket.widget.client.Calendar.java
License:Apache License
/** * Adds all headings for this calendar to the first row of the calendarGrid. * This method should only be invoked once usually as part of the * {@link #createWidget()} method./*from w w w . j a v a2 s. c om*/ * * @param grid * The new grid */ protected void addHeadings(final Grid grid) { for (int dayOfWeek = 0; dayOfWeek < WidgetConstants.CALENDAR_COLUMNS; dayOfWeek++) { final Widget heading = this.createHeading(dayOfWeek); heading.addStyleName(WidgetConstants.CALENDAR_HEADING_STYLE); grid.setWidget(0, dayOfWeek, heading); } }
From source file:rocket.widget.client.tabpanel.TabPanel.java
License:Apache License
public void select(final int index) { final TabItem newlySelectedItem = this.get(index); TabItem previousSelection = null;// w w w . ja v a2 s. co m final int previouslySelectedIndex = this.getSelectedIndex(); if (-1 != previouslySelectedIndex) { previousSelection = this.get(previouslySelectedIndex); } final BeforeTabSelectEvent beforeSelected = new BeforeTabSelectEvent(); beforeSelected.setCurrentSelection(previousSelection); beforeSelected.setNewSelection(newlySelectedItem); final TabListenerCollection listeners = this.getTabListeners(); listeners.fireBeforeTabSelected(beforeSelected); if (false == beforeSelected.isCancelled()) { final String selectedStyle = this.getTabBarItemSelectedStyleName(); final TabBarPanel tabBarPanel = this.getTabBarPanel(); final DeckPanel contentPanel = this.getContentPanel(); // find the previously selected tab. and unselect it. final int previousIndex = contentPanel.getVisibleWidget(); TabItem previouslySelectedTabItem = null; if (-1 != previousIndex) { final Widget tab = tabBarPanel.getWidget(previousIndex + 1); tab.removeStyleName(selectedStyle); previouslySelectedTabItem = this.get(previousIndex); } // apply the style to the new tab. final Widget tabBarItemPanel = tabBarPanel.getWidget(index + 1); tabBarItemPanel.addStyleName(selectedStyle); // tell the deckPanel to select a new sub-widget. contentPanel.showWidget(index); final TabSelectEvent selectedEvent = new TabSelectEvent(); selectedEvent.setPreviouslySelected(previouslySelectedTabItem); selectedEvent.setCurrentSelection(newlySelectedItem); listeners.fireTabSelected(selectedEvent); } }
From source file:rocket.widget.client.Viewport.java
License:Apache License
/** * This factory method is called each tile a tile needs to be created. * * Note that the location of the tile is passed as a column row coordinate * and not actual pixels coordinates.//from w ww . j ava 2 s .co m * * @param column * The column that the tile appears in. * @param row * The row that the tile appears in. * @return */ protected Widget createTile(final int column, final int row) { final Widget tile = this.createTile0(column, row); tile.addStyleName(this.getTileStyle()); InlineStyle.getInlineStyle(tile.getElement()).setString(Css.POSITION, "absolute"); this.setTileLeft(tile, column * this.getTileWidth()); this.setTileTop(tile, row * this.getTileHeight()); return tile; }
From source file:ru.codeinside.gses.vaadin.client.VScrollableForm.java
License:Mozilla Public License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { super.updateFromUIDL(uidl, client); if (uidl.hasAttribute(SCROLL_TO)) { final Paintable paintable = uidl.getPaintableAttribute(SCROLL_TO, client); if (paintable != null) { final Widget widget = (Widget) paintable; final Widget parent = widget.getParent(); parent.getElement().scrollIntoView(); if (widget instanceof Focusable) { ((Focusable) widget).setFocus(true); }//from www .j a va2 s .c o m parent.addStyleName(HIGHLIGHTED); new Timer() { public void run() { parent.removeStyleName(HIGHLIGHTED); } }.schedule(1333); } } }
From source file:ru.fly.client.ui.toolbar.ToolBar.java
License:Apache License
public void addRight(Widget child) { child.addStyleName(res.css().button()); child.getElement().getStyle().setFloat(Style.Float.RIGHT); add(child); }