Java Code Examples for com.vaadin.ui.Button.ClickEvent

The following are top voted examples for showing how to use com.vaadin.ui.Button.ClickEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: osc-core   File: MainUI.java   Source Code and License 6 votes vote down vote up
private void buildSubmenu(CssLayout submenu, Set<OSCViewProvider<?>> views) {
    for (final OSCViewProvider<?> view : views) {
        String viewName = view.getName();
        NativeButton b = new NativeButton(viewName);
        // selecting default menu button
        if (view.getName().equals(VIEW_FRAGMENT_ALERTS)) {
            b.addStyleName("selected");
        }
        b.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                clearMenuSelection();
                event.getButton().addStyleName("selected");
                if (!MainUI.this.nav.getState().equals(viewName)) {
                    MainUI.this.nav.navigateTo(viewName);
                }
            }
        });
        submenu.setSizeFull();
        submenu.addComponent(b);
    }
}
 
Example 2
Project: osc-core   File: ManagerConnectorView.java   Source Code and License 6 votes vote down vote up
@Override
public void buttonClicked(ClickEvent event) throws Exception {
    if (event.getButton().getId().equals(ToolbarButtons.ADD.getId())) {
        log.debug("Redirecting to Add Manager Connector Window");
        ViewUtil.addWindow(new AddManagerConnectorWindow(this, this.addManagerConnectorService, this.pluginService, this.validator, this.trustManager, this.server));
    }
    if (event.getButton().getId().equals(ToolbarButtons.EDIT.getId())) {
        log.debug("Redirecting to Update Manager Connector Window");
        ViewUtil.addWindow(new UpdateManagerConnectorWindow(this, this.updateManagerConnectorService, this.pluginService, this.validator, this.trustManager, this.server));
    }
    if (event.getButton().getId().equals(ToolbarButtons.DELETE.getId())) {
        log.debug("Redirecting to Delete Manager Connector Window");
        ViewUtil.addWindow(new DeleteManagerConnectorWindow(this, this.deleteManagerConnectorService, this.server));
    }
    if (event.getButton().getId().equals(ToolbarButtons.CONFORM.getId())) {
        conformManagerConnector(getParentItemId());
    }
}
 
Example 3
Project: osc-core   File: SecurityGroupInterfaceSubView.java   Source Code and License 6 votes vote down vote up
@Override
public void buttonClicked(ClickEvent event) throws Exception {
    if (event.getButton().getId().equals(ToolbarButtons.ADD.getId())) {
        log.debug("Redirecting to Add Security Group interface Window");
        ViewUtil.addWindow(new AddSecurityGroupInterfaceWindow(getDtoInContext().getId(), this.addSecurityGroupInterfaceService, this.listVirtualSystemPolicyService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.EDIT.getId())) {
        log.debug("Redirecting to Update Security Group interface Window");
        ViewUtil.addWindow(new UpdateSecurityGroupInterfaceWindow(getSelectedItem().getBean(),
                this.listVirtualSystemPolicyService, this.updateSecurityGroupInterfaceService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.DELETE.getId())) {
        log.debug("Redirecting to Delete Security Group interface Window");
        DeleteWindowUtil.deleteSecurityGroupInterface(getSelectedItem().getBean(), this.deleteSecurityGroupInterfaceService);
    }
    if (event.getButton().getId().equals(ToolbarButtons.BACK.getId())) {
        // removing object from the sub view map so it can be garbage collected
        this.currentView.childSubViewMap.put(this.currentView.getKeyforChildSubView(2), null);
        this.currentView.viewSplitter.removeComponent(this.currentView.viewSplitter.getSecondComponent());
        this.currentView.viewSplitter.addComponent(this.currentView.childContainerLayout);
    }
}
 
Example 4
Project: osc-core   File: InternalCertReplacementUploader.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("serial")
private void setupOkClickedListener(final VmidcWindow<OkCancelButtonModel> alertWindow) {
    alertWindow.getComponentModel().setOkClickedListener(new Button.ClickListener(){
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                InternalCertReplacementUploader.this.x509TrustManager
                    .replaceInternalCertificate(InternalCertReplacementUploader.this.file, true);
            } catch (Exception e) {
                ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
            } finally {
                alertWindow.close();
                removeUploadedFile();
            }
        }});
}
 
