public void iLayout() { if (isVertical()) { setHeight(); } // Update handle position setValue(value, false); }
void buildHandle() { final String handleAttribute = isVertical() ? "marginTop" : "marginLeft"; final String oppositeHandleAttribute = isVertical() ? "marginLeft" : "marginTop"; handle.getStyle().setProperty(handleAttribute, "0"); // clear unnecessary opposite handle attribute handle.getStyle().clearProperty(oppositeHandleAttribute); }
/** * TODO consider extracting touches support to an impl class specific for * webkit (only browser that really supports touches). * * @param event * @return */ protected int getEventPosition(Event event) { if (isVertical()) { return WidgetUtil.getTouchOrMouseClientY(event); } else { return WidgetUtil.getTouchOrMouseClientX(event); } }
final String styleAttribute = isVertical() ? "marginTop" : "marginLeft"; final String domProperty = isVertical() ? "offsetHeight" : "offsetWidth"; final int handleSize = handle.getPropertyInt(domProperty); p = 0; if (isVertical()) { p = range - p;
if (keycode == getNavigationUpKey() && isVertical() || keycode == getNavigationRightKey() && !isVertical()) { if (shift) { for (int a = 0; a < acceleration; a++) { } else if (keycode == getNavigationDownKey() && isVertical() || keycode == getNavigationLeftKey() && !isVertical()) { if (shift) { for (int a = 0; a < acceleration; a++) {
private void setValueByEvent(Event event, boolean updateToServer) { double v = min; // Fallback to min final int coord = getEventPosition(event); final int handleSize, baseSize, baseOffset; if (isVertical()) { handleSize = handle.getOffsetHeight(); baseSize = base.getOffsetHeight(); baseOffset = base.getAbsoluteTop() - Window.getScrollTop() - handleSize / 2; } else { handleSize = handle.getOffsetWidth(); baseSize = base.getOffsetWidth(); baseOffset = base.getAbsoluteLeft() - Window.getScrollLeft() + handleSize / 2; } if (isVertical()) { v = (baseSize - (coord - baseOffset)) / (double) (baseSize - handleSize) * (max - min) + min; } else { v = (coord - baseOffset) / (double) (baseSize - handleSize) * (max - min) + min; } if (v < min) { v = min; } else if (v > max) { v = max; } setValue(v, updateToServer); }
final String styleAttribute = isVertical() ? "height" : "width"; final String oppositeStyleAttribute = isVertical() ? "width" : "height"; final String domProperty = isVertical() ? "offsetHeight" : "offsetWidth"; final Element p = getElement(); if (p.getPropertyInt(domProperty) > MIN_SIZE) { if (isVertical()) { setHeight(); } else { if (!isVertical()) {
protected void updateStyleNames(String styleName, boolean isPrimaryStyleName) { removeStyleName(getStylePrimaryName() + "-vertical"); if (isPrimaryStyleName) { super.setStylePrimaryName(styleName); } else { super.setStyleName(styleName); } base.setClassName(getStylePrimaryName() + "-base"); handle.setClassName(getStylePrimaryName() + "-handle"); smaller.setClassName(getStylePrimaryName() + "-smaller"); bigger.setClassName(getStylePrimaryName() + "-bigger"); if (isVertical()) { addStyleName(getStylePrimaryName() + "-vertical"); } }