List of usage examples for com.google.gwt.user.client.ui Widget getStyleName
public String getStyleName()
From source file:annis.gui.widgets.gwt.client.ui.VGripDragComponent.java
License:Apache License
private boolean startDrag(NativeEvent event) { VTransferable transferable = new VTransferable(); transferable.setDragSource(ConnectorMap.get(client).getConnector(this)); Element targetElement = (Element) event.getEventTarget().cast(); Paintable paintable;/*from w ww . j a va2s . co m*/ Widget w = Util.findWidget(targetElement, null); if (!w.getStyleName().contains("drag-source-enabled")) { return false; } while (w != null && !(w instanceof Paintable)) { w = w.getParent(); } paintable = (Paintable) w; transferable.setData("component", paintable); VDragEvent dragEvent = VDragAndDropManager.get().startDrag(transferable, event, true); transferable.setData("clientX", event.getClientX()); transferable.setData("clientY", event.getClientY()); dragEvent.createDragImage(getElement(), true); return true; }
From source file:cc.alcina.framework.gwt.client.objecttree.ObjectTreeGridRenderer.java
License:Apache License
@Override protected void renderToPanel(TreeRenderable renderable, ComplexPanel cp, int depth, boolean soleChild, RenderContext renderContext, TreeRenderer parent) { super.renderToPanel(renderable, cp, depth, soleChild, renderContext, parent); if (depth == 0) { cellFormatter = (FlexCellFormatter) ft.getCellFormatter(); int widgetCount = cp.getWidgetCount(); colCountMax = 0;// w w w . j a v a2s . c om int level1WidgetIndex = -1; int row = -1; int col = 0; for (int i = 0; i < widgetCount; i++) { Widget w = cp.getWidget(0);// we'll be removing widgets, so // we'll always be looking at (0) if (w.getStyleName().contains("level-1")) { level1WidgetIndex = i; row++; col = 0; level1RendererRows.put(row, level1LabelMap.get(w)); } else { colCountMax = Math.max(colCountMax, i - level1WidgetIndex); } ft.setWidget(row, col, w); cellFormatter.setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_BOTTOM); if (col == 0) { cellFormatter.setStyleName(row, col, "td0"); } boolean isCustomiser = w.getStyleName().contains("customiser"); if (col == 1) {// && isCustomiser) { if (isCustomiser && !level1RendererRows.get(row).isSingleLineCustomiser()) { cellFormatter.setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP); cellFormatter.addStyleName(row, 0, "multiline-caption"); } level1Rows.put(row, w); } // note, at this point, getWidget(0) is the _next_ widget boolean nextWidgetIsNewRow = i == widgetCount - 1 || cp.getWidget(0).getStyleName().contains("level-1"); if (nextWidgetIsNewRow) { cellFormatter.setColSpan(row, col, colCountMax - col + 1); } col++; } cp.clear(); cp.add(ft); } return; }
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
public static void toggleStyleName(Widget w, String styleName) { String current = w.getStyleName(); if (current.contains(styleName)) { w.removeStyleName(styleName);/*from w ww .ja v a 2 s . c o m*/ } else { w.addStyleName(styleName); } }
From source file:cc.kune.bootstrap.client.actions.ui.BSToolbarMenuGui.java
License:GNU Affero Public License
private void clearCurrentActiveItem() { final int count = menu.getWidgetCount(); for (int cur = 0; cur < count; cur++) { final Widget item = menu.getList().getWidget(cur); final List<String> styles = Arrays.asList(item.getStyleName().split(" ")); if (styles.contains(Styles.ACTIVE)) { item.removeStyleName(Styles.ACTIVE); }//from w w w.j a v a2s . c om } }
From source file:cc.kune.bootstrap.client.actions.ui.BSToolbarMenuGui.java
License:GNU Affero Public License
@Override public AbstractGuiItem create(final GuiActionDescrip descriptor) { super.descriptor = descriptor; descriptor.putValue(ParentWidget.PARENT_UI, this); final GuiActionDescrip parent = descriptor.getParent(); if (!(parent instanceof ToolbarDescriptor)) { throw new UIException("This menu should be used only in bootstrap toolbars. Menu: " + descriptor + " parent: " + parent); }/*from w w w . j a v a 2s. c om*/ final ListDropDown dDown = new ListDropDown(); menu = new ComplexDropDownMenu<ListDropDown>(dDown); final String ddid = HTMLPanel.createUniqueId(); dDown.getElement().setId(ddid); popup = new PopupBSMenuGui(menu.getList(), menu.getWidget(), descriptor); // TODO // final Boolean inline = (Boolean) // descriptor.getValue(MenuDescriptor.MENU_VERTICAL); // menu.setInline(inline); // descriptor.putValue(MenuDescriptor.MENU_SHOW_NEAR_TO, button); final ImageResource rightIcon = ((MenuDescriptor) descriptor).getRightIcon(); if (rightIcon != null) { menu.setIconRightResource(rightIcon); } descriptor.addPropertyChangeListener(new PropertyChangeListener() { private void activeNextItem(final int increment) { final int count = menu.getWidgetCount(); for (int cur = 0; cur < count && cur >= 0; cur = cur + increment) { final Widget item = menu.getList().getWidget(cur); final List<String> styles = Arrays.asList(item.getStyleName().split(" ")); if (styles.contains(Styles.ACTIVE)) { item.removeStyleName(Styles.ACTIVE); final int proposed = cur + increment; final int next = proposed >= count ? 0 : (proposed < 0) ? count - 1 : proposed; menu.getList().getWidget(next).addStyleName(Styles.ACTIVE); break; } } } @Override public void propertyChange(final PropertyChangeEvent event) { if (event.getPropertyName().equals(MenuDescriptor.MENU_SELECTION_DOWN)) { activeNextItem(1); } else if (event.getPropertyName().equals(MenuDescriptor.MENU_SELECTION_UP)) { activeNextItem(-1); } else if (event.getPropertyName().equals(MenuDescriptor.MENU_SELECT_ITEM)) { final HasMenuItem item = (HasMenuItem) ((MenuItemDescriptor) descriptor .getValue(MenuDescriptor.MENU_SELECT_ITEM)).getValue(MenuItemDescriptor.UI); clearCurrentActiveItem(); ((Widget) item).addStyleName(Styles.ACTIVE); } } }); final String id = descriptor.getId(); if (TextUtils.notEmpty(id) && !"undefined".equals(id)) { menu.ensureDebugId(id); } if (descriptor.isChild()) { child = menu.getWidget(); } else { initWidget(menu.getWidget()); } super.create(descriptor); configureItemFromProperties(); descriptor.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { final Object newValue = event.getNewValue(); if (event.getPropertyName().equals(MenuDescriptor.MENU_RIGHTICON)) { setIconRightResource((ImageResource) newValue); } } }); return this; }
From source file:ch.eaternity.client.Search.java
License:Apache License
public void setVDraggerHeight(String height) { // SplitLayoutPanel p = (SplitLayoutPanel) this.getWidget (); SplitLayoutPanel p = subMealsSplitPanels; int widgetCount = p.getWidgetCount(); for (int i = 0; i < widgetCount; i++) { Widget w = p.getWidget(i); if (w.getStyleName().equals("gwt-SplitLayoutPanel-VDragger")) { w.setHeight(height);// w w w.ja v a 2 s . c o m } } }
From source file:com.brazoft.foundation.gwt.client.ui.Widgets.java
License:Apache License
public static boolean isDisabledClass(Widget widget) { return widget.getStyleName().contains("disabled"); }
From source file:com.calclab.emite.example.pingpong.client.PingPongWidget.java
License:Open Source License
protected boolean isEventWidget(final Widget w) { final String styleName = w.getStyleName(); return styleName.contains(Style.eventBus) || styleName.contains(Style.stanzaReceived) || styleName.contains(Style.stanzaSent); }
From source file:com.ksyzt.gwt.client.ui.richeditor.RichTextToolbar.java
License:Open Source License
/** * Show popup./*from w w w . j a va 2s. c o m*/ * * @param attacheElement the attache element * @param w the w */ private void showPopup(Widget attacheElement, Widget w) { back_widget = attacheElement; if (w == null) { w = new HTMLPanel(""); w.setSize("100px", "100px"); m_ap_content.clear(); m_ap_content.add(w); } else { m_ap_content.clear(); m_ap_content.add(w); } m_ap_content.setVisible(true); m_ap_shadow.setVisible(true); m_ap_line.setVisible(true); int aleft = attacheElement.getAbsoluteLeft(); int atop = attacheElement.getAbsoluteTop(); int aw = attacheElement.getOffsetWidth(); int ah = attacheElement.getOffsetHeight(); int width = m_ap_content.getOffsetWidth(); int height = m_ap_content.getOffsetHeight(); int lbx = aleft; int lby = atop + ah; int rbx = lbx + aw; int rby = lby; Style style = m_ap_content.getElement().getStyle(); style.setLeft(rbx - width, Unit.PX); style.setTop(lby - 1, Unit.PX); style = m_ap_shadow.getElement().getStyle(); style.setLeft(rbx - width + 3, Unit.PX); style.setTop(lby + 2, Unit.PX); style.setWidth(width, Unit.PX); style.setHeight(height, Unit.PX); style = m_ap_line.getElement().getStyle(); style.setLeft(lbx + 1, Unit.PX); style.setTop(lby - 1, Unit.PX); style.setWidth(aw - 2, Unit.PX); back_css = attacheElement.getStyleName(); attacheElement.setStyleName("toolbar_over"); m_ap_content.getElement().focus(); m_b_show_popup = true; }
From source file:com.zipsoft.widgets.client.lazylayout.AbstractLazyLayoutConnector.java
License:Apache License
private void attachScrollHandlersIfNeeded() { // final Widget rootWidget = getConnection().getUIConnector().getWidget(); final Widget rootWidget = getWidget(); log("[LazyLayout] root component style name:" + rootWidget.getStyleName()); // if (VLazyLayout.DEBUG) { // VConsole.error("[LazyLayout] root component style name:" + rootWidget.getStyleName()); // }//w w w . ja v a2 s .c o m getWidget().attachScrollHandlersIfNeeded(rootWidget); }