List of usage examples for com.google.gwt.query.client GQuery elements
Element[] elements
To view the source code for com.google.gwt.query.client GQuery elements.
Click Source Link
From source file:com.arcbees.chosen.client.ChosenImpl.java
License:Apache License
private void winnowResultsClear() { searchField.val(""); GQuery lis = searchResults.find("li"); for (Element li : lis.elements()) { GQuery $li = $(li);//from ww w . j av a2 s. c o m if ($li.hasClass(css.groupResult())) { $li.css("display", ""); } else if (shouldActivateResult($li)) { resultActivate($li); } $li.removeClass(css.foundResult()); } }
From source file:com.arcbees.gquery.elastic.client.ElasticImpl.java
License:Apache License
void update(boolean fullUpdate) { int prevColumnNumber = columnHeights.size(); columnHeights.clear();/*from w ww.j a va2 s .c o m*/ columnPriorities.clear(); ignoredColumn.clear(); GQuery $container = $(container); // check if children returns text elements GQuery items = $container.children(); containerPaddingLeft = $container.cur("paddingLeft", true); containerPaddingRight = $container.cur("paddingRight", true); containerPaddingTop = $container.cur("paddingTop", true); containerPaddingBottom = $container.cur("paddingBottom", true); double totalColumnWidth = $container.innerWidth() - containerPaddingLeft - containerPaddingRight; int colNumber = calculateNumberOfColumn(totalColumnWidth); columnWidth = (totalColumnWidth - ((colNumber - 1) * options.getInnerColumnMargin())) / colNumber; columnWidth = max(columnWidth, options.getMinimumColumnWidth()); if (options.getMaximumColumnWidth() != -1) { int maxWidth = max(options.getMinimumColumnWidth(), options.getMaximumColumnWidth()); columnWidth = min(columnWidth, maxWidth); } double initialTop = useTranslate3d ? 0 : containerPaddingTop; for (int i = 0; i < colNumber; i++) { columnHeights.add(initialTop); columnPriorities.add(i); ignoredColumn.add(false); } // Use four different loops in order to avoid browser reflows if (fullUpdate) { for (Element e : items.elements()) { initItem(e); } } if (!canUseCalc() || prevColumnNumber != colNumber) { for (Element e : items.elements()) { setItemWidth(e, colNumber); } } for (Element e : items.elements()) { readItemHeight(e); } for (Element e : items.elements()) { placeItem(e, colNumber); } setHeightContainer(); }
From source file:com.watopi.chosen.client.ChosenImpl.java
License:Open Source License
private void winnowResultsClear() { searchField.val(""); GQuery lis = searchResults.find("li"); for (Element li : lis.elements()) { GQuery $li = $(li);/*www .ja va 2 s.c o m*/ if ($li.hasClass(css.groupResult())) { $li.css("display", ""); } else if (!isMultiple || !$li.hasClass(css.resultSelected())) { resultActivate($li); } } }
From source file:com.wcs.wcslib.vaadin.widget.filtertablestate.client.FilterTableStateConnector.java
License:Apache License
private void displayBtn(HTML profileLayoutDiv, boolean hide) { GQuery hideAble = $("." + HIDEABLE_STYLE, profileLayoutDiv); String opacity = hide ? "0" : "1"; for (Element element : hideAble.elements()) { GQuery btns = $("." + BUTTON_STYLE, element); btns.css("opacity", opacity); }/*from ww w .j a v a 2s . c o m*/ }
From source file:gwtquery.plugins.draggable.client.Draggable.java
License:Apache License
@Override protected boolean mouseStop(Element initialDraggable, final GqEvent event) { boolean result = false; DragContext ctx = new DragContext(initialDraggable, initialDraggable, selectedDraggables); result |= mouseStopImpl(ctx, event); for (Element draggable : selectedDraggables) { if (draggable != initialDraggable) { ctx = new DragContext(draggable, initialDraggable, selectedDraggables); result |= mouseStopImpl(ctx, event); }/*from w w w . ja v a 2 s . c o m*/ } DraggableOptions options = getOptions(initialDraggable); // deselect automatic selected elements // select other draggable elements if select options is set SelectFunction selectFunction = options.getSelect(); if (selectFunction != null) { GQuery followers = selectFunction.selectElements(); for (Element e : followers.elements()) { unselect(e); } } return result; }
From source file:gwtquery.plugins.draggable.client.Draggable.java
License:Apache License
private boolean isHandleClicked(Element draggable, final GqEvent event) { DraggableOptions options = getOptions(draggable); // if no handle or if specified handle is not inside the draggable element, // continue/*from ww w .j a v a 2 s . c o m*/ if (options.getHandle() == null || $(options.getHandle(), draggable).length() == 0) { return true; } // OK, we have a valid handle, check if we are clicking on the handle object // or one of its descendants GQuery handleAndDescendant = $(options.getHandle(), draggable).find("*").andSelf(); for (Element e : handleAndDescendant.elements()) { if (e == event.getEventTarget().cast()) { return true; } } return false; }
From source file:gwtquery.plugins.draggable.client.DraggableHandler.java
License:Apache License
private boolean isElementAttached(GQuery $element) { // normally this test helper.parents().filter("body").length() == 0 is // sufficient but they are a bug in gwtquery in filter function // return helper.parents().filter("body").length() == 0; GQuery parents = $element.parents(); for (Element parent : parents.elements()) { if (parent == body) { return true; }/*www. j a v a2 s .c o m*/ } return false; }
From source file:gwtquery.plugins.draggable.client.plugins.SnapPlugin.java
License:Apache License
public void onStart(DraggableHandler handler, DragContext ctx, GqEvent e) { Element draggableElement = ctx.getDraggable(); List<SnapElement> snapElements = new ArrayList<SnapElement>(); GQuery snap = (handler.getOptions().getSnap_$() != null ? handler.getOptions().getSnap_$() : $(handler.getOptions().getSnap())); for (Element element : snap.elements()) { if (element != draggableElement) { GQuery $element = $(element); snapElements.add(new SnapElement($element.offset(), $element.outerWidth(), $element.outerHeight())); }/*from w w w . j a v a 2s . c o m*/ } $(draggableElement).data(SNAP_ELEMENTS_KEY, snapElements); }
From source file:gwtquery.plugins.draggable.client.plugins.StackPlugin.java
License:Apache License
public void onStart(DraggableHandler info, DragContext ctx, GqEvent e) { GQuery stackElements = info.getOptions().getStack(); Element[] sortedElementArray = stackElements.elements(); Arrays.sort(sortedElementArray, new ZIndexComparator()); if (sortedElementArray.length == 0) { return;// ww w .j a v a 2 s .c o m } int zIndexMin = getZindex(sortedElementArray[0]); int i = 0; for (Element el : sortedElementArray) { el.getStyle().setZIndex(zIndexMin + i); i++; } info.getHelper().get(0).getStyle().setZIndex(zIndexMin + sortedElementArray.length); }
From source file:gwtquery.plugins.droppable.client.DragAndDropManagerImpl.java
License:Apache License
@Override public void initialize(Element draggable, GqEvent e) { DraggableHandler draggableHandler = DraggableHandler.getInstance(draggable); Collection<Element> droppables = getDroppablesByScope(draggableHandler.getOptions().getScope()); if (droppables == null || droppables.size() == 0) { return;//from w ww. j a v a 2s. c o m } GQuery droppablesInsideDraggable = $(draggable).find("." + CssClassNames.GWTQUERY_DROPPABLE).andSelf(); for (Element droppable : droppables) { GQuery $droppable = $(droppable); DroppableHandler droppableHandler = DroppableHandler.getInstance(droppable); droppableHandler.reset(); DroppableOptions droppableOptions = droppableHandler.getOptions(); AcceptFunction accept = droppableOptions.getAccept(); if (droppableOptions.isDisabled() || (accept != null && !accept.acceptDrop(new DragAndDropContext(draggable, droppable)))) { continue; } boolean mustContinue = false; for (Element el : droppablesInsideDraggable.elements()) { if (el == droppable) { // droppableHandler.setDroppableDimension(new Dimension(0, 0)); mustContinue = true; break; } } if (mustContinue) { continue; } droppableHandler.setVisible(!"none".equals(droppable.getStyle().getDisplay())); if (droppableHandler.isVisible()) { droppableHandler.setDroppableOffset($droppable.offset()); droppableHandler.setDroppableDimension(new Dimension(droppable)); if (e == null || e.getTypeInt() == ONMOUSEDOWN) { droppableHandler.activate(droppable, e); } } } }