Example 5
Project: osc-core   File: EmailLayout.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("serial")
private Button createEditButton() {
    // creating edit button
    this.edit = new Button("Edit");
    this.edit.setEnabled(true);
    this.edit.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.edit.addStyleName(StyleConstants.EDIT_BUTTON);
    this.edit.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing email settings", e);
            }
        }
    });
    return this.edit;
}
 
Example 6
Project: osc-core   File: NetworkLayout.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("serial")
private Button createIPSettingsEditButton() {
    // creating edit button
    this.editIPSettings = new Button("Edit");
    this.editIPSettings.setEnabled(true);
    this.editIPSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.editIPSettings.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editIPSettingsClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing IP settings", e);
            }
        }
    });
    return this.editIPSettings;
}
 
Example 7
Project: osc-core   File: NetworkLayout.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("serial")
private Button createNATEditButton() {
    // creating edit button
    this.editNATSettings = new Button("Edit");
    this.editNATSettings.setEnabled(true);
    this.editNATSettings.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    this.editNATSettings.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                editNATSettingsClicked();
            } catch (Exception e) {
                ViewUtil.showError("Error editing NAT settings", e);
            }
        }
    });
    return this.editNATSettings;
}
 
Example 8
Project: osc-core   File: AlarmView.java   Source Code and License 6 votes vote down vote up
@Override
public void buttonClicked(ClickEvent event) throws Exception {
    if (event.getButton().getId().equals(ToolbarButtons.ADD.getId())) {
        log.debug("Redirecting to Add Alarm Window");
        ViewUtil.addWindow(new AddAlarmWindow(this, this.addAlarmService,
                this.getEmailSettingsService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.EDIT.getId())) {
        log.debug("Redirecting to Update Alarm Window");
        ViewUtil.addWindow(new UpdateAlarmWindow(this, this.updateAlarmService,
                this.getEmailSettingsService));
    }
    if (event.getButton().getId().equals(ToolbarButtons.DELETE.getId())) {
        log.debug("Redirecting to Delete Alarm Window");
        DeleteWindowUtil.deleteAlarm(this.deleteAlarmService, getParentItem().getBean());
    }
}
 
Example 9
Project: osc-core   File: CRUDBaseSubView.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title) {
    HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid());
    Button refresh = new Button();
    refresh.setStyleName(Reindeer.BUTTON_LINK);
    refresh.setDescription("Refresh");
    refresh.setIcon(new ThemeResource("img/Refresh.png"));
    refresh.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            populateTable();
        }
    });
    header.addComponent(refresh);
    return header;
}
 
Example 10
Project: osc-core   File: AdvancedSettingsWindow.java   Source Code and License 6 votes vote down vote up
public AdvancedSettingsWindow(BaseVCWindow baseVCWindow) throws Exception {
    this.baseVCWindow = baseVCWindow;
    createWindow(ADVANCED_SETTINGS_CAPTION);
    getComponentModel().setOkClickedListener(new ClickListener() {
        /**
         *
         */
        private static final long serialVersionUID = -8326846388022657979L;

        @Override
        public void buttonClick(ClickEvent event) {
            submitForm();

        }
    });
}
 
