@Override public Unit getWidthUnits() { return getRootOrThrow().getWidthUnits(); }
private static boolean hasRelativeWidth(Component paintable) { return paintable.getWidth() > 0 && paintable.getWidthUnits() == Unit.PERCENTAGE; }
/** * Test if the given component has equal width with this instance * * @param component * the component for the width comparison * @return true if the widths are equal */ private boolean hasEqualWidth(Component component) { return getWidth() == component.getWidth() && getWidthUnits().equals(component.getWidthUnits()); }
private static String getWidthString(Component component) { String width = "width: "; if (hasRelativeWidth(component)) { width += "RELATIVE, " + component.getWidth() + " %"; } else if (component instanceof Window && component.getParent() == null) { width += "MAIN WINDOW"; } else if (component.getWidth() >= 0) { width += "ABSOLUTE, " + component.getWidth() + " " + component.getWidthUnits().getSymbol(); } else { width += "UNDEFINED"; } return width; }
@Override public SizeUnit getMenuWidthSizeUnit() { return WebWrapperUtils.toSizeUnit(vPopupComponent.getWidthUnits()); }
@Override public SizeUnit getWidthSizeUnit() { return WebWrapperUtils.toSizeUnit(getComposition().getWidthUnits()); }
} else { float compWidth = comp.getWidth(); if ((compWidth > 0) && (comp.getWidthUnits() == Unit.PIXELS)) {
newContent.setWidth(oldContent.getWidth(), oldContent.getWidthUnits()); newContent.setHeight(oldContent.getHeight(), oldContent.getHeightUnits());
@Override public void toggle(int initialWidth, int initialHeight) { getState().isCollapsed = !getState().isCollapsed; final Component parent = (Component) getParent(); if (getState().isCollapsed) { // Restore size info from the state. parent.setWidth(getState().collapsedStateWidth); parent.setHeight(getState().collapsedStateHeight); } else { // We save the initial dimensions and clear size info from the state. getState().collapsedStateHeight = parent.getHeight() + parent.getHeightUnits().toString(); getState().collapsedStateWidth = parent.getWidth() + parent.getWidthUnits().toString(); parent.setWidth(""); parent.setHeight(""); } } });