Example usage for com.vaadin.server FontAwesome REFRESH

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

Introduction

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

Prototype

FontAwesome REFRESH

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

Click Source Link

Usage

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.authentication.GatewaySecurityTokenAuthenticationConfigurationItem.java

License:Open Source License

public GatewaySecurityTokenAuthenticationConfigurationItem(
        final TenantConfigurationManagement tenantConfigurationManagement, final VaadinMessageSource i18n,
        final SecurityTokenGenerator securityTokenGenerator) {
    super(TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED,
            tenantConfigurationManagement, i18n);
    this.securityTokenGenerator = securityTokenGenerator;

    super.init("label.configuration.auth.gatewaytoken");

    configurationEnabled = isConfigEnabled();

    detailLayout = new VerticalLayout();
    detailLayout.setImmediate(true);/*from www . j a v a 2s  .  com*/

    final Button gatewaytokenBtn = SPUIComponentProvider.getButton("TODO-ID", "Regenerate Key", "",
            ValoTheme.BUTTON_TINY + " " + "redicon", true, null, SPUIButtonStyleSmall.class);
    gatewaytokenBtn.setImmediate(true);
    gatewaytokenBtn.setIcon(FontAwesome.REFRESH);
    gatewaytokenBtn.addClickListener(event -> generateGatewayToken());

    gatewayTokenkeyLabel = new LabelBuilder().id("gatewaysecuritytokenkey").name("").buildLabel();
    gatewayTokenkeyLabel.addStyleName("gateway-token-label");
    gatewayTokenkeyLabel.setImmediate(true);

    final HorizontalLayout keyGenerationLayout = new HorizontalLayout();
    keyGenerationLayout.setSpacing(true);
    keyGenerationLayout.setImmediate(true);

    keyGenerationLayout.addComponent(gatewayTokenkeyLabel);
    keyGenerationLayout.addComponent(gatewaytokenBtn);

    detailLayout.addComponent(keyGenerationLayout);

    if (isConfigEnabled()) {
        gatewayTokenkeyLabel.setValue(getSecurityTokenKey());
        setDetailVisible(true);
    }
}

From source file:org.jpos.qi.system.ProcessView.java

License:Open Source License

@Override
public void setConfiguration(Element config) throws ConfigurationException {
    super.setConfiguration(config);
    maxLines = Integer.parseInt(config.getAttributeValue("maxLines", "50"));
    Element scriptConfig = getXmlConfiguration();
    if (scriptConfig != null) {
        script = scriptConfig.getText();
        shell = scriptConfig.getAttributeValue("shell", OS.contains("windows") ? "cmd.exe" : "/bin/sh");
    }// w  w w  .java  2 s.c  o  m
    if (repeat == 0) {
        refreshBtn = new Button("refresh", FontAwesome.REFRESH);
        refreshBtn.setStyleName(ValoTheme.BUTTON_SMALL);
        refreshBtn.addClickListener(event -> {
            Thread runner = new Thread(this, getClass().getName());
            runner.start();
        });
        addComponent(refreshBtn);
    }
}

From source file:org.jumpmind.metl.ui.views.ExploreDirectoryView.java

License:Open Source License

public ExploreDirectoryView() {
    setSizeFull();/*from   w w w  .  j av a 2 s .c o m*/
    setMargin(false);

    ButtonBar buttonBar = new ButtonBar();
    Button refreshButton = buttonBar.addButton("Refresh", FontAwesome.REFRESH);
    refreshButton.addClickListener(event -> refresh());
    addComponent(buttonBar);

    table = new TreeTable();
    table.setSizeFull();
    table.addExpandListener(event -> expanded(event));
    table.addCollapseListener(event -> collapsed(event));
    table.setSelectable(true);
    table.addContainerProperty("name", String.class, null);
    table.addGeneratedColumn("name",
            (source, itemId, propertyId) -> fileLinkComponent(source, itemId, propertyId));
    table.setColumnHeader("name", "");
    table.addContainerProperty("lastModified", Date.class, null);
    table.setColumnHeader("lastModified", "Date Modified");
    table.setColumnWidth("lastModified", 150);
    table.addContainerProperty("size", Long.class, null);
    table.setColumnHeader("size", "Size (bytes)");
    table.setColumnExpandRatio("name", 1);
    table.setCellStyleGenerator((source, itemId, propertyId) -> cellStyle(source, itemId, propertyId));
    addComponent(table);
    setExpandRatio(table, 1);

}

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/* ww w . ja  va  2 s  . c o  m*/
        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;
}

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

