@Override public void setWidth(float width, Unit unit) { super.setWidth(width, unit); // workaround for custom field call from constructor if (composition != null && tokenContainer != null) { if (width > 0) { composition.setWidth("100%"); editor.setWidth("100%"); if (!owner.isSimple()) { owner.lookupPickerField.setWidthFull(); editor.setExpandRatio(WebComponentsHelper.getComposition(owner.lookupPickerField), 1); } } else { composition.setWidthUndefined(); editor.setWidthUndefined(); if (!owner.isSimple()) { owner.lookupPickerField.setWidthAuto(); editor.setExpandRatio(WebComponentsHelper.getComposition(owner.lookupPickerField), 0); } } } }
private void updateComponentWidth() { if (container == null) return; if (getWidth() >= 0) { container.setWidth(100, Unit.PERCENTAGE); if (isShowFileName()) { container.setExpandRatio(fileNameButton, 1); fileNameButton.setWidth(100, Unit.PERCENTAGE); uploadButton.setWidthUndefined(); clearButton.setWidthUndefined(); } else { container.setExpandRatio(fileNameButton, 0); fileNameButton.setWidthUndefined(); if (isShowClearButton() && !isRequiredIndicatorVisible()) { uploadButton.setWidth(100, Unit.PERCENTAGE); clearButton.setWidth(100, Unit.PERCENTAGE); } else { uploadButton.setWidth(100, Unit.PERCENTAGE); } } } else { container.setWidthUndefined(); fileNameButton.setWidthUndefined(); uploadButton.setWidthUndefined(); clearButton.setWidthUndefined(); } }
protected void updateSizes() { if (getHeight() > 0) { composition.setHeight("100%"); composition.setExpandRatio(tokenContainer, 1); tokenContainer.setHeight("100%"); } else { composition.setHeightUndefined(); composition.setExpandRatio(tokenContainer, 0); tokenContainer.setHeightUndefined(); } if (getWidth() > 0) { composition.setWidth("100%"); editor.setWidth("100%"); if (!owner.isSimple()) { owner.lookupPickerField.setWidthFull(); editor.setExpandRatio(WebComponentsHelper.getComposition(owner.lookupPickerField), 1); } } else { composition.setWidthUndefined(); editor.setWidthUndefined(); if (!owner.isSimple()) { owner.lookupPickerField.setWidthAuto(); editor.setExpandRatio(WebComponentsHelper.getComposition(owner.lookupPickerField), 0); } } }
editor = new HorizontalLayout(); editor.setSpacing(true); editor.setWidthUndefined();
buttons.setMargin(false); buttons.setSpacing(true); buttons.setWidthUndefined(); root.addComponent(buttons); root.setComponentAlignment(buttons, Alignment.MIDDLE_LEFT);