use of io.jmix.ui.component.SizeUnit in project jmix by jmix-framework.
the class SplitPanelLoader method loadSplitPosition.
protected void loadSplitPosition(SplitPanel resultComponent, Element element) {
String pos = element.attributeValue("pos");
if (!StringUtils.isEmpty(pos)) {
boolean reversePosition = false;
int position;
SizeUnit unit;
if (Boolean.parseBoolean(element.attributeValue("reversePosition"))) {
reversePosition = true;
}
if (pos.endsWith("px")) {
position = Integer.parseInt(pos.substring(0, pos.indexOf("px")));
unit = SizeUnit.PIXELS;
} else {
if (pos.endsWith("%")) {
position = Integer.parseInt(pos.substring(0, pos.indexOf("%")));
} else {
position = Integer.parseInt(pos);
}
unit = SizeUnit.PERCENTAGE;
}
resultComponent.setSplitPosition(position, unit, reversePosition);
}
}
use of io.jmix.ui.component.SizeUnit in project jmix by jmix-framework.
the class SplitPanelLoader method loadMinSplitPosition.
protected void loadMinSplitPosition(SplitPanel resultComponent, Element element) {
String minSplitPosition = element.attributeValue("minSplitPosition");
if (!StringUtils.isEmpty(minSplitPosition)) {
int position;
SizeUnit unit;
if (minSplitPosition.endsWith("px")) {
position = Integer.parseInt(minSplitPosition.substring(0, minSplitPosition.indexOf("px")));
unit = SizeUnit.PIXELS;
} else if (minSplitPosition.endsWith("%")) {
position = Integer.parseInt(minSplitPosition.substring(0, minSplitPosition.indexOf("%")));
unit = SizeUnit.PERCENTAGE;
} else {
throw new GuiDevelopmentException("Unit of minSplitPosition is not set", context);
}
resultComponent.setMinSplitPosition(position, unit);
}
}
use of io.jmix.ui.component.SizeUnit in project jmix by jmix-framework.
the class SplitPanelLoader method loadMaxSplitPosition.
protected void loadMaxSplitPosition(SplitPanel resultComponent, Element element) {
String maxSplitPosition = element.attributeValue("maxSplitPosition");
if (!StringUtils.isEmpty(maxSplitPosition)) {
int position;
SizeUnit unit;
if (maxSplitPosition.endsWith("px")) {
position = Integer.parseInt(maxSplitPosition.substring(0, maxSplitPosition.indexOf("px")));
unit = SizeUnit.PIXELS;
} else if (maxSplitPosition.endsWith("%")) {
position = Integer.parseInt(maxSplitPosition.substring(0, maxSplitPosition.indexOf("%")));
unit = SizeUnit.PERCENTAGE;
} else {
throw new GuiDevelopmentException("Unit of maxSplitPosition is not set", context);
}
resultComponent.setMaxSplitPosition(position, unit);
}
}
Aggregations