License:Open Source License

private void createMenuBar() {
    HorizontalLayout resultBar = new HorizontalLayout();
    resultBar.setWidth(100, Unit.PERCENTAGE);
    resultBar.setMargin(new MarginInfo(false, true, false, true));

    HorizontalLayout leftBar = new HorizontalLayout();
    leftBar.setSpacing(true);//from   w w w  . j  a v  a2s.c  o  m
    resultLabel = new Label("", ContentMode.HTML);
    leftBar.addComponent(resultLabel);

    final Label sqlLabel = new Label("", ContentMode.TEXT);
    sqlLabel.setWidth(800, Unit.PIXELS);
    leftBar.addComponent(sqlLabel);

    resultBar.addComponent(leftBar);
    resultBar.setComponentAlignment(leftBar, Alignment.MIDDLE_LEFT);
    resultBar.setExpandRatio(leftBar, 1);

    MenuBar rightBar = new MenuBar();
    rightBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    rightBar.addStyleName(ValoTheme.MENUBAR_SMALL);

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

        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            listener.reExecute(sql);
        }
    });
    refreshButton.setIcon(FontAwesome.REFRESH);

    MenuBar.MenuItem exportButton = rightBar.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            new ExportDialog(grid, db.getName(), sql).show();
        }
    });
    exportButton.setIcon(FontAwesome.UPLOAD);

    if (isInQueryGeneralResults) {
        MenuBar.MenuItem keepResultsButton = rightBar.addItem("", new Command() {
            private static final long serialVersionUID = 1L;

            @Override
            public void menuSelected(com.vaadin.ui.MenuBar.MenuItem selectedItem) {
                queryPanel.addResultsTab(refreshWithoutSaveButton(), StringUtils.abbreviate(sql, 20),
                        queryPanel.getGeneralResultsTab().getIcon());
                queryPanel.resetGeneralResultsTab();
            }
        });
        keepResultsButton.setIcon(FontAwesome.CLONE);
        keepResultsButton.setDescription("Save these results to a new tab");
    }

    if (showSql) {
        sqlLabel.setValue(StringUtils.abbreviate(sql, 200));
    }

    resultBar.addComponent(rightBar);
    resultBar.setComponentAlignment(rightBar, Alignment.MIDDLE_RIGHT);

    this.addComponent(resultBar, 0);
}

From source file:org.opennms.features.topology.app.internal.ui.ToolbarPanel.java

License:Open Source License

