Java Code Examples for com.vaadin.ui.Label#setStyleName()

The following examples show how to use com.vaadin.ui.Label#setStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractView.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the top title header.
 *
 * @param topHeader
 *            the top header
 */
private static void createTopTitleHeader(final HorizontalLayout topHeader) {
	final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout();


	final Label titleLabel = new Label("Citizen Intelligence Agency");
	titleLabel.setStyleName("Header");
	topTitleHeadertPanel.addComponent(titleLabel);
	topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT);

	final Label sloganLabel = new Label("// Tracking politicians like bugs!");
	sloganLabel.setStyleName("HeaderSlogan");
	topTitleHeadertPanel.addComponent(sloganLabel);
	topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT);

	topHeader.addComponent(topTitleHeadertPanel);
	topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT);
	topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID);
}
 
Example 2
Source File: TargetTableHeader.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void addFilterTextField(final DistributionSetIdName distributionSetIdName) {
    final Button filterLabelClose = SPUIComponentProvider.getButton("drop.filter.close", "", "", "", true,
            FontAwesome.TIMES_CIRCLE, SPUIButtonStyleNoBorder.class);
    filterLabelClose.addClickListener(clickEvent -> closeFilterByDistribution());
    final Label filteredDistLabel = new Label();
    filteredDistLabel.setStyleName(ValoTheme.LABEL_COLORED + " " + ValoTheme.LABEL_SMALL);
    String name = HawkbitCommonUtil.getDistributionNameAndVersion(distributionSetIdName.getName(),
            distributionSetIdName.getVersion());
    if (name.length() > SPUITargetDefinitions.DISTRIBUTION_NAME_MAX_LENGTH_ALLOWED) {
        name = new StringBuilder(name.substring(0, SPUITargetDefinitions.DISTRIBUTION_NAME_LENGTH_ON_FILTER))
                .append("...").toString();
    }
    filteredDistLabel.setValue(name);
    filteredDistLabel.setSizeUndefined();
    getFilterDroppedInfo().removeAllComponents();
    getFilterDroppedInfo().setSizeFull();
    getFilterDroppedInfo().addComponent(filteredDistLabel);
    getFilterDroppedInfo().addComponent(filterLabelClose);
    getFilterDroppedInfo().setExpandRatio(filteredDistLabel, 1.0F);
    eventBus.publish(this, TargetFilterEvent.FILTER_BY_DISTRIBUTION);
}
 
Example 3
Source File: FormUtils.java    From jdal with Apache License 2.0 6 votes vote down vote up
/**
   * Create a titled separator
   * @param title title
   * @return a {@link HorizontalLayout} with title and rule.
   */
  public static Component createTitledSeparator(String title) {
  	Label titleLabel = new Label(title);
  	titleLabel.setStyleName(Reindeer.LABEL_H2);
Label rule = new Label("<hr />", ContentMode.HTML);
titleLabel.setSizeUndefined();
HorizontalLayout hl = new HorizontalLayout();
hl.addComponent(titleLabel);
Box.addHorizontalStruct(hl, 20);
hl.addComponent(rule);
hl.setComponentAlignment(rule, Alignment.BOTTOM_CENTER);
hl.setExpandRatio(rule, 1);
hl.setWidth(100, Unit.PERCENTAGE);

return hl;
  }
 
