public void setTheme(boolean lightTheme) { super.setTheme(lightTheme); primary.setPrimaryStyleName(lightTheme ? Typography.Dark.Subheader.PRIMARY : Typography.Light.Subheader.PRIMARY); secondary.setPrimaryStyleName(lightTheme ? Typography.Dark.Body1.SECONDARY : Typography.Light.Body1.SECONDARY); }
public void setTheme(boolean lightTheme) { super.setTheme(lightTheme); primary.setPrimaryStyleName(lightTheme ? Typography.Dark.Subheader.PRIMARY : Typography.Light.Subheader.PRIMARY); }
public void setHeaders(String... headers) { for (String header : headers) { Label lbl = new Label(header); lbl.setPrimaryStyleName(Typography.Dark.Table.Header.SECONDARY); this.headers.addComponent(lbl); } }
public NavigationItem(Resource icon, String caption, Integer count) { String primaryStyleName = "md-naviitem"; setPrimaryStyleName(primaryStyleName); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.caption.setPrimaryStyleName(primaryStyleName + "-caption"); this.count.setPrimaryStyleName(primaryStyleName + "-count"); setIcon(icon); setCaption(caption); setCount(count); addComponents(this.icon, this.caption, this.count); }
public TwoLineListItem(String primaryText, String secondaryText, boolean verticalPadding) { super(verticalPadding); addStyleName("two-line"); setHeight(Metrics.List.TWO_LINE_HEIGHT, Unit.PIXELS); primary = new Label(primaryText); primary.setPrimaryStyleName(Typography.Dark.Subheader.PRIMARY); secondary = new Label(secondaryText); secondary.setPrimaryStyleName(Typography.Dark.Body1.SECONDARY); content.addComponents(primary, secondary); actionPrimary.addComponents(iconPrimary, content); actionSecondary.addComponent(iconSecondary); addComponents(actionPrimary, actionSecondary, divider); }
public DatePickerHeader(InlineDateField field, boolean lightTheme) { setFlexDirection(FlexDirection.COLUMN); setJustifyContent(JustifyContent.CENTER); addStyleName(Paddings.Horizontal.LARGE); addStyleName(FlexItem.FlexShrink.SHRINK_0); this.field = field; field.addValueChangeListener((HasValue.ValueChangeListener<LocalDate>) event -> { year.setValue(field.getValue().format(DateTimeFormatter.ofPattern("yyyy"))); date.setValue(field.getValue().format(DateTimeFormatter.ofPattern("EEE, MMM d"))); }); setHeight(Metrics.DatePicker.HEADER_HEIGHT, Unit.PIXELS); addStyleName(lightTheme ? MaterialColor.BLUE_500.getBackgroundColorStyle() : MaterialColor.GREY_700.getBackgroundColorStyle()); year.setPrimaryStyleName(Typography.Light.Body2.SECONDARY); date.setPrimaryStyleName(Typography.Light.DatePicker.Title.PRIMARY); addComponents(year, date); } }
@Override public void createSection(CssLayout compositionRoot, SideBarSectionDescriptor descriptor, Collection<SideBarItemDescriptor> itemDescriptors) { Label header = new Label(); header.setValue(descriptor.getCaption()); header.setSizeUndefined(); header.setPrimaryStyleName(ValoTheme.MENU_SUBTITLE); compositionRoot.addComponent(header); for (SideBarItemDescriptor item : itemDescriptors) { compositionRoot.addComponent(itemComponentFactory.createItemComponent(item)); } } }
public SingleLineListItem(String primaryText, boolean verticalPadding) { super(verticalPadding); addStyleName("single-line"); setHeight(Metrics.List.SINGLE_LINE_HEIGHT, Unit.PIXELS); primary = new Label(primaryText); primary.setPrimaryStyleName(Typography.Dark.Subheader.PRIMARY); content.addComponent(primary); actionPrimary.addComponents(iconPrimary, content); actionSecondary.addComponent(iconSecondary); addComponents(actionPrimary, actionSecondary, divider); }
public AppBar() { super(); setPrimaryStyleName("md-appbar"); addStyleName(MaterialColor.BLUE_500.getBackgroundColorStyle()); naviIcon.setIcon(MaterialIcons.MENU); naviIcon.setPrimaryStyleName(Styles.Buttons.NAV_ICON); Label appBarTitle = new Label("Material Design"); appBarTitle.setPrimaryStyleName(Typography.Light.Title.PRIMARY); appBarTitle.setSizeUndefined(); addComponents(naviIcon, appBarTitle); }
public void addItem(Object... values) { FlexLayout item = new FlexLayout(); item.setPrimaryStyleName("md-datatable-row"); item.addStyleName(Spacings.Right.LARGE); item.addStyleName(Paddings.Vertical.TABLE); for (Object value : values) { if (value instanceof String) { Label lbl = new Label((String) value); lbl.setPrimaryStyleName(Typography.Dark.Table.Row.PRIMARY); item.addComponent(lbl); } else if (value instanceof Component) { item.addComponent((Component) value); } } items.addComponent(item); }
this.titleLabel.setPrimaryStyleName(Typography.Dark.Table.Title.PRIMARY); this.titleLabel.setWidth(100, Unit.PERCENTAGE); addComponent(this.titleLabel); if (size > 0) { titleLabel.setValue(size + (size == 1 ? " item selected" : " items selected")); titleLabel.setPrimaryStyleName(Typography.Dark.Subheader.PRIMARY); titleLabel.addStyleName(selectedFontColor.getFontColorStyle()); addStyleName(selectedBackgroundColor.getBackgroundColorStyle()); } else { titleLabel.setValue(this.title); titleLabel.setPrimaryStyleName(Typography.Dark.Table.Title.PRIMARY); titleLabel.removeStyleName(selectedFontColor.getFontColorStyle()); removeStyleName(selectedBackgroundColor.getBackgroundColorStyle());
this.stepLabel.setPrimaryStyleName(Typography.Light.Caption.PRIMARY); this.stepLabel.addStyleName(FLEXLAYOUT); this.stepLabel.addStyleName(AlignItems.CENTER.getStyleName()); this.nameLabel.setPrimaryStyleName(Typography.Dark.Body1.PRIMARY); this.infoLabel.setPrimaryStyleName(Typography.Dark.Caption.SECONDARY);
public MDTextFieldBox(String label, boolean light) { String primaryStyleName = light ? Styles.TextFieldBoxes.LIGHT : Styles.TextFieldBoxes.DARK; setPrimaryStyleName(primaryStyleName); this.label.setValue(label); this.label.setPrimaryStyleName(primaryStyleName + "-label"); this.label.addStyleName(RESTING); this.label.setWidthUndefined(); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.ripple.setPrimaryStyleName(primaryStyleName + "-ripple"); this.field.setPrimaryStyleName(primaryStyleName + "-input"); this.field.addFocusListener(event -> { addStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addBlurListener(event -> { removeStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addValueChangeListener(event -> updateFloatingLabelPosition(event.getValue())); this.helper.setPrimaryStyleName(primaryStyleName + "-helper"); this.helper.setWidthUndefined(); addComponents(this.label, icon, field, ripple, this.helper); }
public MDPasswordField(String label, boolean light) { String primaryStyleName = light ? Styles.TextFields.LIGHT : Styles.TextFields.DARK; setPrimaryStyleName(primaryStyleName); setFloatingLabelEnabled(true); this.label.setValue(label); this.label.setPrimaryStyleName(primaryStyleName + "-label"); this.label.addStyleName(RESTING); this.label.setWidthUndefined(); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.field.setPrimaryStyleName(primaryStyleName + "-input"); this.field.addFocusListener(event -> { addStyleName("focus"); updateFloatingLabelPosition(field.getValue()); }); this.field.addBlurListener(event -> { removeStyleName("focus"); updateFloatingLabelPosition(field.getValue()); }); this.field.addValueChangeListener(event -> updateFloatingLabelPosition(event.getValue())); this.helper.setPrimaryStyleName(primaryStyleName + "-helper"); this.helper.setWidthUndefined(); addComponents(this.label, icon, field, this.helper); }
public MDTextAreaBox(String label, boolean light) { String primaryStyleName = light ? Styles.TextFieldBoxes.LIGHT : Styles.TextFieldBoxes.DARK; setPrimaryStyleName(primaryStyleName); this.label.setValue(label); this.label.setPrimaryStyleName(primaryStyleName + "-label"); this.label.addStyleName(RESTING); this.label.setWidthUndefined(); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.ripple.setPrimaryStyleName(primaryStyleName + "-ripple"); this.field.setPrimaryStyleName(primaryStyleName + "-input"); this.field.addFocusListener(event -> { addStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addBlurListener(event -> { removeStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addValueChangeListener(event -> updateFloatingLabelPosition(event.getValue())); this.helper.setPrimaryStyleName(primaryStyleName + "-helper"); this.helper.setWidthUndefined(); addComponents(this.label, icon, field, ripple, this.helper); }
public MDDateTimeField(String label, boolean light) { String primaryStyleName = light ? Styles.DateFields.LIGHT : Styles.DateFields.DARK; setPrimaryStyleName(primaryStyleName); setFloatingLabelEnabled(true); this.label.setValue(label); this.label.setPrimaryStyleName(primaryStyleName + "-label"); this.label.addStyleName(RESTING); this.label.setWidthUndefined(); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.field.setPrimaryStyleName(primaryStyleName + "-input"); this.field.addFocusListener(event -> { addStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addBlurListener(event -> { removeStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addValueChangeListener(event -> updateFloatingLabelPosition(event.getValue())); this.helper.setPrimaryStyleName(primaryStyleName + "-helper"); this.helper.setWidthUndefined(); addComponents(this.label, icon, field, this.helper); }
public MDTextField(String label, boolean light) { String primaryStyleName = light ? Styles.TextFields.LIGHT : Styles.TextFields.DARK; setPrimaryStyleName(primaryStyleName); setFloatingLabelEnabled(true); this.label.setValue(label); this.label.setPrimaryStyleName(primaryStyleName + "-label"); this.label.addStyleName(RESTING); this.label.setWidthUndefined(); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.field.setPrimaryStyleName(primaryStyleName + "-input"); this.field.addFocusListener(event -> { addStyleName("focus"); updateFloatingLabelPosition(field.getValue()); }); this.field.addBlurListener(event -> { removeStyleName("focus"); updateFloatingLabelPosition(field.getValue()); }); this.field.addValueChangeListener(event -> updateFloatingLabelPosition(event.getValue())); this.helper.setPrimaryStyleName(primaryStyleName + "-helper"); this.helper.setWidthUndefined(); addComponents(this.label, icon, field, this.helper); }
public MDDateField(String label, boolean light) { String primaryStyleName = light ? Styles.DateFields.LIGHT : Styles.DateFields.DARK; setPrimaryStyleName(primaryStyleName); setFloatingLabelEnabled(true); this.label.setValue(label); this.label.setPrimaryStyleName(primaryStyleName + "-label"); this.label.addStyleName(RESTING); this.label.setWidthUndefined(); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.field.setPrimaryStyleName(primaryStyleName + "-input"); this.field.addFocusListener(event -> { addStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addBlurListener(event -> { removeStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addValueChangeListener(event -> updateFloatingLabelPosition(event.getValue())); this.helper.setPrimaryStyleName(primaryStyleName + "-helper"); this.helper.setWidthUndefined(); addComponents(this.label, icon, field, this.helper); }
public MDComboBox(String label, boolean light) { String primaryStyleName = light ? Styles.ComboBoxes.LIGHT : Styles.ComboBoxes.DARK; setPrimaryStyleName(primaryStyleName); this.label.setValue(label); this.label.setPrimaryStyleName(primaryStyleName + "-label"); this.label.addStyleName(RESTING); this.label.setWidthUndefined(); this.icon.setPrimaryStyleName(primaryStyleName + "-icon"); this.field.setPrimaryStyleName(primaryStyleName + "-input"); this.field.addFocusListener(event -> { addStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addBlurListener(event -> { removeStyleName("focus"); updateFloatingLabelPosition(this.field.getValue()); }); this.field.addValueChangeListener(event -> { if (generator != null) { Resource itemIcon = generator.apply(event.getValue()); if (itemIcon instanceof MaterialIcons) setIcon((MaterialIcons) itemIcon); else setIcon(itemIcon); } updateFloatingLabelPosition(event.getValue()); }); this.helper.setPrimaryStyleName(primaryStyleName + "-helper"); this.helper.setWidthUndefined(); addComponents(this.label, icon, field, this.helper); setFloatingLabelEnabled(true); }
public SimpleDialog(String title, String message, boolean lightTheme) { super(title); addStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK); label = new Label(message); label.setPrimaryStyleName(lightTheme ? Typography.Dark.Subheader.SECONDARY : Typography.Light.Subheader.SECONDARY); label.addStyleName(Paddings.Horizontal.LARGE + " " + Paddings.Bottom.LARGE); // Footer cancel = new Button("Cancel"); cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK); cancel.addClickListener(e -> close()); ok = new Button("OK"); ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK); ok.addClickListener(e -> close()); footer = new FlexLayout(cancel, ok); footer.setJustifyContent(FlexLayout.JustifyContent.FLEX_END); footer.addStyleName(Paddings.All.SMALL + " " + Spacings.Right.SMALL + " " + FlexItem.FlexShrink.SHRINK_0); footer.setWidth(100, Unit.PERCENTAGE); // Content wrapper content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, label, footer); setContent(content); }