public ToolbarPanel(final ToolbarPanelController controller) {
    addStyleName(Styles.TOOLBAR);//w  ww .j av  a 2  s  .co  m
    this.layoutManager = controller.getLayoutManager();

    final Property<Double> scale = controller.getScaleProperty();
    final Boolean[] eyeClosed = new Boolean[] { false };
    final Button showFocusVerticesBtn = new Button();
    showFocusVerticesBtn.setIcon(FontAwesome.EYE);
    showFocusVerticesBtn.setDescription("Toggle Highlight Focus Nodes");
    showFocusVerticesBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (eyeClosed[0]) {
                showFocusVerticesBtn.setIcon(FontAwesome.EYE);
            } else {
                showFocusVerticesBtn.setIcon(FontAwesome.EYE_SLASH);
            }
            eyeClosed[0] = !eyeClosed[0]; // toggle
            controller.toggleHighlightFocus();
        }
    });

    final Button magnifyBtn = new Button();
    magnifyBtn.setIcon(FontAwesome.PLUS);
    magnifyBtn.setDescription("Magnify");
    magnifyBtn.addClickListener(
            (Button.ClickListener) event -> scale.setValue(Math.min(1, scale.getValue() + 0.25)));

    final Button demagnifyBtn = new Button();
    demagnifyBtn.setIcon(FontAwesome.MINUS);
    demagnifyBtn.setDescription("Demagnify");
    demagnifyBtn.addClickListener(
            (Button.ClickListener) event -> scale.setValue(Math.max(0, scale.getValue() - 0.25)));

    m_szlOutBtn = new Button();
    m_szlOutBtn.setId("szlOutBtn");
    m_szlOutBtn.setIcon(FontAwesome.ANGLE_DOWN);
    m_szlOutBtn.setDescription("Decrease Semantic Zoom Level");
    m_szlOutBtn.setEnabled(controller.getSemanticZoomLevel() > 0);
    m_szlOutBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            int szl = controller.getSemanticZoomLevel();
            if (szl > 0) {
                setSemanticZoomLevel(controller, szl - 1);
                controller.saveHistory();
            }
        }
    });

    final Button szlInBtn = new Button();
    szlInBtn.setId("szlInBtn");
    szlInBtn.setIcon(FontAwesome.ANGLE_UP);
    szlInBtn.setDescription("Increase Semantic Zoom Level");
    szlInBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            setSemanticZoomLevel(controller, controller.getSemanticZoomLevel() + 1);
            controller.saveHistory();
        }
    });

    m_zoomLevelLabel.setId("szlInputLabel");

    m_panBtn = new Button();
    m_panBtn.setIcon(FontAwesome.ARROWS);
    m_panBtn.setDescription("Pan Tool");
    m_panBtn.addStyleName(Styles.SELECTED);

    m_selectBtn = new Button();
    m_selectBtn.setIcon(IonicIcons.ANDROID_EXPAND);
    m_selectBtn.setDescription("Selection Tool");
    m_selectBtn.setStyleName("toolbar-button");
    m_selectBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            m_selectBtn.addStyleName(Styles.SELECTED);
            m_panBtn.removeStyleName(Styles.SELECTED);
            controller.setActiveTool(ActiveTool.select);
        }
    });

    m_panBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            m_panBtn.addStyleName(Styles.SELECTED);
            m_selectBtn.removeStyleName(Styles.SELECTED);
            controller.setActiveTool(ActiveTool.pan);
        }
    });

    Button showAllMapBtn = new Button();
    showAllMapBtn.setId("showEntireMapBtn");
    showAllMapBtn.setIcon(FontAwesome.GLOBE);
    showAllMapBtn.setDescription("Show Entire Map");
    showAllMapBtn.addClickListener((Button.ClickListener) event -> controller.showAllMap());

    Button centerSelectionBtn = new Button();
    centerSelectionBtn.setIcon(FontAwesome.LOCATION_ARROW);
    centerSelectionBtn.setDescription("Center On Selection");
    centerSelectionBtn.addClickListener((Button.ClickListener) event -> controller.centerMapOnSelection());

    Button shareButton = new Button("", FontAwesome.SHARE_SQUARE_O);
    shareButton.setDescription("Share");
    shareButton.addClickListener((x) -> {
        // Create the share link
        String fragment = getUI().getPage().getLocation().getFragment();
        String url = getUI().getPage().getLocation().toString().replace("#" + fragment, "");
        String shareLink = String.format("%s?%s=%s", url, PARAMETER_HISTORY_FRAGMENT, fragment);

        // Create the Window
        Window shareWindow = new Window();
        shareWindow.setCaption("Share Link");
        shareWindow.setModal(true);
        shareWindow.setClosable(true);
        shareWindow.setResizable(false);
        shareWindow.setWidth(400, Sizeable.Unit.PIXELS);

        TextArea shareLinkField = new TextArea();
        shareLinkField.setValue(shareLink);
        shareLinkField.setReadOnly(true);
        shareLinkField.setRows(3);
        shareLinkField.setWidth(100, Sizeable.Unit.PERCENTAGE);

        // Close Button
        Button close = new Button("Close");
        close.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);
        close.addClickListener(event -> shareWindow.close());

        // Layout for Buttons
        HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.setMargin(true);
        buttonLayout.setSpacing(true);
        buttonLayout.setWidth("100%");
        buttonLayout.addComponent(close);
        buttonLayout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT);

        // Content Layout
        VerticalLayout verticalLayout = new VerticalLayout();
        verticalLayout.setMargin(true);
        verticalLayout.setSpacing(true);
        verticalLayout.addComponent(
                new Label("Please use the following link to share the current view with others."));
        verticalLayout.addComponent(shareLinkField);
        verticalLayout.addComponent(buttonLayout);

        shareWindow.setContent(verticalLayout);

        getUI().addWindow(shareWindow);
    });

    // Refresh Button
    Button refreshButton = new Button();
    refreshButton.setId("refreshNow");
    refreshButton.setIcon(FontAwesome.REFRESH);
    refreshButton.setDescription("Refresh Now");
    refreshButton.addClickListener((event) -> controller.refreshUI());

    // Layer Layout
    layerLayout = new VerticalLayout();
    layerLayout.setId("layerComponent");
    layerLayout.setSpacing(true);
    layerLayout.setMargin(true);

    // Layer Button
    layerButton = new Button();
    layerButton.setId("layerToggleButton");
    layerButton.setIcon(FontAwesome.BARS);
    layerButton.setDescription("Layers");
    layerButton.addClickListener((event) -> {
        boolean isCollapsed = layerButton.getStyleName().contains(Styles.EXPANDED);
        setLayerLayoutVisible(!isCollapsed);
    });

    // Save button
    layerSaveButton = new Button();
    layerSaveButton.setId("saveLayerButton");
    layerSaveButton.setIcon(FontAwesome.FLOPPY_O);
    layerSaveButton.addClickListener((event) -> controller.saveLayout());

    // Actual Layout for the Toolbar
    CssLayout contentLayout = new CssLayout();
    contentLayout.addStyleName("toolbar-component");
    contentLayout.addComponent(createGroup(szlInBtn, m_zoomLevelLabel, m_szlOutBtn));
    contentLayout.addComponent(
            createGroup(refreshButton, centerSelectionBtn, showAllMapBtn, layerButton, showFocusVerticesBtn));
    contentLayout.addComponent(createGroup(m_panBtn, m_selectBtn));
    contentLayout.addComponent(createGroup(magnifyBtn, demagnifyBtn));
    contentLayout.addComponent(createGroup(shareButton));
    contentLayout.addComponent(createGroup(layerSaveButton));

    // Toolbar
    addComponent(contentLayout);
}