Example 4
Source File: WindowBreadCrumbs.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void update() {
    boolean isTestMode = ui.isTestMode();

    linksLayout.removeAllComponents();
    for (Iterator<Window> it = windows.iterator(); it.hasNext();) {
        Window window = it.next();

        Button button = new NavigationButton(window);
        button.setCaption(StringUtils.trimToEmpty(window.getCaption()));
        button.addClickListener(this::navigationButtonClicked);
        button.setSizeUndefined();
        button.setStyleName(ValoTheme.BUTTON_LINK);
        button.setTabIndex(-1);

        if (isTestMode) {
            button.setCubaId("breadCrubms_Button_" + window.getId());
        }

        if (ui.isPerformanceTestMode()) {
            button.setId(ui.getTestIdManager().getTestId("breadCrubms_Button_" + window.getId()));
        }

        if (it.hasNext()) {
            linksLayout.addComponent(button);

            Label separatorLab = new Label("&nbsp;&gt;&nbsp;");
            separatorLab.setStyleName("c-breadcrumbs-separator");
            separatorLab.setSizeUndefined();
            separatorLab.setContentMode(ContentMode.HTML);
            linksLayout.addComponent(separatorLab);
        } else {
            Label captionLabel = new Label(window.getCaption());
            captionLabel.setStyleName("c-breadcrumbs-win-caption");
            captionLabel.setSizeUndefined();
            linksLayout.addComponent(captionLabel);
        }
    }
}
 
Example 5
Source File: CubaRowsCount.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected ComponentContainer createContentLayout() {
    CubaCssActionsLayout contentLayout = new CubaCssActionsLayout();
    contentLayout.setStyleName("c-paging-wrap");
    contentLayout.setSpacing(true);

    firstButton = new CubaButton();
    firstButton.setStyleName("c-paging-change-page");
    firstButton.addStyleName("c-paging-first");
    contentLayout.addComponent(firstButton);

    prevButton = new CubaButton();
    prevButton.setStyleName("c-paging-change-page");
    prevButton.addStyleName("c-paging-prev");
    contentLayout.addComponent(prevButton);

    label = new Label();
    label.setWidthUndefined();
    label.setStyleName("c-paging-status");
    contentLayout.addComponent(label);

    countButton = new CubaButton("[?]");
    countButton.setWidthUndefined();
    countButton.setStyleName(ValoTheme.BUTTON_LINK);
    countButton.addStyleName("c-paging-count");
    countButton.setTabIndex(-1);
    contentLayout.addComponent(countButton);

    nextButton = new CubaButton();
    nextButton.setStyleName("c-paging-change-page");
    nextButton.addStyleName("c-paging-next");
    contentLayout.addComponent(nextButton);

    lastButton = new CubaButton();
    lastButton.setStyleName("c-paging-change-page");
    lastButton.addStyleName("c-paging-last");
    contentLayout.addComponent(lastButton);

    return contentLayout;
}
 
Example 6
Source File: AbstractHawkbitUI.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private HorizontalLayout buildViewTitle() {
    final HorizontalLayout viewHeadercontent = new HorizontalLayout();
    viewHeadercontent.setWidth("100%");
    viewHeadercontent.addStyleName("view-header-layout");

    viewTitle = new Label();
    viewTitle.setWidth("100%");
    viewTitle.setStyleName("header-content");
    viewHeadercontent.addComponent(viewTitle);

    viewHeadercontent.addComponent(notificationUnreadButton);
    viewHeadercontent.setComponentAlignment(notificationUnreadButton, Alignment.MIDDLE_RIGHT);
    return viewHeadercontent;
}
 
Example 7
Source File: CreateOrUpdateFilterTable.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Component getStatusIcon(final Object itemId) {
    final Item row1 = getItem(itemId);
    final TargetUpdateStatus targetStatus = (TargetUpdateStatus) row1
            .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
    final Label label = new LabelBuilder().name("").buildLabel();
    label.setContentMode(ContentMode.HTML);
    if (targetStatus == TargetUpdateStatus.PENDING) {
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_PENDING));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
        label.setValue(FontAwesome.ADJUST.getHtml());
    } else if (targetStatus == TargetUpdateStatus.REGISTERED) {
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_REGISTERED));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
        label.setValue(FontAwesome.DOT_CIRCLE_O.getHtml());
    } else if (targetStatus == TargetUpdateStatus.ERROR) {
        label.setDescription(i18n.getMessage(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_ERROR)));
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
        label.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
    } else if (targetStatus == TargetUpdateStatus.IN_SYNC) {
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_STATUS_INSYNC));
        label.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    } else if (targetStatus == TargetUpdateStatus.UNKNOWN) {
        label.setStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
        label.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_TARGET_STATUS_UNKNOWN));
        label.setValue(FontAwesome.QUESTION_CIRCLE.getHtml());
    }
    return label;
}
 
