use of com.vaadin.server.SizeWithUnit in project charts by vaadin.
the class PlotOptionsBubble method setMaxSize.
/**
* Sets the maxSize using String presentation. String presentation is
* similar to what is used in Cascading Style Sheets. Size can be pixels or
* percentage, otherwise IllegalArgumentException is thrown. The empty
* string ("") or null will unset the height and set the units to pixels.
*
* @param maxSize
* CSS style string representation
*/
public void setMaxSize(String maxSize) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(maxSize);
if (sizeWithUnit != null) {
Unit unit = sizeWithUnit.getUnit();
if (!(unit.equals(Unit.PERCENTAGE) || unit.equals(Unit.PIXELS))) {
throw new IllegalArgumentException(unit.toString() + "is not a valid unit for sizing. Only percentage and pixels are allowed.");
}
setMaxSize(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setMaxSize(-1, Unit.PIXELS);
}
}
use of com.vaadin.server.SizeWithUnit in project charts by vaadin.
the class PlotOptionsErrorbar method setWhiskerLength.
/**
* Sets the whiskerLength using String presentation. String presentation is
* similar to what is used in Cascading Style Sheets. Size can be pixels or
* percentage, otherwise IllegalArgumentException is thrown. The empty
* string ("") or null will unset the height and set the units to pixels.
*
* @param whiskerLength
* CSS style string representation
*/
public void setWhiskerLength(String whiskerLength) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(whiskerLength);
if (sizeWithUnit != null) {
Unit unit = sizeWithUnit.getUnit();
if (!(unit.equals(Unit.PERCENTAGE) || unit.equals(Unit.PIXELS))) {
throw new IllegalArgumentException(unit.toString() + "is not a valid unit for sizing. Only percentage and pixels are allowed.");
}
setWhiskerLength(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setWhiskerLength(-1, Unit.PIXELS);
}
}
use of com.vaadin.server.SizeWithUnit in project charts by vaadin.
the class PlotOptionsFunnel method setHeight.
/**
* Sets the height using String presentation. String presentation is similar
* to what is used in Cascading Style Sheets. Size can be pixels or
* percentage, otherwise IllegalArgumentException is thrown. The empty
* string ("") or null will unset the height and set the units to pixels.
*
* @param height
* CSS style string representation
*/
public void setHeight(String height) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(height);
if (sizeWithUnit != null) {
Unit unit = sizeWithUnit.getUnit();
if (!(unit.equals(Unit.PERCENTAGE) || unit.equals(Unit.PIXELS))) {
throw new IllegalArgumentException(unit.toString() + "is not a valid unit for sizing. Only percentage and pixels are allowed.");
}
setHeight(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setHeight(-1, Unit.PIXELS);
}
}
use of com.vaadin.server.SizeWithUnit in project charts by vaadin.
the class PlotOptionsFunnel method setNeckWidth.
/**
* Sets the neckWidth using String presentation. String presentation is
* similar to what is used in Cascading Style Sheets. Size can be pixels or
* percentage, otherwise IllegalArgumentException is thrown. The empty
* string ("") or null will unset the height and set the units to pixels.
*
* @param neckWidth
* CSS style string representation
*/
public void setNeckWidth(String neckWidth) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(neckWidth);
if (sizeWithUnit != null) {
Unit unit = sizeWithUnit.getUnit();
if (!(unit.equals(Unit.PERCENTAGE) || unit.equals(Unit.PIXELS))) {
throw new IllegalArgumentException(unit.toString() + "is not a valid unit for sizing. Only percentage and pixels are allowed.");
}
setNeckWidth(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setNeckWidth(-1, Unit.PIXELS);
}
}
use of com.vaadin.server.SizeWithUnit in project charts by vaadin.
the class PlotOptionsFunnel method setNeckHeight.
/**
* Sets the neckHeight using String presentation. String presentation is
* similar to what is used in Cascading Style Sheets. Size can be pixels or
* percentage, otherwise IllegalArgumentException is thrown. The empty
* string ("") or null will unset the height and set the units to pixels.
*
* @param neckHeight
* CSS style string representation
*/
public void setNeckHeight(String neckHeight) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(neckHeight);
if (sizeWithUnit != null) {
Unit unit = sizeWithUnit.getUnit();
if (!(unit.equals(Unit.PERCENTAGE) || unit.equals(Unit.PIXELS))) {
throw new IllegalArgumentException(unit.toString() + "is not a valid unit for sizing. Only percentage and pixels are allowed.");
}
setNeckHeight(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setNeckHeight(-1, Unit.PIXELS);
}
}
Aggregations