From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceMainLayout.java

License:Open Source License

public BusinessServiceMainLayout(BusinessServiceManager businessServiceManager) {
    m_businessServiceManager = Objects.requireNonNull(businessServiceManager);
    m_table = new BusinessServiceTreeTable(businessServiceManager);

    setSizeFull();/*from w w w  .  j ava 2  s  .  com*/

    // Create button
    final Button createButton = UIHelper.createButton("New Business Service", null, FontAwesome.PLUS_SQUARE,
            (Button.ClickListener) event -> {
                final BusinessService businessService = m_businessServiceManager.createBusinessService();
                final BusinessServiceEditWindow window = new BusinessServiceEditWindow(businessService,
                        m_businessServiceManager);
                window.addCloseListener(e -> m_table.refresh());
                getUI().addWindow(window);
            });
    createButton.setId("createButton");

    // Collapse all
    final Button collapseButton = UIHelper.createButton("Collapse All", null, FontAwesome.FOLDER,
            (Button.ClickListener) event -> {
                m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, true));
            });
    collapseButton.setId("collapseButton");

    // Expand all
    final Button expandButton = UIHelper.createButton("Expand All", null, FontAwesome.FOLDER_OPEN,
            (Button.ClickListener) event -> {
                m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, false));
            });
    expandButton.setId("expandButton");

    // Refresh
    final Button refreshButton = UIHelper.createButton("Refresh Table", null, FontAwesome.REFRESH,
            (Button.ClickListener) event -> {
                m_table.refresh();
            });
    refreshButton.setId("refreshButton");

    // Reload daemon
    final Button reloadButton = UIHelper.createButton("Reload Daemon",
            "Reloads the Business Service State Machine", FontAwesome.RETWEET, (Button.ClickListener) event -> {
                m_businessServiceManager.triggerDaemonReload();
            });
    reloadButton.setId("reloadButton");

    // Group the create and collapse buttons on the left
    HorizontalLayout leftButtonGroup = new HorizontalLayout();
    leftButtonGroup.setSpacing(true);
    leftButtonGroup.addComponent(createButton);
    leftButtonGroup.addComponent(collapseButton);
    leftButtonGroup.addComponent(expandButton);
    leftButtonGroup.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    // Group the refresh and reload buttons to the right
    HorizontalLayout rightButtonGroup = new HorizontalLayout();
    rightButtonGroup.setSpacing(true);
    rightButtonGroup.addComponent(refreshButton);
    rightButtonGroup.addComponent(reloadButton);
    rightButtonGroup.setDefaultComponentAlignment(Alignment.TOP_RIGHT);

    // Build the upper layout
    HorizontalLayout upperLayout = new HorizontalLayout();
    upperLayout.setSpacing(true);
    upperLayout.addComponent(leftButtonGroup);
    upperLayout.addComponent(rightButtonGroup);
    upperLayout.setComponentAlignment(leftButtonGroup, Alignment.TOP_LEFT);
    upperLayout.setComponentAlignment(rightButtonGroup, Alignment.TOP_RIGHT);
    upperLayout.setWidth(100, Unit.PERCENTAGE);
    addComponent(upperLayout);

    // Add some space between the upper layout and the table
    Label sz = new Label("");
    sz.setWidth(null);
    sz.setHeight(5, Unit.PIXELS);
    addComponent(sz);

    /**
     * add the table to the layout
     */
    addComponent(m_table);
    setExpandRatio(m_table, 1.0f);

    /**
     * initial refresh of table
     */
    m_table.refresh();
}