Example 8
Source File: SoftwareModuleDetailsTable.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static Label createMandatoryLabel(final boolean mandatory) {
    final Label mandatoryLable = mandatory ? HawkbitCommonUtil.getFormatedLabel(" * ")
            : HawkbitCommonUtil.getFormatedLabel("  ");
    if (mandatory) {
        mandatoryLable.setStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
    }
    return mandatoryLable;
}
 
Example 9
Source File: SoftwareModuleAddUpdateWindow.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private CommonDialogWindow createWindow() {
    final Label madatoryStarLabel = new Label("*");
    madatoryStarLabel.setStyleName("v-caption v-required-field-indicator");
    madatoryStarLabel.setWidth(null);
    addStyleName("lay-color");
    setSizeUndefined();

    formLayout = new FormLayout();
    formLayout.setCaption(null);
    if (editSwModule) {
        formLayout.addComponent(softwareModuleType);
    } else {
        formLayout.addComponent(typeComboBox);
        typeComboBox.focus();
    }

    formLayout.addComponent(nameTextField);
    formLayout.addComponent(versionTextField);
    formLayout.addComponent(vendorTextField);
    formLayout.addComponent(descTextArea);

    setCompositionRoot(formLayout);

    final CommonDialogWindow window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW)
            .caption(i18n.getMessage("caption.create.new", i18n.getMessage("caption.software.module")))
            .id(UIComponentIdProvider.SW_MODULE_CREATE_DIALOG).content(this).layout(formLayout).i18n(i18n)
            .saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
    nameTextField.setEnabled(!editSwModule);
    versionTextField.setEnabled(!editSwModule);

    return window;
}
 
Example 10
Source File: TargetDetails.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Label buildAttributesUpdateLabel() {
    final Label attributesUpdateLabel = new Label();
    attributesUpdateLabel.setStyleName(ValoTheme.LABEL_SMALL);
    attributesUpdateLabel.setValue(getI18n().getMessage("label.target.attributes.update.pending"));

    return attributesUpdateLabel;
}
 
