/** Width units: {@link #UNITS_PIXELS}, {@link #UNITS_PERCENTAGE} */ @Deprecated default int getWidthUnits() { return ComponentsHelper.convertFromSizeUnit(getWidthSizeUnit()); }
public static boolean hasFullWidth(Component c) { return (int) c.getWidth() == 100 && c.getWidthSizeUnit() == SizeUnit.PERCENTAGE; }
public static String getComponentWidth(Component c) { float width = c.getWidth(); SizeUnit widthUnit = c.getWidthSizeUnit(); return width + widthUnit.getSymbol(); }
@Nonnull @Override public List<LayoutTip> analyze(Component c, String path) { if (c instanceof Window && c.getWidth() < 0) { List<LayoutTip> tips = null; ComponentContainer container = (ComponentContainer) c; for (Component component : container.getOwnComponents()) { if (tips == null) { tips = new ArrayList<>(); } if (component.getWidthSizeUnit() == SizeUnit.PERCENTAGE && component.getWidth() > 0) { String id = component.getId() != null ? component.getId() : component.getClass().getSimpleName(); tips.add(warn("Nested component '" + id + "'", "Nested component has relative width %s%% inside window with undefined width", component.getWidth())); } } return tips != null ? tips : Collections.<LayoutTip>emptyList(); } return Collections.emptyList(); } }
if (component.getWidth() > 0 && component.getWidthSizeUnit() == SizeUnit.PERCENTAGE) { if (tips == null) { tips = new ArrayList<>();
private boolean isSizeIgnored(ExpandingLayout container, Component component) { return container.getExpandDirection() == ExpandDirection.HORIZONTAL && component.getWidthSizeUnit() == SizeUnit.PERCENTAGE && component.getWidth() > 0 || container.getExpandDirection() == ExpandDirection.VERTICAL && component.getHeightSizeUnit() == SizeUnit.PERCENTAGE && component.getHeight() > 0; } }
if (c.getWidth() < 0) { for (Component component : container.getOwnComponents()) { if (component.getWidthSizeUnit() == SizeUnit.PERCENTAGE && component.getWidth() > 0) { if (tips == null) { tips = new ArrayList<>();