From source file:steps.EntityStep.java

License:Open Source License

/**
 * Create a new Entity step for the wizard
 * //from w ww . j  a v a  2  s .  co  m
 * @param speciesMap A map of available species (codes and labels)
 * @param people
 */
public EntityStep(Map<String, String> speciesMap, Set<String> people) {
    main = new VerticalLayout();
    main.setMargin(true);
    main.setSpacing(true);
    Label header = new Label("Sample Sources");
    main.addComponent(Styles.questionize(header,
            "Sample sources are individual patients, animals or plants that are used in the experiment. "
                    + "You can input (optional) experimental variables, e.g. genotypes, that differ between different experimental groups.",
            "Sample Sources"));
    ArrayList<String> openbisSpecies = new ArrayList<String>();
    openbisSpecies.addAll(speciesMap.keySet());
    Collections.sort(openbisSpecies);
    species = new ComboBox("Species", openbisSpecies);
    species.setStyleName(Styles.boxTheme);
    species.setRequired(true);
    species.setFilteringMode(FilteringMode.CONTAINS);
    if (ProjectwizardUI.testMode)
        species.setValue("Homo Sapiens");
    speciesNum = new OpenbisInfoTextField("How many different species are there in this project?", "", "50px",
            "2");
    speciesNum.getInnerComponent().setVisible(false);
    speciesNum.getInnerComponent().setEnabled(false);
    c = new ConditionsPanel(suggestions, emptyFactor, "Species", species, true, conditionsSet,
            (TextField) speciesNum.getInnerComponent());
    expName = new TextField("Experimental Step Name");
    expName.setStyleName(Styles.fieldTheme);
    main.addComponent(expName);
    main.addComponent(c);
    main.addComponent(speciesNum.getInnerComponent());
    main.addComponent(species);

    species.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1987640360028444299L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            specialSpecies.setVisible(species.getValue().equals("Other"));
        }
    });
    specialSpecies = new TextField("Species Information");
    specialSpecies.setStyleName(Styles.fieldTheme);
    specialSpecies.setVisible(false);
    specialSpecies.setWidth("350px");
    main.addComponent(specialSpecies);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Contact Person");
    person = new ComboBox();
    person.addItems(people);
    person.setFilteringMode(FilteringMode.CONTAINS);
    person.setStyleName(Styles.boxTheme);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(person);
    persBoxH.addComponent(reloadPeople);

    main.addComponent(Styles.questionize(persBoxH, "Contact person responsible for patients or sample sources.",
            "Contact Person"));

    bioReps = new OpenbisInfoTextField(
            "How many identical biological replicates (e.g. animals) per group are there?",
            "Number of (biological) replicates for each group." + "Technical replicates are added later!",
            "50px", "1");
    main.addComponent(bioReps.getInnerComponent());
}

