Search in sources :

Example 1 with SizeUnit

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);
    }
}
Also used : SizeUnit(io.jmix.ui.component.SizeUnit)

Example 2 with SizeUnit

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);
    }
}
Also used : SizeUnit(io.jmix.ui.component.SizeUnit) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException)

Example 3 with SizeUnit

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);
    }
}
Also used : SizeUnit(io.jmix.ui.component.SizeUnit) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException)

Aggregations

SizeUnit (io.jmix.ui.component.SizeUnit)3 GuiDevelopmentException (io.jmix.ui.GuiDevelopmentException)2