Example 11
Source File: ActionTypeOptionGroupAssignmentLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void addAutoForceItemWithLabelAndDateField() {
    final FlexibleOptionGroupItemComponent autoForceItem = actionTypeOptionGroup
            .getItemComponent(ActionTypeOption.AUTO_FORCED);
    autoForceItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    autoForceItem.setId(UIComponentIdProvider.ACTION_TYPE_OPTION_GROUP_SAVE_TIMEFORCED);
    addComponent(autoForceItem);
    final Label autoForceLabel = new Label();
    autoForceLabel.setStyleName("statusIconPending");
    autoForceLabel.setIcon(FontAwesome.HISTORY);
    autoForceLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_TIME_FORCED));
    autoForceLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_TIMEFORCED_ITEM));
    autoForceLabel.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    addComponent(autoForceLabel);

    forcedTimeDateField = new DateField();
    forcedTimeDateField.setInvalidAllowed(false);
    forcedTimeDateField.setInvalidCommitted(false);
    forcedTimeDateField.setEnabled(false);
    forcedTimeDateField.setStyleName("dist-window-forcedtime");

    final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
    forcedTimeDateField.setValue(
            Date.from(LocalDateTime.now().plusWeeks(2).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
    forcedTimeDateField.setImmediate(true);
    forcedTimeDateField.setTimeZone(tz);
    forcedTimeDateField.setLocale(HawkbitCommonUtil.getCurrentLocale());
    forcedTimeDateField.setResolution(Resolution.MINUTE);
    forcedTimeDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
    addComponent(forcedTimeDateField);
}
 
Example 12
Source File: ListPane.java    From jdal with Apache License 2.0 5 votes vote down vote up
public MenuItem(ComponentHolder holder) {
	HorizontalLayout layout = new HorizontalLayout();
	layout.setSpacing(true);
	setContent(layout);
	Embedded e = new Embedded("", holder.getIcon());
	layout.addComponent(e);
	Label l = new Label(holder.getName());
	l.setStyleName(Reindeer.LABEL_H2);
	layout.addComponent(l);
	layout.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
	layout.setComponentAlignment(e, Alignment.BOTTOM_LEFT);
	setStyleName("menuItem");
	this.component = holder.getComponent();
}
 
Example 13
Source File: AbstractActionTypeOptionGroupLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void addDownloadOnlyItemWithLabel() {
    final FlexibleOptionGroupItemComponent downloadOnlyItem = actionTypeOptionGroup
            .getItemComponent(ActionTypeOption.DOWNLOAD_ONLY);
    downloadOnlyItem.setId(UIComponentIdProvider.ACTION_DETAILS_DOWNLOAD_ONLY_ID);
    downloadOnlyItem.setStyleName(STYLE_DIST_WINDOW_ACTIONTYPE);
    addComponent(downloadOnlyItem);
    final Label downloadOnlyLabel = new Label();
    downloadOnlyLabel.setSizeFull();
    downloadOnlyLabel.setCaption(i18n.getMessage(UIMessageIdProvider.CAPTION_ACTION_DOWNLOAD_ONLY));
    downloadOnlyLabel.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_DOWNLOAD_ONLY_ITEM));
    downloadOnlyLabel.setStyleName("padding-right-style");
    downloadOnlyLabel.setIcon(FontAwesome.DOWNLOAD);
    addComponent(downloadOnlyLabel);
}
 
Example 14
Source File: DashboardMenu.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Component buildVersionInfo() {
    final Label label = new Label();
    label.setSizeFull();
    label.setStyleName("version-layout");
    label.setValue(serverProperties.getBuild().getVersion());
    return label;
}
 
Example 15
Source File: DefaultModulePanel.java    From sensorhub with Mozilla Public License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("serial")
public void build(final MyBeanItem<ModuleConfig> beanItem, final ModuleType module)
{
    setSizeUndefined();
    setWidth(100.0f, Unit.PERCENTAGE);
    setMargin(false);
    setSpacing(true);
    
    // label with module name
    String moduleName = getTitle(beanItem.getBean());
    Label title = new Label(moduleName);
    title.setStyleName(STYLE_H2);
    addComponent(title);
    
    // apply changes button
    Button applyButton = new Button("Apply Changes");
    applyButton.setIcon(APPLY_ICON);
    applyButton.addStyleName("apply-button");
    addComponent(applyButton);
    
    // config form
    final IModuleConfigForm form = getConfigForm(beanItem, module);
    addComponent(form);
    
    // apply button action
    applyButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event)
        {
            try
            {
                form.commit();
                if (module != null)
                    ((IModule<ModuleConfig>)module).updateConfig(beanItem.getBean());
            }
            catch (Exception e)
            {
                String msg = "Error while updating module configuration";
                Page page = AdminUI.getInstance().getPage();
                new Notification("Error", msg + '\n' + e.getMessage(), Notification.Type.ERROR_MESSAGE).show(page);
                //Notification.show("Error", msg + '\n' + e.getMessage(), Notification.Type.ERROR_MESSAGE);
                AdminUI.log.error(msg, e);
            }
        }
    });
}
 
Example 16
Source File: AutoCompleteTextFieldComponent.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private static void setInitialStatusIconStyle(final Label statusIcon) {
    statusIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
    statusIcon.setStyleName("hide-status-label");
}
 