From source file:steps.ExtractionStep.java

License:Open Source License

/**
 * Create a new Extraction step for the wizard
 * /*w w w.j ava 2 s. c  o m*/
 * @param tissueMap A map of available tissues (codes and labels)
 * @param cellLinesMap
 */
public ExtractionStep(Map<String, String> tissueMap, Map<String, String> cellLinesMap, Set<String> people) {
    main = new VerticalLayout();
    main.setMargin(true);
    main.setSpacing(true);
    Label header = new Label("Sample Extracts");
    main.addComponent(Styles.questionize(header,
            "Extracts are individual tissue or other samples taken from organisms and used in the experiment. "
                    + "You can input (optional) experimental variables, e.g. extraction times or treatments, that differ between different groups "
                    + "of extracts.",
            "Sample Extracts"));

    ArrayList<String> tissues = new ArrayList<String>();
    tissues.addAll(tissueMap.keySet());
    Collections.sort(tissues);
    tissue = new ComboBox("Tissue", tissues);
    tissue.setRequired(true);
    tissue.setStyleName(Styles.boxTheme);
    tissue.setFilteringMode(FilteringMode.CONTAINS);
    if (ProjectwizardUI.testMode)
        tissue.setValue("Blood");
    tissueNum = new OpenbisInfoTextField("How many different tissue types are there in this sample extraction?",
            "", "50px", "2");
    tissueNum.getInnerComponent().setVisible(false);
    tissueNum.getInnerComponent().setEnabled(false);

    expName = new TextField("Experimental Step Name");
    expName.setStyleName(Styles.fieldTheme);
    main.addComponent(expName);

    c = new ConditionsPanel(suggestions, emptyFactor, "Tissue", tissue, true, conditionsSet,
            (TextField) tissueNum.getInnerComponent());
    main.addComponent(c);

    isotopes = new CheckBox("Isotope Labeling");
    isotopes.setImmediate(true);
    main.addComponent(Styles.questionize(isotopes,
            "Are extracted cells labeled by isotope labeling (e.g. for Mass Spectrometry)?",
            "Isotope Labeling"));

    labelingMethods = initLabelingMethods();

    isotopeTypes = new ComboBox();
    isotopeTypes.setVisible(false);
    isotopeTypes.setImmediate(true);
    isotopeTypes.setStyleName(Styles.boxTheme);
    isotopeTypes.setNullSelectionAllowed(false);
    for (LabelingMethod l : labelingMethods)
        isotopeTypes.addItem(l.getName());
    main.addComponent(isotopeTypes);

    isotopes.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 6993706766195224898L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            isotopeTypes.setVisible(isotopes.getValue());
        }
    });
    main.addComponent(tissueNum.getInnerComponent());
    main.addComponent(tissue);

    tissue.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1987640360028444299L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            cellLine.setVisible(tissue.getValue().equals("Cell Line"));
            otherTissue.setVisible(tissue.getValue().equals("Other"));
        }
    });
    ArrayList<String> cellLines = new ArrayList<String>();
    cellLines.addAll(cellLinesMap.keySet());
    Collections.sort(cellLines);
    cellLine = new ComboBox("Cell Line", cellLines);
    cellLine.setStyleName(Styles.boxTheme);
    cellLine.setImmediate(true);
    cellLine.setVisible(false);
    cellLine.setFilteringMode(FilteringMode.CONTAINS);
    main.addComponent(cellLine);
    otherTissue = new TextField("Tissue Information");
    otherTissue.setWidth("350px");
    otherTissue.setStyleName(Styles.fieldTheme);
    otherTissue.setVisible(false);
    main.addComponent(otherTissue);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Contact Person");
    person = new ComboBox();
    person.addItems(people);
    person.setFilteringMode(FilteringMode.CONTAINS);
    person.setStyleName(Styles.boxTheme);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(person);
    persBoxH.addComponent(reloadPeople);

    main.addComponent(Styles.questionize(persBoxH, "Contact person responsible for tissue extraction.",
            "Contact Person"));

    extractReps = new OpenbisInfoTextField(
            "Extracted replicates per patient/animal/plant per experimental variable.",
            "Number of extractions per individual defined in the last step. "
                    + "Technical replicates are added later!",
            "50px", "1");
    main.addComponent(extractReps.getInnerComponent());
}