Example 11
Project: osc-core   File: DeleteWindowUtil.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("serial")
public static void deleteVirtualSystem(final ForceDeleteVirtualSystemServiceApi forceDeleteVsService,
        final VirtualSystemDto dto, ServerApi server) {

    final VmidcWindow<OkCancelButtonModel> deleteWindow = WindowUtil
            .createAlertWindow("Force Delete Virtual System", "Force Delete Virtual System - " + dto.getName());

    deleteWindow.getComponentModel().setOkClickedListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                BaseJobResponse response = forceDeleteVsService.dispatch(new BaseDeleteRequest(dto.getId(), true));
                deleteWindow.close();
                if (response.getJobId() != null) {
                    ViewUtil.showJobNotification(response.getJobId(), server);
                }
            } catch (Exception e) {
                ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    });

    ViewUtil.addWindow(deleteWindow);
}
 
Example 12
Project: osc-core   File: DeleteWindowUtil.java   Source Code and License 6 votes vote down vote up
public static void deleteAlert(final DeleteAlertServiceApi deleteAlertService, final List<AlertDto> dtoList) {
    final VmidcWindow<OkCancelButtonModel> deleteWindow = WindowUtil.createAlertWindow("Delete Alert",
            "Delete selected alert(s)? ");

    deleteWindow.getComponentModel().setOkClickedListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            try {
                AlertRequest req = new AlertRequest();
                req.setDtoList(dtoList);
                deleteAlertService.dispatch(req);
                deleteWindow.close();
                log.info("Delete Alert(s) Successful!");
            } catch (Exception e) {
                log.error("Failed to delete Alert(s)", e);
                ViewUtil.iscNotification("Failed to delete Alert(s).", Notification.Type.WARNING_MESSAGE);
            }
        }
    });

    ViewUtil.addWindow(deleteWindow);
}
 
Example 13
Project: osc-core   File: UpdateDistributedApplianceWindow.java   Source Code and License 6 votes vote down vote up
private VmidcWindow<OkCancelButtonModel> getUpgradeAlertWindow() {
    String fromVersion = this.currentDAObject.getApplianceModel() + "-" + this.currentDAObject.getApplianceSoftwareVersionName();
    String toVersion = ((ApplianceModelSoftwareVersionDto) this.applianceDefinition.getValue()).getName();
    final VmidcWindow<OkCancelButtonModel> upgradeAlert = WindowUtil.createAlertWindow(
            VmidcMessages.getString(VmidcMessages_.DA_UPGRADE_WARNING_TITLE),
            VmidcMessages.getString(VmidcMessages_.DA_UPGRADE_WARNING, fromVersion, toVersion));
    upgradeAlert.getComponentModel().setOkClickedListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            upgradeAlert.close();
            submitRequest();
        }
    });
    return upgradeAlert;
}
 
Example 14
Project: vaadin-fluent-api   File: FButtonTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testButton() {
    FButton button = new FButton().withCaption("My button")
                                  .withIcon(VaadinIcons.ARROW_BACKWARD)
                                  .withIconAlternateText("backward")
                                  .withClickListener(click -> System.out.println("clicked"))
                                  .withClickShortcut(ShortcutAction.KeyCode.ENTER, null)
                                  .withBlurListener(blur -> System.out.println("lost focus"))
                                  .withFocusListener(focus -> System.out.println("gain focus"))
                                  .withTabIndex(5)
                                  .withDisableOnClick(true);

    assertEquals("My button", button.getCaption());
    assertEquals(VaadinIcons.ARROW_BACKWARD, button.getIcon());
    assertEquals("backward", button.getIconAlternateText());
    assertEquals(5, button.getTabIndex());
    assertEquals(1, button.getListeners(ClickEvent.class).size());
    assertEquals(1, button.getListeners(FocusEvent.class).size());
    assertEquals(1, button.getListeners(BlurEvent.class).size());
    assertTrue(button.getClickShortcut() != null);
    assertTrue(button.isDisableOnClick());

}
 