Example 17
Source File: AutoStartOptionGroupLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void createOptionGroup() {
    autoStartOptionGroup = new FlexibleOptionGroup();
    autoStartOptionGroup.addItem(AutoStartOption.MANUAL);
    autoStartOptionGroup.addItem(AutoStartOption.AUTO_START);
    autoStartOptionGroup.addItem(AutoStartOption.SCHEDULED);
    selectDefaultOption();

    final FlexibleOptionGroupItemComponent manualItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.MANUAL);
    manualItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    // set Id for Forced radio button.
    manualItem.setId(UIComponentIdProvider.ROLLOUT_START_MANUAL_ID);
    addComponent(manualItem);
    final Label manualLabel = new Label();
    manualLabel.setStyleName("statusIconPending");
    manualLabel.setIcon(FontAwesome.HAND_PAPER_O);
    manualLabel.setCaption(i18n.getMessage("caption.rollout.start.manual"));
    manualLabel.setDescription(i18n.getMessage("caption.rollout.start.manual.desc"));
    manualLabel.setStyleName("padding-right-style");
    addComponent(manualLabel);

    final FlexibleOptionGroupItemComponent autoStartItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.AUTO_START);
    autoStartItem.setId(UIComponentIdProvider.ROLLOUT_START_AUTO_ID);
    autoStartItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    addComponent(autoStartItem);
    final Label autoStartLabel = new Label();
    autoStartLabel.setSizeFull();
    autoStartLabel.setIcon(FontAwesome.PLAY);
    autoStartLabel.setCaption(i18n.getMessage("caption.rollout.start.auto"));
    autoStartLabel.setDescription(i18n.getMessage("caption.rollout.start.auto.desc"));
    autoStartLabel.setStyleName("padding-right-style");
    addComponent(autoStartLabel);

    final FlexibleOptionGroupItemComponent scheduledItem = autoStartOptionGroup
            .getItemComponent(AutoStartOption.SCHEDULED);
    scheduledItem.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    // setted Id for Time Forced radio button.
    scheduledItem.setId(UIComponentIdProvider.ROLLOUT_START_SCHEDULED_ID);
    addComponent(scheduledItem);
    final Label scheduledLabel = new Label();
    scheduledLabel.setStyleName("statusIconPending");
    scheduledLabel.setIcon(FontAwesome.CLOCK_O);
    scheduledLabel.setCaption(i18n.getMessage("caption.rollout.start.scheduled"));
    scheduledLabel.setDescription(i18n.getMessage("caption.rollout.start.scheduled.desc"));
    scheduledLabel.setStyleName(STYLE_DIST_WINDOW_AUTO_START);
    addComponent(scheduledLabel);

    startAtDateField = new DateField();
    startAtDateField.setInvalidAllowed(false);
    startAtDateField.setInvalidCommitted(false);
    startAtDateField.setEnabled(false);
    startAtDateField.setStyleName("dist-window-forcedtime");

    final TimeZone tz = SPDateTimeUtil.getBrowserTimeZone();
    startAtDateField.setValue(
            Date.from(LocalDateTime.now().plusMinutes(30).atZone(SPDateTimeUtil.getTimeZoneId(tz)).toInstant()));
    startAtDateField.setImmediate(true);
    startAtDateField.setTimeZone(tz);
    startAtDateField.setLocale(HawkbitCommonUtil.getCurrentLocale());
    startAtDateField.setResolution(Resolution.MINUTE);
    startAtDateField.addStyleName(ValoTheme.DATEFIELD_SMALL);
    addComponent(startAtDateField);
}
 
