Browse Source

#8026 Removed deprecated API from Slider/VSlider

tags/7.0.0.alpha1
Artur Signell 12 years ago
parent
commit
ee4a992168
2 changed files with 0 additions and 149 deletions
  1. 0
    33
      src/com/vaadin/terminal/gwt/client/ui/VSlider.java
  2. 0
    116
      src/com/vaadin/ui/Slider.java

+ 0
- 33
src/com/vaadin/terminal/gwt/client/ui/VSlider.java View File

@@ -39,16 +39,13 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
private boolean immediate;
private boolean disabled;
private boolean readonly;
private boolean scrollbarStyle;
private int acceleration = 1;
private int handleSize;
private double min;
private double max;
private int resolution;
private Double value;
private boolean vertical;
private boolean arrows;
private final HTML feedback = new HTML("", false);
private final VOverlay feedbackPopup = new VOverlay(true, false, true) {
@@ -130,20 +127,12 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
readonly = uidl.getBooleanAttribute("readonly");
vertical = uidl.hasAttribute("vertical");
arrows = uidl.hasAttribute("arrows");
String style = "";
if (uidl.hasAttribute("style")) {
style = uidl.getStringAttribute("style");
}
scrollbarStyle = style.indexOf("scrollbar") > -1;
if (arrows) {
DOM.setStyleAttribute(smaller, "display", "block");
DOM.setStyleAttribute(bigger, "display", "block");
}
if (vertical) {
addStyleName(CLASSNAME + "-vertical");
} else {
@@ -157,8 +146,6 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
setFeedbackValue(value);
handleSize = uidl.getIntAttribute("hsize");
buildBase();
if (!vertical) {
@@ -233,30 +220,10 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field,
}
private void buildHandle() {
final String styleAttribute = vertical ? "height" : "width";
final String handleAttribute = vertical ? "marginTop" : "marginLeft";
final String domProperty = vertical ? "offsetHeight" : "offsetWidth";
DOM.setStyleAttribute(handle, handleAttribute, "0");
if (scrollbarStyle) {
// Only stretch the handle if scrollbar style is set.
int s = (int) (Double.parseDouble(DOM.getElementProperty(base,
domProperty)) / 100 * handleSize);
if (handleSize == -1) {
final int baseS = Integer.parseInt(DOM.getElementProperty(base,
domProperty));
final double range = (max - min) * (resolution + 1) * 3;
s = (int) (baseS - range);
}
if (s < 3) {
s = 3;
}
DOM.setStyleAttribute(handle, styleAttribute, s + "px");
} else {
DOM.setStyleAttribute(handle, styleAttribute, "");
}
// Restore visibility
DOM.setStyleAttribute(handle, "visibility", "visible");

+ 0
- 116
src/com/vaadin/ui/Slider.java View File

@@ -53,15 +53,6 @@ public class Slider extends AbstractField<Double> {

public static final int ORIENTATION_VERTICAL = 1;

/**
* Style constant representing a scrollbar styled slider. Use this with
* {@link #addStyleName(String)}. Default styling usually represents a
* common slider found e.g. in Adobe Photoshop. The client side
* implementation dictates how different styles will look.
*/
@Deprecated
public static final String STYLE_SCROLLBAR = "scrollbar";

/** Minimum value of slider */
private double min = 0;

@@ -79,35 +70,6 @@ public class Slider extends AbstractField<Double> {
*/
private int orientation = ORIENTATION_HORIZONTAL;

/**
* Slider size in pixels. In horizontal mode, if set to -1, allow 100% width
* of container. In vertical mode, if set to -1, default height is
* determined by the client-side implementation.
*
* @deprecated
*/
@Deprecated
private int size = -1;

/**
* Handle (draggable control element) size in percents relative to base
* size. Must be a value between 1-99. Other values are converted to nearest
* bound. A negative value sets the width to auto (client-side
* implementation calculates).
*
* @deprecated The size is dictated by the current theme.
*/
@Deprecated
private int handleSize = -1;

/**
* Show arrows that can be pressed to slide the handle in some increments
* (client-side implementation decides the increment, usually somewhere
* between 5-10% of slide range).
*/
@Deprecated
private final boolean arrows = false;

/**
* Default slider constructor. Sets all values to defaults and the slide
* handle at minimum value.
@@ -305,70 +267,6 @@ public class Slider extends AbstractField<Double> {
super.setValue(newValue, repaintIsNotNeeded);
}

/**
* Get the current slider size.
*
* @return size in pixels or -1 for auto sizing.
* @deprecated use standard getWidth/getHeight instead
*/
@Deprecated
public int getSize() {
return size;
}

/**
* Set the size for this slider.
*
* @param size
* in pixels, or -1 auto sizing.
* @deprecated use standard setWidth/setHeight instead
*/
@Deprecated
public void setSize(int size) {
this.size = size;
switch (orientation) {
case ORIENTATION_HORIZONTAL:
setWidth(size, UNITS_PIXELS);
break;
default:
setHeight(size, UNITS_PIXELS);
break;
}
requestRepaint();
}

/**
* Get the handle size of this slider.
*
* @return handle size in percentages.
* @deprecated The size is dictated by the current theme.
*/
@Deprecated
public int getHandleSize() {
return handleSize;
}

/**
* Set the handle size of this slider.
*
* @param handleSize
* in percentages relative to slider base size.
* @deprecated The size is dictated by the current theme.
*/
@Deprecated
public void setHandleSize(int handleSize) {
if (handleSize < 0) {
this.handleSize = -1;
} else if (handleSize > 99) {
this.handleSize = 99;
} else if (handleSize < 1) {
this.handleSize = 1;
} else {
this.handleSize = handleSize;
}
requestRepaint();
}

@Override
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
@@ -391,20 +289,6 @@ public class Slider extends AbstractField<Double> {
target.addAttribute("vertical", true);
}

if (arrows) {
target.addAttribute("arrows", true);
}

if (size > -1) {
target.addAttribute("size", size);
}

if (min != max && min < max) {
target.addAttribute("hsize", handleSize);
} else {
target.addAttribute("hsize", 100);
}

}

/**

Loading…
Cancel
Save