Example 15
Project: vaadin-fluent-api   File: FButtonTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testNativeButton() {
    FNativeButton button = new FNativeButton().withCaption("My button")
                                              .withIcon(VaadinIcons.ARROW_BACKWARD)
                                              .withIconAlternateText("backward")
                                              .withClickListener(click -> System.out.println("clicked"))
                                              .withClickShortcut(ShortcutAction.KeyCode.ENTER, null)
                                              .withBlurListener(blur -> System.out.println("lost focus"))
                                              .withFocusListener(focus -> System.out.println("gain focus"))
                                              .withTabIndex(5)
                                              .withDisableOnClick(true);

    assertEquals("My button", button.getCaption());
    assertEquals(VaadinIcons.ARROW_BACKWARD, button.getIcon());
    assertEquals("backward", button.getIconAlternateText());
    assertEquals(5, button.getTabIndex());
    assertEquals(1, button.getListeners(ClickEvent.class).size());
    assertEquals(1, button.getListeners(FocusEvent.class).size());
    assertEquals(1, button.getListeners(BlurEvent.class).size());
    assertTrue(button.isDisableOnClick());

}
 
Example 16
Project: imotSpot   File: DashboardView.java   Source Code and License 6 votes vote down vote up
private Component buildEditButton() {
    Button result = new Button();
    result.setId(EDIT_ID);
    result.setIcon(FontAwesome.EDIT);
    result.addStyleName("icon-edit");
    result.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    result.setDescription("Add Imot");
    result.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            getUI().addWindow(
                    new AddingImot(DashboardView.this, titleLabel
                            .getValue()));
        }
    });
    return result;
}
 
Example 17
Project: imotSpot   File: ReportsView.java   Source Code and License 6 votes vote down vote up
private Component buildCreateBox() {
    VerticalLayout createBox = new VerticalLayout();
    createBox.setWidth(160.0f, Unit.PIXELS);
    createBox.setHeight(200.0f, Unit.PIXELS);
    createBox.addStyleName("create");

    Button create = new Button("Create New");
    create.addStyleName(ValoTheme.BUTTON_PRIMARY);
    create.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            addReport(ReportType.EMPTY, null);
        }
    });

    createBox.addComponent(create);
    createBox.setComponentAlignment(create, Alignment.MIDDLE_CENTER);
    return createBox;
}
 
Example 18
Project: imotSpot   File: DashboardMenu.java   Source Code and License 6 votes vote down vote up
private Component buildToggleButton() {
    Button valoMenuToggleButton = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
                getCompositionRoot().removeStyleName(STYLE_VISIBLE);
            } else {
                getCompositionRoot().addStyleName(STYLE_VISIBLE);
            }
        }
    });
    valoMenuToggleButton.setIcon(FontAwesome.LIST);
    valoMenuToggleButton.addStyleName("valo-menu-toggle");
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_SMALL);
    return valoMenuToggleButton;
}
 
Example 19
Project: imotSpot   File: DashboardMenu.java   Source Code and License 6 votes vote down vote up
public ValoMenuItemButton(final DashboardViewType view) {
    this.view = view;
    setPrimaryStyleName("valo-menu-item");
    setIcon(view.getIcon());
    setCaption(view.getViewName().substring(0, 1).toUpperCase()
            + view.getViewName().substring(1));
    DashboardEventBus.register(this);
    addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            UI.getCurrent().getNavigator()
                    .navigateTo(view.getViewName());
        }
    });

}
 
Example 20
Project: imotSpot   File: MovieDetailsWindow.java   Source Code and License 6 votes vote down vote up
private Component buildFooter() {
    HorizontalLayout footer = new HorizontalLayout();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Unit.PERCENTAGE);

    Button ok = new Button("Close");
    ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
    ok.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            close();
        }
    });
    ok.focus();
    footer.addComponent(ok);
    footer.setComponentAlignment(ok, Alignment.TOP_RIGHT);
    return footer;
}
 
