Example usage for com.vaadin.server FontAwesome GEAR

List of usage examples for com.vaadin.server FontAwesome GEAR

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome GEAR.

Prototype

FontAwesome GEAR

To view the source code for com.vaadin.server FontAwesome GEAR.

Click Source Link

Usage

From source file:com.etest.view.tq.TQCoverageUI.java

Component buildTQCoverageForms() {
    FormLayout form = new FormLayout();
    form.setWidth("500px");

    examTitle.setCaption("Exam Title: ");
    examTitle.setWidth("100%");
    examTitle.setIcon(FontAwesome.TAG);/*from w  w  w  .  j av  a 2s.  c  o m*/
    examTitle.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(examTitle);

    subject.setCaption("Subject: ");
    subject.setWidth("100%");
    subject.setIcon(FontAwesome.BOOK);
    subject.addStyleName(ValoTheme.COMBOBOX_SMALL);
    subject.addValueChangeListener((new CurriculumPropertyChangeListener(topic)));
    form.addComponent(subject);

    totalItems.setCaption("No. of Test Items: ");
    totalItems.setWidth("50%");
    totalItems.setValue("0");
    totalItems.setIcon(FontAwesome.TAG);
    totalItems.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    totalItems.addValueChangeListener(fieldValueListener);
    form.addComponent(totalItems);

    Button button = new Button("ADD ROW");
    button.setWidth("50%");
    button.setIcon(FontAwesome.GEAR);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        if (examTitle.getValue() == null || examTitle.getValue().trim().isEmpty()) {
            Notification.show("Select an Exam Title!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (subject.getValue() == null) {
            Notification.show("Select a Subject!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (totalItems.getValue() == null || totalItems.getValue().trim().isEmpty()) {
            Notification.show("Enter No. of Test Items!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        grid.addRow(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null, null, null, null, null, null, null, null, null, null, null, null, null, "del");
    });
    form.addComponent(button);

    return form;
}

From source file:org.eclipse.hawkbit.simulator.ui.GenerateDialog.java

License:Open Source License

/**
 * Creates a new pop window for setting the configuration of simulating
 * devices./*w  w w .  j  a  v a  2s  .c  om*/
 * 
 * @param callback
 *            the callback which is called when the dialog has been
 *            successfully confirmed.
 * @param dmfEnabled
 *            indicates if the AMQP/DMF interface is enabled by
 *            configuration and if the option DMF should be enabled or not
 */
public GenerateDialog(final GenerateDialogCallback callback, final boolean dmfEnabled) {
    this.dmfEnabled = dmfEnabled;
    formLayout.setSpacing(true);
    formLayout.setMargin(true);

    namePrefixTextField = createRequiredTextfield("name prefix", "dmfSimulated", FontAwesome.INFO,
            new NullValidator("Must be given", false));

    amountTextField = createRequiredTextfield("amount", new ObjectProperty<Integer>(10), FontAwesome.GEAR,
            new RangeValidator<Integer>("Must be between 1 and 30000", Integer.class, 1, 30000));

    tenantTextField = createRequiredTextfield("tenant", "default", FontAwesome.USER,
            new NullValidator("Must be given", false));

    pollDelayTextField = createRequiredTextfield("poll delay (sec)", new ObjectProperty<Integer>(10),
            FontAwesome.CLOCK_O, new RangeValidator<Integer>("Must be between 1 and 60", Integer.class, 1, 60));

    pollUrlTextField = createRequiredTextfield("base poll URL endpoint", "http://localhost:8080",
            FontAwesome.FLAG_O,
            new RegexpValidator("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]",
                    "is not an URL"));
    pollUrlTextField.setColumns(50);
    pollUrlTextField.setVisible(false);

    gatewayTokenTextField = createRequiredTextfield("gateway token", "", FontAwesome.FLAG_O, null);
    gatewayTokenTextField.setColumns(50);
    gatewayTokenTextField.setVisible(false);

    createProtocolGroup();
    createOkButton(callback);

    namePrefixTextField.addValueChangeListener(event -> checkValid());
    amountTextField.addValueChangeListener(event -> checkValid());
    tenantTextField.addValueChangeListener(event -> checkValid());

    formLayout.addComponent(namePrefixTextField);
    formLayout.addComponent(amountTextField);
    formLayout.addComponent(tenantTextField);
    formLayout.addComponent(protocolGroup);
    formLayout.addComponent(pollDelayTextField);
    formLayout.addComponent(pollUrlTextField);
    formLayout.addComponent(gatewayTokenTextField);
    formLayout.addComponent(buttonOk);

    setCaption("Simulate Devices");
    setContent(formLayout);
    setResizable(false);
    center();
}

From source file:org.jumpmind.metl.ui.common.TopBar.java

License:Open Source License

public TopBar(ViewManager vm, ApplicationContext context) {
    setWidth(100, Unit.PERCENTAGE);//from ww  w .  j a  v a2  s .  c om
    this.context = context;
    this.viewManager = vm;
    this.viewManager.addViewChangeListener(this);

    viewToButtonMapping = new HashMap<String, MenuItem>();

    menuBar = new MenuBar();
    menuBar.setWidth(100, Unit.PERCENTAGE);
    addComponent(menuBar);
    setExpandRatio(menuBar, 1.0f);

    String systemText = getGlobalSetting(GlobalSetting.SYSTEM_TEXT, "").getValue();
    if (isNotBlank(systemText)) {
        Button systemLabel = new Button(systemText, FontAwesome.WARNING);
        systemLabel.setHtmlContentAllowed(true);
        addComponent(systemLabel);
    }

    Button helpButton = new Button("Help", FontAwesome.QUESTION_CIRCLE);
    helpButton.addClickListener(event -> openHelp(event));
    addComponent(helpButton);

    Button settingsButton = new Button(context.getUser().getLoginId(), FontAwesome.GEAR);
    settingsButton.addClickListener((event) -> {
    });
    addComponent(settingsButton);

    Button logoutButton = new Button("Logout", FontAwesome.SIGN_OUT);
    logoutButton.addClickListener(event -> logout());
    addComponent(logoutButton);

    Map<Category, List<TopBarLink>> menuItemsByCategory = viewManager.getMenuItemsByCategory();
    Set<Category> categories = menuItemsByCategory.keySet();
    for (Category category : categories) {
        if (!context.getUser().hasPrivilege(category.name())) {
            log.info("'{}' does not have access to the {} menu tab", context.getUser(), category.name());
            continue;
        }
        List<TopBarLink> links = menuItemsByCategory.get(category);
        boolean needDefaultView = viewManager.getDefaultView() == null && links.size() > 0;
        MenuItem categoryItem = null;
        if (links.size() > 1) {
            categoryItem = menuBar.addItem(category.name(), null);
            categoryItems.add(categoryItem);
        }

        if (needDefaultView) {
            viewManager.setDefaultView(links.get(0).id());
        }

        for (final TopBarLink menuLink : links) {
            Command command = new Command() {

                private static final long serialVersionUID = 1L;

                @Override
                public void menuSelected(MenuItem selectedItem) {
                    uncheckAll();
                    selectedItem.setChecked(true);
                    viewManager.navigateTo(menuLink.id());
                }
            };
            MenuItem menuItem = null;
            if (categoryItem == null) {
                menuItem = menuBar.addItem(menuLink.name(), command);
            } else {
                menuItem = categoryItem.addItem(menuLink.name(), command);
            }
            menuItem.setCheckable(true);
            viewToButtonMapping.put(menuLink.id(), menuItem);
        }
    }
    viewManager.navigateTo(viewManager.getDefaultView());
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.SqlExplorer.java

License:Open Source License

protected MenuBar buildLeftMenu() {
    MenuBar leftMenu = new MenuBar();
    leftMenu.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    leftMenu.setWidth(100, Unit.PERCENTAGE);
    MenuItem hideButton = leftMenu.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override/*w  ww.j ava 2  s . com*/
        public void menuSelected(MenuItem selectedItem) {
            savedSplitPosition = getSplitPosition() > 10 ? getSplitPosition() : DEFAULT_SPLIT_POS;
            setSplitPosition(0);
            setLocked(true);
            showButton.setVisible(true);
        }
    });
    hideButton.setDescription("Hide the database explorer");
    hideButton.setIcon(FontAwesome.BARS);

    MenuItem refreshButton = leftMenu.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            dbTree.refresh();
            Component tab = contentTabs.getSelectedTab();
            if (tab instanceof QueryPanel) {
                findQueryPanelForDb(((QueryPanel) tab).db).suggester.clearCaches();
            }
        }
    });
    refreshButton.setIcon(FontAwesome.REFRESH);
    refreshButton.setDescription("Refresh the database explorer");

    MenuItem openQueryTab = leftMenu.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            openQueryWindow(dbTree.getSelected());
        }
    });
    openQueryTab.setIcon(QUERY_ICON);
    openQueryTab.setDescription("Open a query tab");

    MenuItem settings = leftMenu.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            SettingsDialog dialog = new SettingsDialog(SqlExplorer.this);
            dialog.showAtSize(.5);
        }
    });
    settings.setIcon(FontAwesome.GEAR);
    settings.setDescription("Modify sql explorer settings");
    return leftMenu;
}