From source file:uicomponents.ProjectInformationComponent.java

License:Open Source License

public ProjectInformationComponent(List<String> spaces, Set<String> people) {
    setSpacing(true);/*from  ww w .  ja va  2 s .co m*/
    setSizeUndefined();

    Collections.sort(spaces);
    spaceBox = new ComboBox("Project", spaces);
    spaceBox.setStyleName(Styles.boxTheme);
    spaceBox.setNullSelectionAllowed(false);
    spaceBox.setImmediate(true);
    spaceBox.setFilteringMode(FilteringMode.CONTAINS);
    addComponent(Styles.questionize(spaceBox, "Name of the project", "Project Name"));

    ComboBox prBox = new ComboBox("Sub-Project");
    prBox.setStyleName(Styles.boxTheme);
    projectBox = new CustomVisibilityComponent(prBox);
    projectBox.setStyleName(Styles.boxTheme);
    projectBox.setImmediate(true);
    addComponent(Styles.questionize(projectBox, "QBiC 5 letter project code", "Project"));

    project = new StandardTextField();
    project.setStyleName(Styles.fieldTheme);
    project.setMaxLength(5);
    project.setWidth("90px");
    project.setEnabled(false);
    project.setValidationVisible(true);

    reloadProjects = new Button();
    Styles.iconButton(reloadProjects, FontAwesome.REFRESH);

    HorizontalLayout proj = new HorizontalLayout();
    proj.setCaption("New Sub-Project");
    proj.addComponent(project);
    proj.addComponent(reloadProjects);
    CustomVisibilityComponent newProj = new CustomVisibilityComponent(proj);

    addComponent(Styles.questionize(newProj,
            "Automatically create an unused QBiC project code or fill in your own. "
                    + "The code consists of 5 characters, must start with Q and not contain Y or Z. You can create a random unused code by clicking "
                    + FontAwesome.REFRESH.getHtml() + ".",
            "New Sub-Project"));
    expName = new StandardTextField("Short name");
    expName.setWidth("200px");
    // expName.setRequired(true);
    expName.setVisible(false);
    expName.setInputPrompt("Name of sub project");
    addComponent(expName);

    HorizontalLayout persBoxH = new HorizontalLayout();
    persBoxH.setCaption("Principal Investigator");
    VerticalLayout persBox = new VerticalLayout();

    piBox = new ComboBox();
    piBox.addItems(people);
    piBox.setFilteringMode(FilteringMode.CONTAINS);
    piBox.setStyleName(Styles.boxTheme);
    contactBox = new ComboBox("Contact Person", people);
    contactBox.setFilteringMode(FilteringMode.CONTAINS);
    contactBox.setStyleName(Styles.boxTheme);
    managerBox = new ComboBox("Project Manager", people);
    managerBox.setFilteringMode(FilteringMode.CONTAINS);
    managerBox.setStyleName(Styles.boxTheme);
    persBox.addComponent(piBox);
    persBox.addComponent(contactBox);
    persBox.addComponent(managerBox);

    reloadPeople = new Button();
    Styles.iconButton(reloadPeople, FontAwesome.REFRESH);
    persBoxH.addComponent(persBox);
    persBoxH.addComponent(reloadPeople);

    personBox = new CustomVisibilityComponent(persBoxH);
    personBox.setVisible(false);
    addComponent(Styles.questionize(personBox,
            "Investigator and contact person of this project. Please contact us if additional people need to be added. Press refresh button to show newly added people.",
            "Contacts"));

    projectDescription = new TextArea("Description");
    projectDescription.setRequired(true);
    projectDescription.setStyleName(Styles.fieldTheme);
    projectDescription.setInputPrompt("Sub-Project description, maximum of 2000 symbols.");
    projectDescription.setWidth("100%");
    projectDescription.setHeight("110px");
    projectDescription.setVisible(false);
    StringLengthValidator lv = new StringLengthValidator(
            "Description is only allowed to contain a maximum of 2000 letters.", 0, 2000, true);
    projectDescription.addValidator(lv);
    projectDescription.setImmediate(true);
    projectDescription.setValidationVisible(true);
    addComponent(projectDescription);
}