Example 21
Project: vaadin-vertx-samples   File: DashboardView.java   Source Code and License 6 votes vote down vote up
private Component buildEditButton() {
    Button result = new Button();
    result.setId(EDIT_ID);
    result.setIcon(FontAwesome.EDIT);
    result.addStyleName("icon-edit");
    result.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    result.setDescription("Edit Dashboard");
    result.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            getUI().addWindow(
                    new DashboardEdit(DashboardView.this, titleLabel
                            .getValue()));
        }
    });
    return result;
}
 
Example 22
Project: vaadin-vertx-samples   File: ReportsView.java   Source Code and License 6 votes vote down vote up
private Component buildCreateBox() {
    VerticalLayout createBox = new VerticalLayout();
    createBox.setWidth(160.0f, Unit.PIXELS);
    createBox.setHeight(200.0f, Unit.PIXELS);
    createBox.addStyleName("create");

    Button create = new Button("Create New");
    create.addStyleName(ValoTheme.BUTTON_PRIMARY);
    create.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            addReport(ReportType.EMPTY, null);
        }
    });

    createBox.addComponent(create);
    createBox.setComponentAlignment(create, Alignment.MIDDLE_CENTER);
    return createBox;
}
 
Example 23
Project: vaadin-vertx-samples   File: DashboardMenu.java   Source Code and License 6 votes vote down vote up
private Component buildToggleButton() {
    Button valoMenuToggleButton = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (getCompositionRoot().getStyleName().contains(STYLE_VISIBLE)) {
                getCompositionRoot().removeStyleName(STYLE_VISIBLE);
            } else {
                getCompositionRoot().addStyleName(STYLE_VISIBLE);
            }
        }
    });
    valoMenuToggleButton.setIcon(FontAwesome.LIST);
    valoMenuToggleButton.addStyleName("valo-menu-toggle");
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_SMALL);
    return valoMenuToggleButton;
}
 
Example 24
Project: vaadin-vertx-samples   File: DashboardMenu.java   Source Code and License 6 votes vote down vote up
public ValoMenuItemButton(final DashboardViewType view) {
    this.view = view;
    setPrimaryStyleName("valo-menu-item");
    setIcon(view.getIcon());
    setCaption(view.getViewName().substring(0, 1).toUpperCase()
            + view.getViewName().substring(1));
    DashboardEventBus.register(this);
    addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            UI.getCurrent().getNavigator()
                    .navigateTo(view.getViewName());
        }
    });

}
 
Example 25
Project: vaadin-vertx-samples   File: MovieDetailsWindow.java   Source Code and License 6 votes vote down vote up
private Component buildFooter() {
    HorizontalLayout footer = new HorizontalLayout();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Unit.PERCENTAGE);

    Button ok = new Button("Close");
    ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
    ok.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            close();
        }
    });
    ok.focus();
    footer.addComponent(ok);
    footer.setComponentAlignment(ok, Alignment.TOP_RIGHT);
    return footer;
}
 
Example 26
Project: businesshorizon2   File: NavigationViewImpl.java   Source Code and License 6 votes vote down vote up
private void addOverviewButton() {
	Button overviewButton = new Button("Projektübersicht");
	overviewButton.addStyleName("default");
	overviewButton.addListener(new Button.ClickListener() {

		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			presenter.showProjectList();
			
			
		}
	});
	
	this.topbarinnerlayout.addComponent(overviewButton);
	this.topbarinnerlayout.setComponentAlignment(overviewButton, Alignment.MIDDLE_CENTER);
}
 
Example 27
Project: businesshorizon2   File: NavigationViewImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Diese Methode fuegt der Navigation einen Navigationsbutton hinzu und registriert
 * einen passenden ClickListener auf ihn.
 * 
 * @param value Der Prozessschritt, der durch den Navigationsbutton repraesentiert werden soll.
 * @author Julius Hacker
 */
