List of usage examples for com.google.gwt.query.client GQuery cur
public double cur(String prop, boolean force)
From source file:com.arcbees.chosen.client.ChosenImpl.java
License:Apache License
protected int getSideBorderPadding(GQuery elmt, boolean isHidden) { if (isHidden) { // bug in gquery when one parent of the element is hidden return (int) (elmt.cur("padding-left", true) + elmt.cur("padding-right", true) + elmt.cur("border-left-width", true) + elmt.cur("border-right-width", true)); }/*from w w w. j a va 2 s. com*/ return elmt.outerWidth() - elmt.width(); }
From source file:com.arcbees.gquery.elastic.client.ElasticImpl.java
License:Apache License
void update(boolean fullUpdate) { int prevColumnNumber = columnHeights.size(); columnHeights.clear();//from ww w . j ava 2s . co 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.arcbees.gquery.elastic.client.ElasticImpl.java
License:Apache License
private StyleInfo initItem(Element e) { int span = getSpan(e); Integer floatColumn = null;//ww w.j a va2s . c o m String floatValue = e.getAttribute(Elastic.COLUMN_ATTRIBUTE); if (FIRST.equalsIgnoreCase(floatValue)) { floatColumn = 0; } else if (LAST.equalsIgnoreCase(floatValue)) { floatColumn = -span; } else { try { floatColumn = Integer.parseInt(floatValue) - 1; } catch (NumberFormatException ignored) { } } GQuery $e = $(e); StyleInfo styleInfo = new StyleInfo(); styleInfo.span = getSpan(e); styleInfo.rowSpanAll = "all".equals(e.getAttribute(Elastic.ROW_SPAN_ATTRIBUTE)); styleInfo.floatColumn = floatColumn; styleInfo.marginRight = $e.cur("marginRight", true); styleInfo.marginLeft = $e.cur("marginLeft", true); styleInfo.borderTopWidth = $e.cur("borderTopWidth", true); styleInfo.borderBottomWidth = $e.cur("borderBottomWidth", true); styleInfo.marginTop = $e.cur("marginTop", true); styleInfo.marginBottom = $e.cur("marginBottom", true); $e.data(STYLE_INFO_KEY, styleInfo); $e.css("position", "absolute"); // TODO Ease next width computation but check the impact of this in the content of the item if (GQuery.browser.mozilla) { $e.css("moz-box-sizing", "border-box"); } else { $e.css("box-sizing", "border-box"); } return styleInfo; }
From source file:com.watopi.chosen.client.ChosenImpl.java
License:Open Source License
private int getSideBorderPadding(GQuery elmt, boolean isHidden) { if (isHidden) { //bug in gquery when one parent of the element is hidden return (int) (elmt.cur("padding-left", true) + elmt.cur("padding-right", true) + elmt.cur("border-left-width", true) + elmt.cur("border-right-width", true)); }//ww w. j a v a2 s . com return elmt.outerWidth() - elmt.width(); }
From source file:gwtquery.plugins.draggable.client.plugins.OpacityPlugin.java
License:Apache License
public void onStart(DraggableHandler handler, DragContext ctx, GqEvent e) { Float opacity = handler.getOptions().getOpacity(); GQuery $helper = handler.getHelper(); double oldOpacity = $helper.cur(OPACITY_CSS_KEY, true); $helper.data(OLD_OPACITY_KEY, new Double(oldOpacity)); $helper.css(OPACITY_CSS_KEY, opacity.toString()); }