use of com.vaadin.server.Sizeable.Unit in project charts by vaadin.
the class Pane method setSize.
/**
* Sets the size 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 size
* CSS style string representation
*/
public void setSize(String size) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(size);
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.");
}
setSize(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setSize(-1, Unit.PIXELS);
}
}
use of com.vaadin.server.Sizeable.Unit in project charts by vaadin.
the class PlotBand method setInnerRadius.
/**
* Sets the innerRadius 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 innerRadius
* CSS style string representation
*/
public void setInnerRadius(String innerRadius) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(innerRadius);
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.");
}
setInnerRadius(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setInnerRadius(-1, Unit.PIXELS);
}
}
use of com.vaadin.server.Sizeable.Unit in project charts by vaadin.
the class PlotBand method setThickness.
/**
* Sets the thickness 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 thickness
* CSS style string representation
*/
public void setThickness(String thickness) {
SizeWithUnit sizeWithUnit = SizeWithUnit.parseStringSize(thickness);
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.");
}
setThickness(sizeWithUnit.getSize(), sizeWithUnit.getUnit());
} else {
setThickness(-1, Unit.PIXELS);
}
}
use of com.vaadin.server.Sizeable.Unit in project charts by vaadin.
the class PlotOptionsBoxplot 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.Sizeable.Unit in project cuba by cuba-platform.
the class WebSplitPanel method applySettings.
@Override
public void applySettings(Element element) {
if (!isSettingsEnabled()) {
return;
}
Element e = element.element("position");
if (e != null) {
String value = e.attributeValue("value");
String unit = e.attributeValue("unit");
if (!StringUtils.isBlank(value) && !StringUtils.isBlank(unit)) {
Unit convertedUnit;
if (NumberUtils.isNumber(unit)) {
convertedUnit = convertLegacyUnit(Integer.parseInt(unit));
} else {
convertedUnit = Unit.getUnitFromSymbol(unit);
}
component.setSplitPosition(Float.parseFloat(value), convertedUnit, component.isSplitPositionReversed());
}
}
}
Aggregations