@Override
public void addNavigationButton(final NavigationSteps navigationStep) {
	//this.innerlayout.addComponent(arrow);
	Button navigationButton = new Button(navigationStep.getCaption());
	this.navigationButtons.put(navigationStep, navigationButton);
	
	navigationButton.addListener(new Button.ClickListener() {
		private static final long serialVersionUID = 7411091035775152765L;

		@Override
		public void buttonClick(ClickEvent event) {
			presenter.showStep(navigationStep);
		}
	});
	
	navigationButton.setEnabled(false);
	navigationButton.setWidth(Sizeable.SIZE_UNDEFINED, 5);
	this.innerlayout.addComponent(navigationButton);
	this.innerlayout.setComponentAlignment(navigationButton, Alignment.BOTTOM_CENTER);
	
}
 
Example 28
Project: businesshorizon2   File: NavigationViewImpl.java   Source Code and License 6 votes vote down vote up
private void addLogoutButton(String text) {
	Button logoutButton = new Button(text);
	logoutButton.addStyleName("default");
	logoutButton.setVisible(true);
	logoutButton.addListener(new Button.ClickListener() {
		private static final long serialVersionUID = 7411091035775152765L;
		
		@Override
		public void buttonClick(ClickEvent event) {
			//Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf
			presenter.doLogout();
		}
	});
	
	logoutButton.setEnabled(true);
	this.layout.addComponent(logoutButton);
	this.layout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT);

	
}
 
Example 29
Project: businesshorizon2   File: TimelineViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void addBasePeriod(Period period) {

        layout.removeComponent(pB);
        pB = new PeriodButton("Basisjahr: " + period.getYear(),
                        new Button.ClickListener() {

                                @Override
                                public void buttonClick(ClickEvent event) {
                                        // TODO Auto-generated method stub
                                        presenter.periodClicked(((PeriodButton) event
                                                        .getButton()).getPeriod());

                                }
                        });
        pB.setPeriod(period);

        layout.addComponent(pB);

}
 
Example 30
Project: businesshorizon2   File: TimelineViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void addFuturePeriod(Period period) {
        PeriodButton pB = new PeriodButton("" + period.getYear(),
                        new Button.ClickListener() {

                                @Override
                                public void buttonClick(ClickEvent event) {
                                        // TODO Auto-generated method stub
                                        presenter.periodClicked(((PeriodButton) event
                                                        .getButton()).getPeriod());

                                }
                        });
        pB.setPeriod(period);
        layout.setRows(layout.getRows() + 1);
        layout.addComponent(pB, 0, layout.getRows() - 1);
        layout.removeComponent(delFuture);
        layout.addComponent(delFuture, 1, layout.getRows() - 1);

}
 
Example 31
Project: businesshorizon2   File: TimelineViewImpl.java   Source Code and License 6 votes vote down vote up
@Override
public void addPastPeriod(Period period) {
	logger.debug("Button past angelegt");
	// TODO Auto-generated method stub
	PeriodButton pB = new PeriodButton("" + period.getYear(),
			new Button.ClickListener() {

                                       @Override
                                       public void buttonClick(ClickEvent event) {
                                               // TODO Auto-generated method stub
                                               presenter.periodClicked(((PeriodButton) event
                                                               .getButton()).getPeriod());

                                       }
                               });
               pB.setPeriod(period);
               layout.insertRow(0);
               layout.addComponent(pB, 0, 0);
               layout.removeComponent(delPast);
               layout.addComponent(delPast, 1, 0);

       }
 
