@Override public void setDisabled(boolean isDisable) { if (isDisable) { handle.getElement().setTabIndex(-1); } else { handle.getElement().setTabIndex(getTabIndex()); } super.setDisabled(isDisable); }
@Override public void setTabIndex(int tabIndex) { this.tabIndex = tabIndex; if (!isDisabled()) handle.getElement().setTabIndex(tabIndex); }
@Override public void onMouseDown(Event event) { event.preventDefault(); if (isDisabled()) { return; } handle.enable(event); }
private void positionKnob() { double p = 1.0 - (getMaxValue() - getValue()) / (getMaxValue() - getMinValue()); if (range != null) { if (isVertical()) { double y = Math.round((1.0 - p) * (getOffsetHeight() - 20.0)); handle.setPosition(y + 10.0); double rangeValue = getOffsetHeight() - (y + 10.0); range.getStyle().setHeight(rangeValue, Style.Unit.PX); } else { double x = Math.round(p * (getOffsetWidth() - 20.0)); handle.setPosition(x + 10.0); range.getStyle().setWidth(x + 10.0, Style.Unit.PX); } } }
private void calcValue(Event event) { Point mouseDownOffset = handle.getMouseDownOffset(); double offsetx = event.getClientX() - getElement().getAbsoluteLeft() - mouseDownOffset.x, offsety = event.getClientY() - getElement().getAbsoluteTop() - mouseDownOffset.y; double dv; if (isVertical()) { dv = valueOfKnobPosition(offsety); } else { dv = valueOfKnobPosition(offsetx); } setValue(dv); }