Example usage for com.vaadin.server FontAwesome FLOPPY_O

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

Introduction

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

Prototype

FontAwesome FLOPPY_O

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

Click Source Link

Usage

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

License:Open Source License

public ToolbarPanel(final ToolbarPanelController controller) {
    addStyleName(Styles.TOOLBAR);//from  www  .ja v  a2  s .c om
    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:pl.exsio.ca.module.terrain.evidence.QuickNotifyWindow.java

License:Open Source License

private Button getSaveButton(final DateField date, final ComboBox event) {
    Button save = new Button("", FontAwesome.FLOPPY_O);
    save.addClickListener(new Button.ClickListener() {

        @Override/* w  w w .  jav a2  s  .  c o m*/
        public void buttonClick(Button.ClickEvent e) {
            save(date.getValue(), (pl.exsio.ca.model.Event) event.getConvertedValue());
        }
    });
    return save;
}

From source file:pl.exsio.frameset.vaadin.account.window.view.AccountWindowView.java

License:Open Source License

private Button createSaveButton() {
    Button saveButton = new Button(t("core.save"), FontAwesome.FLOPPY_O);
    saveButton.addClickListener(new Button.ClickListener() {

        @Override//from w w  w. j a  v  a  2 s . c om
        public void buttonClick(Button.ClickEvent event) {
            presenter.save();
        }

    });
    return saveButton;
}

From source file:pl.exsio.frameset.vaadin.module.management.frames.BasicFrameDataForm.java

License:Open Source License

private Button createSaveButton(final Form form) {
    Button saveButton = new Button(t("save"), FontAwesome.FLOPPY_O);
    saveButton.addClickListener(new Button.ClickListener() {

        @Override//from   w w  w  .j a  v a 2  s  .  c  om
        public void buttonClick(Button.ClickEvent event) {
            form.commit();
            Notification.show(t("edition.success"));
        }
    });
    return saveButton;
}

From source file:pl.exsio.frameset.vaadin.ui.support.component.data.common.DataComponent.java

License:Open Source License

private Button createFormSaveButton(final I item, final F form, final C container, final Window formWindow,
        final int mode) {
    Button save = new Button(t(config.getFormSaveButtonLabel()), FontAwesome.FLOPPY_O);
    save.addClickListener(new Button.ClickListener() {
        @Override/*from  w w w.jav a 2  s.co m*/
        public void buttonClick(Button.ClickEvent event) {
            handleFormSave(item, form, container, formWindow, mode);
        }
    });
    if ((mode == MODE_EDITION && !this.canSaveItem(item)) || (mode == MODE_ADDITION && !this.canAddItem())) {
        save.setEnabled(false);
    }
    save.setStyleName("frameset-dc-form-button-save");
    return save;
}

From source file:pl.exsio.frameset.vaadin.ui.support.component.data.form.SecurityPermissionsForm.java

License:Open Source License

private void handleRoleSelectionChange(ComboBox roleSelect, final FormLayout permissionsLayout,
        final JPAContainer<? extends Role> roles, final Map<String, Permission> permissionsMap) {
    roleSelect.addValueChangeListener(new Property.ValueChangeListener() {

        private Map<CheckBox, Permission> permissionCbsMap;

        @Override//from  ww  w  .jav  a 2  s.c o m
        public void valueChange(Property.ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                this.createRolePermissionsForm(event);
            }
        }

        private void createRolePermissionsForm(Property.ValueChangeEvent event) throws NumberFormatException {
            this.permissionCbsMap = new HashMap<>();
            permissionsLayout.removeAllComponents();

            Long itemId = Long.parseLong(event.getProperty().getValue().toString());
            Role selectedRole = roles.getItem(itemId).getEntity();
            final GrantedAuthoritySid sid = new GrantedAuthoritySid(selectedRole.getName());

            for (String permissionName : permissionsMap.keySet()) {
                CheckBox permissionCb = this.createPermissionCheckbox(permissionName, sid);
                permissionsLayout.addComponent(permissionCb);
            }

            Button savePermissions = this.createSaveButton(sid);
            permissionsLayout.addComponent(savePermissions);
        }

        private CheckBox createPermissionCheckbox(String permissionName, final GrantedAuthoritySid sid) {
            CheckBox permissionCb = new CheckBox(permissionName,
                    acl.isGranted(subject, permissionsMap.get(permissionName), sid));
            this.permissionCbsMap.put(permissionCb, permissionsMap.get(permissionName));
            return permissionCb;
        }

        private Button createSaveButton(final GrantedAuthoritySid sid) {
            Button savePermissions = new Button(t("core.save"), FontAwesome.FLOPPY_O);
            savePermissions.addClickListener(new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    for (CheckBox permissionCb : permissionCbsMap.keySet()) {
                        if (permissionCb.getValue()) {
                            acl.grant(subject, permissionCbsMap.get(permissionCb), sid);
                        } else {
                            acl.revoke(subject, permissionCbsMap.get(permissionCb), sid);
                        }
                    }
                    Notification.show(t("core.security.management.permision.update.success"));
                }
            });
            return savePermissions;
        }
    });
}