Example 32
Project: businesshorizon2   File: ProjectListViewImpl.java   Source Code and License 6 votes vote down vote up
/**
 * ClickListner Methode fuer die Reaktion auf Buttonclicks. Hier wird
 * entsprechend auf die Button-Clicks fuer das Erzeugen weiterer Projekte
 * reagiert, wie auch auf jene die Projekte loeschen. In der ersten
 * If-Abfrage werden die vom Hauptfenster ausgeloeten Clicks zum Hinzufuegen
 * eines neuen Objektes behandelt, in der zweiten If-Abfrage wird die im
 * Dialogfenster ausgeloesten Clickst behandelt (Hierbei wird noch geprueft
 * ob das auf "required" gesetzte Textfeld auch ausgefuellt wurde - falls
 * nicht wird eine Fehlermeldung angezeigt) und in der Else-Verzweigung dann
 * die Loesch-Clicks fuer das jeweilige Projekt behandelt. Hierbei wird
 * zunächst durch das Event in der Loesch-Buttonliste der Index
 * identifiziert, also welches Projekt zu loeschen ist. Die jeweils folgende
 * Logid ist in der je aufgerufen Methode des Presenters zu finden.
 * 
 * @author Christian Scherer, Mirko Göpfrich
 * @param event
 *            Klick-event des Buttons
 */
@Override
public void buttonClick(ClickEvent event) {
	
	if (event.getButton() == addProjectBtn) {
		logger.debug("Projekt-hinzufügen Button aus dem Hauptfenster aufgerufen");
		presenter.addProjectDialog();

	} else if (event.getButton() == dialogAddBtn) {
		logger.debug("Projekt-hinzufügen Button aus dem Dialogfenster aufgerufen");

		if (tfName.isValid()) {
			presenter.addProject((String) tfName.getValue(), (String) taDescription.getValue());
			//TODO: Fenster nur schließen, wenn das Hinzufügen erfolgreich war (s. Projekt Bearbeiten).
			getWindow().removeWindow(addDialog);
			logger.debug("Projekt-hinzufügen Dialog geschlossen");
		} else {
			getWindow()
					.showNotification(
							"",
							"Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an",
							Notification.TYPE_ERROR_MESSAGE);
		}	
	}
}
 
Example 33
Project: businesshorizon2   File: ParameterScreenViewImpl.java   Source Code and License 6 votes vote down vote up
/**
*
*/
private void addLogoutButton() {
Button logoutButton = new Button("Logout");
logoutButton.setStyleName("default");
logoutButton.addListener(new Button.ClickListener() {

private static final long serialVersionUID = 7411091035775152765L;

@Override
public void buttonClick(ClickEvent event) {
//Callback-Methode, ruft die eigentliche Logout-Methode im Presenter auf
presenter.doLogout();
}
});

//LogoutButton hinzufügen und ausrichten
logoutButton.setEnabled(true);
right.addComponent(logoutButton);
right.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT);

}
 
Example 34
Project: metasfresh-procurement-webui   File: WeeklyDetailedReportingView.java   Source Code and License 6 votes vote down vote up
private final Button createTrendButton(final Trend trend)
{
	final Button button = new Button();
	button.setStyleName("no-decoration");
	Trend.applyStyleName(button, trend);
	button.setIcon(trend.getIcon());
	button.addClickListener(new ClickListener()
	{
		@Override
		public void buttonClick(final ClickEvent event)
		{
			onNextWeekTrendButtonPressed(trend);
		}
	});

	trend2button.put(trend, button);
	return button;
}
 
Example 35
Project: SecureBPMN   File: NewUserPopupWindow.java   Source Code and License 6 votes vote down vote up
protected void initCreateButton() {
  HorizontalLayout buttonLayout = new HorizontalLayout();
  buttonLayout.setWidth(100, UNITS_PERCENTAGE);
  form.getFooter().setWidth(100, UNITS_PERCENTAGE);
  form.getFooter().addComponent(buttonLayout);
  
  Button createButton = new Button(i18nManager.getMessage(Messages.USER_CREATE));
  buttonLayout.addComponent(createButton);
  buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);
  
  createButton.addListener(new ClickListener() {
    public void buttonClick(ClickEvent event) {
      handleFormSubmit();
    }
  });
}
 
