/** * Constructs a new custom field. * * <p> * The component is implemented by wrapping the methods of the composition * root component given as parameter. The composition root must be set * before the component can be used. * </p> */ public CustomField() { // expand horizontally by default setWidth(100, Unit.PERCENTAGE); }
@Override public void setWidth(float width, Unit unit) { super.setWidth(width, unit); updateComponentWidth(); }
@Override public void setWidth(float width, Unit unit) { super.setWidth(width, unit); if (field != null) { if (width < 0) { field.setWidthUndefined(); } else { field.setWidth("100%"); } } }
@Override public void setWidth(float width, Unit unit) { super.setWidth(width, unit); if (tf != null) { if (width != -1) { tf.setWidth("100%"); } else { tf.setWidth(null); } } }
@Override public void setWidth(float width, Unit unit) { super.setWidth(width, unit); if (container != null) { if (width < 0) { container.setWidthUndefined(); field.setWidthUndefined(); if (inputWrapper != null) { inputWrapper.setWidthUndefined(); } } else { container.setWidth(100, Unit.PERCENTAGE); field.setWidth(100, Unit.PERCENTAGE); if (inputWrapper != null) { inputWrapper.setWidth(100, Unit.PERCENTAGE); } } } }
public CubaTokenList(WebTokenList<T> owner) { this.owner = owner; composition = new VerticalLayout(); composition.setWidthUndefined(); composition.setSpacing(false); composition.setMargin(false); tokenContainer = new CubaScrollBoxLayout(); tokenContainer.setStyleName(TOKENLIST_SCROLLBOX_STYLENAME); tokenContainer.setWidthUndefined(); tokenContainer.setMargin(new MarginInfo(true, false, false, false)); composition.addComponent(tokenContainer); setPrimaryStyleName(TOKENLIST_STYLENAME); // do not trigger overridden method super.setWidth(-1, Unit.PIXELS); }
@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); } } } }