Example 18
Source File: WebUserIndicator.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void refreshUserSubstitutions() {
    component.removeAllComponents();

    UserSessionSource uss = beanLocator.get(UserSessionSource.NAME);
    List<UserSubstitution> substitutions = getUserSubstitutions();

    AppUI ui = AppUI.getCurrent();

    User currentOrSubstitutedUser = uss.getUserSession().getCurrentOrSubstitutedUser();
    if (substitutions.isEmpty()) {
        String substitutedUserCaption = getSubstitutedUserCaption(currentOrSubstitutedUser);

        userComboBox = null;

        userNameLabel = new Label(substitutedUserCaption);
        userNameLabel.setStyleName("c-user-select-label");
        userNameLabel.setSizeUndefined();

        if (ui != null && ui.isTestMode()) {
            userNameLabel.setCubaId("currentUserLabel");
        }

        component.addComponent(userNameLabel);
        component.setDescription(substitutedUserCaption);
    } else {
        userNameLabel = null;

        userComboBox = new CubaComboBox<>();
        userComboBox.setEmptySelectionAllowed(false);
        userComboBox.setItemCaptionGenerator(this::getSubstitutedUserCaption);
        userComboBox.setStyleName("c-user-select-combobox");

        if (ui != null) {
            if (ui.isTestMode()) {
                userComboBox.setCubaId("substitutedUserSelect");
            }
            if (ui.isPerformanceTestMode()) {
                userComboBox.setId(ui.getTestIdManager().getTestId("substitutedUserSelect"));
            }
        }
        List<User> options = new ArrayList<>();
        User sessionUser = uss.getUserSession().getUser();
        options.add(sessionUser);

        for (UserSubstitution substitution : substitutions) {
            User substitutedUser = substitution.getSubstitutedUser();
            options.add(substitutedUser);
        }

        userComboBox.setItems(options);

        userComboBox.setValue(currentOrSubstitutedUser);
        userComboBox.addValueChangeListener(this::substitutedUserChanged);

        component.addComponent(userComboBox);
        component.setDescription(null);
    }

    adjustWidth();
    adjustHeight();
}
 
Example 19
Source File: VaadinPaginator.java    From jdal with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Component buildPanel() {
	// buttons
	if (next == null) {
		setNext(createButton(nextIconUrl));
	}
	
	if (this.last == null) {
		setLast(createButton(lastIconUrl));
	}
	
	if (this.previous == null) {
		setPrevious(createButton(previousIconUrl));
	}
	
	if (this.first == null) {
		setFirst(createButton(firstIconUrl));
	}
	
	// goto page select
	Label goToLabel = new Label(messageSource.getMessage("vaadinPaginator.goto"));
	goToLabel.setSizeUndefined();
	goToLabel.setStyleName(PAGINATOR);
	goTo.addValueChangeListener(new GoToValueChangeListener());
	goTo.setImmediate(true);
	// records by page select
	Label showRecords = new Label(messageSource.getMessage("vaadinPaginator.pageSize"));
	showRecords.setSizeUndefined();
	// page size combo
	for (String size : pageSizes) {
		pgs.addItem(size);
	}
	
	pgs.setNullSelectionAllowed(false);
	pgs.setValue(String.valueOf(getModel().getPageSize()));
	pgs.setWidth("6em");
	pgs.setImmediate(true);
	
	pgs.addValueChangeListener(new PgsValueChangeListener());
	

	BoxFormBuilder fb = new BoxFormBuilder();
	fb.setMargin(false);
	fb.setFixedHeight();
	fb.row();
	fb.add(resultCount);
	fb.addHorizontalGlue();
	fb.add(first);
	fb.add(previous);
	fb.add(status);
	fb.add(next);
	fb.add(last);
	fb.add(goToLabel);
	fb.add(goTo, 60);
	fb.addHorizontalGlue();
	fb.add(showRecords);
	fb.add(pgs, 60);
	
	return fb.getForm();
}
 
Example 20
Source File: LabelFactory.java    From cia with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new Label object.
 *
 * @param panel
 *            the panel
 * @param content
 *            the content
 */
public static void createHeader2Label(final AbstractOrderedLayout panel,final String content) {
	final Label label = new Label(content);
	label.setStyleName("Level2Header");

	panel.addComponent(label);
	panel.setExpandRatio(label,ContentRatio.SMALL);
}