Example 36
Project: SecureBPMN   File: AlfrescoProcessInstanceTableItem.java   Source Code and License 6 votes vote down vote up
public AlfrescoProcessInstanceTableItem(final ProcessInstance processInstance) {
  addItemProperty(PROPERTY_ID, new ObjectProperty<String>(processInstance.getId(), String.class));
  
  if (processInstance.getBusinessKey() != null) {
    addItemProperty(PROPERTY_BUSINESSKEY, new ObjectProperty<String>(processInstance.getBusinessKey(), String.class));
  }

  Button viewProcessInstanceButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.PROCESS_ACTION_VIEW));
  viewProcessInstanceButton.addStyleName(Reindeer.BUTTON_LINK);
  viewProcessInstanceButton.addListener(new ClickListener() {
    private static final long serialVersionUID = 1L;
    public void buttonClick(ClickEvent event) {
      ExplorerApp.get().getViewManager().showProcessInstancePage(processInstance.getId());
    }
  });
  
  viewProcessInstanceButton.setIcon(Images.MAGNIFIER_16);
  addItemProperty(PROPERTY_ACTIONS, new ObjectProperty<Component>(viewProcessInstanceButton, Component.class));
}
 
Example 37
Project: incubator-openaz   File: ObadviceEditorWindow.java   Source Code and License 6 votes vote down vote up
private void initializeButtons() {
	this.saveButton.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				fieldGroup.commit();
				self.isSaved = true;
				self.close();
			} catch (CommitException e) {
				e.printStackTrace();
			}
		}
		
	});
}
 
Example 38
Project: SecureBPMN   File: SelectUsersPopupWindow.java   Source Code and License 6 votes vote down vote up
protected void initDoneButton() {
  doneButton = new Button("Done");
  
  doneButton.addListener(new ClickListener() {
    public void buttonClick(ClickEvent event) {
      // Fire event such that depending UI's can be updated
      fireEvent(new SubmitEvent(doneButton, SubmitEvent.SUBMITTED));
      
      // close popup window
      close();
    }
  });
  
  addComponent(doneButton);
  windowLayout.setComponentAlignment(doneButton, Alignment.MIDDLE_RIGHT);
}
 
Example 39
Project: cia   File: LogoutClickListener.java   Source Code and License 6 votes vote down vote up
@Override
public void buttonClick(final ClickEvent event) {
	final ServiceResponse response = ApplicationMangerAccess.getApplicationManager().service(logoutRequest);


	if (ServiceResult.SUCCESS == response.getResult()) {
		UI.getCurrent().getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME);
		UI.getCurrent().getSession().close();
		VaadinService.getCurrentRequest().getWrappedSession().invalidate();
	} else {
		Notification.show(LOGOUT_FAILED,
                  ERROR_MESSAGE,
                  Notification.Type.WARNING_MESSAGE);
		LOGGER.info(LOG_MSG_LOGOUT_FAILURE,logoutRequest.getSessionId());
	}
}
 
Example 40
Project: SecureBPMN   File: StartProcessInstanceClickListener.java   Source Code and License 6 votes vote down vote up
public void buttonClick(ClickEvent event) {
  // Check if process-definition defines a start-form
  
  StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
  if(startFormData != null && ((startFormData.getFormProperties() != null && startFormData.getFormProperties().size() > 0) || startFormData.getFormKey() != null)) {
    parentPage.showStartForm(processDefinition, startFormData);
  } else {
    // Just start the process-instance since it has no form.
    // TODO: Error handling
    ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
    
    // Show notification of success
    notificationManager.showInformationNotification(Messages.PROCESS_STARTED_NOTIFICATION, getProcessDisplayName(processDefinition));
    
    // Switch to inbox page in case a task of this process was created
    List<Task> loggedInUsersTasks = taskService.createTaskQuery()
      .taskAssignee(ExplorerApp.get().getLoggedInUser().getId())
      .processInstanceId(processInstance.getId())
      .list();
    if (loggedInUsersTasks.size() > 0) {
      ExplorerApp.get().getViewManager().showInboxPage(loggedInUsersTasks.get(0).getId());
    }
  }
}