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

The following are top voted examples for showing how to use com.vaadin.ui.Button.ClickListener. 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: 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 3
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 4
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 5
Project: osc-core   File: ViewUtil.java   Source Code and License 6 votes vote down vote up
/**
 * @param toolbar
 *            HorizontalLayout which contains all the action Buttons
 * @param toolbarButton
 *            Which Tool bar button to create (Provided using ENUM constant)
 * @param listner
 *            Click listener called when this button is clicked
 * @return
 */

public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
        ClickListener listner) {
    Button button = new Button(toolbarButton.getText());
    button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
    button.setDescription(toolbarButton.getTooltip());
    button.setStyleName(ValoTheme.BUTTON_LINK);
    if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
        button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
    }
    button.setEnabled(false);
    button.setId(toolbarButton.getId());
    button.addClickListener(listner);
    toolbar.addComponent(button);
    return button;
}
 
Example 6
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 7
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 8
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 9
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 10
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 11
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 12
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 13
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 14
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 15
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 16
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 17
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 18
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 19
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 20
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 21
Project: businesshorizon2   File: InitialScreenViewImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Diese Methode fügt einen Button zur Button-Leiste (topRightLayout) an der gewünschten Stelle hinzu
 * und löscht den Button der vorher an dieser Stelle war.
 *
 * @param button
 * : Der Button
 * @param index
 * : Stelle, wo der Button gesetzt werden soll
 * @param listener
 * : Der ClickListener
 * @author Marco Glaser
 */
public void setTopButton(TopBarButton button, int index, ClickListener listener){
	if(listener != null){
		button.getButtonComponent().addListener(listener);
	}
	int maxIndex = topRightLayout.getComponentCount() - 1; //1 abziehen wegen dem Spacing rechts
	if(index < maxIndex){
		Component comp = topRightLayout.getComponent(index);
		if(comp != null){
			topRightLayout.replaceComponent(comp, button);
		}
		
	}
	else{
		topRightLayout.addComponent(button, index);;
	}
	topRightLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
}
 
Example 22
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 23
Project: minimal-j   File: Vaadin.java   Source Code and License 6 votes vote down vote up
public VaadinDecoration(String title, Component content, boolean showMinimize, ClickListener closeListener) {
	setMargin(false);
	setSpacing(false);
	
	HorizontalLayout titleBar = new HorizontalLayout();
	titleBar.setMargin(false);
	titleBar.setWidth("100%");
	Label label = new Label(title);
	titleBar.addComponent(label);
	titleBar.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
	titleBar.setExpandRatio(label, 1.0f);
	
	Button closeButton = new Button(VaadinIcons.CLOSE);
	closeButton.addStyleName("mjButton");
	closeButton.addClickListener(closeListener);
	titleBar.addComponent(closeButton);
	titleBar.setComponentAlignment(closeButton, Alignment.MIDDLE_RIGHT);

	addComponent(titleBar);
	addComponent(content);
	setExpandRatio(content, 1.0f);
}
 
Example 24
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 25
Project: incubator-openaz   File: ColumnSelectionWindow.java   Source Code and License 6 votes vote down vote up
protected void initializeButton() {
	self.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit
				//
				self.textFieldColumn.commit();
				//
				// If we get here, the value is valid.
				// Mark ourselves as saved and close the window
				//
				self.isSaved = true;
				self.close();
			} catch (SourceException | InvalidValueException e) { //NOPMD
				//
				// Vaadin will display error
				//
			}
		}
	});
}
 
Example 26
Project: incubator-openaz   File: SQLPIPConfigurationComponent.java   Source Code and License 6 votes vote down vote up
protected void initializeButtons() {
	this.buttonTest.setImmediate(true);
	this.buttonTest.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			Object id = self.comboBoxConnectionType.getValue();
			if (id == null) {
				logger.warn("No combo box selection");
				return;
			}				
			if (id.toString().equals(SQL_TYPE_JDBC)) {
				self.testJDBCConnection();
			} else if (id.toString().equals(SQL_TYPE_JNDI)) {
				self.testJNDIConnection();
			}
		}			
	});
}
 
Example 27
Project: VaadHL   File: BaseWindow.java   Source Code and License 6 votes vote down vote up
/**
 * Displays the window content in case the window cannot be open due to
 * permissions.
 * 
 * @param msg
 *            the message to display.
 */
protected void setNotPermitedContent(String msg) {

	Button btClose = null;
	btClose = new Button(getI18S("btClose"));
	btClose.addClickListener(new ClickListener() {

		private static final long serialVersionUID = -1610492227149824003L;

		@Override
		public void buttonClick(ClickEvent event) {
			BaseWindow.super.close();
		}
	});
	VerticalLayout p = new VerticalLayout();
	p.addComponent(new Label(msg));
	p.addComponent(btClose);
	p.setMargin(true);
	setContent(p);
}
 
Example 28
Project: VaadHL   File: Action.java   Source Code and License 6 votes vote down vote up
/**
 * Detach the action run listener from the object.
 * 
 * @param o
 */
protected void detachLsnr(Object o) {
	if (o == null)
		return;
	ObjInfo objInfo = attached.get(o);
	if (objInfo == null)
		return;

	if (o instanceof Button) {
		Button.ClickListener al = (ClickListener) objInfo.listener;
		if (al != null)
			((Button) o).removeClickListener(al);
	} else if (o instanceof MenuItem) {
		((MenuItem) o).setCommand(null);
	} else if (o instanceof ContextMenuItem) {
		((ContextMenuItem) o)
				.removeItemClickListener((ContextMenuItemClickListener) objInfo.listener);
	}
}
 
Example 29
Project: SecureBPMN   File: TaskDetailPanel.java   Source Code and License 6 votes vote down vote up
protected void initParentTaskLink() {
  if (task.getParentTaskId() != null) {
    final Task parentTask = taskService.createTaskQuery()
      .taskId(task.getParentTaskId()).singleResult();
    
    Button showParentTaskButton = new Button(i18nManager.getMessage(
            Messages.TASK_SUBTASK_OF_PARENT_TASK, parentTask.getName()));
    showParentTaskButton.addStyleName(Reindeer.BUTTON_LINK);
    showParentTaskButton.addListener(new ClickListener() {
      public void buttonClick(ClickEvent event) {
        viewManager.showTaskPage(parentTask.getId());
      }
    });
    
    centralLayout.addComponent(showParentTaskButton);
    addEmptySpace(centralLayout);
  }
}
 
Example 30
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 31
Project: SecureBPMN   File: AccountSelectionPopup.java   Source Code and License 6 votes vote down vote up
protected void initAlfrescoComponent() {
  alfrescoForm = new Form();
  alfrescoForm.setDescription(i18nManager.getMessage(Messages.ALFRESCO_DESCRIPTION));
  
  final TextField alfrescoServer = new TextField(i18nManager.getMessage(Messages.ALFRESCO_SERVER));
  alfrescoForm.getLayout().addComponent(alfrescoServer);
  
  final TextField alfrescoUserName = new TextField(i18nManager.getMessage(Messages.ALFRESCO_USERNAME));
  alfrescoForm.getLayout().addComponent(alfrescoUserName);
  
  final PasswordField alfrescoPassword = new PasswordField(i18nManager.getMessage(Messages.ALFRESCO_PASSWORD));
  alfrescoForm.getLayout().addComponent(alfrescoPassword);
  
  // Matching listener
  alfrescoClickListener = new ClickListener() {
    public void buttonClick(ClickEvent event) {
      Map<String, Object> accountDetails = createAccountDetails(
              "alfresco", 
              alfrescoUserName.getValue().toString(), 
              alfrescoPassword.getValue().toString(),
              "server", alfrescoServer.getValue().toString()
              ); 
      fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
    }
  };
}
 
Example 32
Project: SecureBPMN   File: ChangePasswordPopupWindow.java   Source Code and License 6 votes vote down vote up
protected void initChangePasswordButton() {
  errorLabel = new Label("&nbsp", Label.CONTENT_XHTML);
  errorLabel.addStyleName(Reindeer.LABEL_SMALL);
  errorLabel.addStyleName(ExplorerLayout.STYLE_LABEL_RED);
  layout.addComponent(errorLabel);
  
  Button changePasswordButton = new Button(i18nManager.getMessage(Messages.PASSWORD_CHANGE));
  layout.addComponent(changePasswordButton);
  layout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_CENTER);
  
  changePasswordButton.addListener(new ClickListener() {
    public void buttonClick(ClickEvent event) {
      handlePasswordChange();
    }
  });
}
 
Example 33
Project: SecureBPMN   File: UserProfileLink.java   Source Code and License 6 votes vote down vote up
protected void initPicture(IdentityService identityService, boolean renderPicture, final String userName) {
  if(renderPicture) {
    Picture picture = identityService.getUserPicture(userName);
    if(picture != null) {
      Resource imageResource = new StreamResource(new InputStreamStreamSource(picture.getInputStream()), 
        userName + picture.getMimeType(), ExplorerApp.get());
      
      Embedded image = new Embedded(null, imageResource);
      image.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
      image.setType(Embedded.TYPE_IMAGE);
      image.setHeight(30, Embedded.UNITS_PIXELS);
      image.setWidth(30, Embedded.UNITS_PIXELS);
      image.addListener(new MouseEvents.ClickListener() {
        private static final long serialVersionUID = 7341560240277898495L;
        public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
          viewManager.showProfilePopup(userName);
        }
      });
      
      addComponent(image);
      setComponentAlignment(image, Alignment.MIDDLE_LEFT);
    } else {
     // TODO: what when no image is available?
    }
  }
}
 
Example 34
Project: SecureBPMN   File: SelectUsersPopupWindow.java   Source Code and License 6 votes vote down vote up
protected void initSelectUserButton() {
  selectUserButton = new Button(">");
  
  selectUserButton.addListener(new ClickListener() {
    public void buttonClick(ClickEvent event) {
      for (String selectedItemId : (Set<String>) matchingUsersTable.getValue()) {
        // Remove from left table
        Item originalItem = matchingUsersTable.getItem(selectedItemId);
        
        // And put it in right table
        selectUser(selectedItemId, (String) originalItem.getItemProperty("userName").getValue());
        
        // Remove from left table (must be done on the end, or item properties will be inaccessible) 
        matchingUsersTable.removeItem(selectedItemId);
      }
    }
  });
  
  userSelectionLayout.addComponent(selectUserButton);
  userSelectionLayout.setComponentAlignment(selectUserButton, Alignment.MIDDLE_CENTER);
}
 
Example 35
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 36
Project: SecureBPMN   File: UrlAttachmentRenderer.java   Source Code and License 6 votes vote down vote up
public Component getOverviewComponent(final Attachment attachment, final RelatedContentComponent parent) {
  
  // If the attachment has no description, overview link is link to actual page
  // instead of showing popup with details.
  if(attachment.getDescription() != null && !"".equals(attachment.getDescription())) {
    Button attachmentLink = new Button(attachment.getName());
    attachmentLink.addStyleName(Reindeer.BUTTON_LINK);
    
    attachmentLink.addListener(new ClickListener() {
      private static final long serialVersionUID = 1L;
      
      public void buttonClick(ClickEvent event) {
        parent.showAttachmentDetail(attachment);
      }
    });
    return attachmentLink;
  } else {
    return new Link(attachment.getName(), new ExternalResource(attachment.getUrl()));
  }
}
 
Example 37
Project: SecureBPMN   File: JobDetailPanel.java   Source Code and License 6 votes vote down vote up
protected void addActions() {
  Button executeButton = new Button(i18nManager.getMessage(Messages.JOB_EXECUTE));
  executeButton.setIcon(Images.EXECUTE);
  executeButton.addListener(new ClickListener() {
    private static final long serialVersionUID = 1L;
    public void buttonClick(ClickEvent event) {
      try {
        managementService.executeJob(job.getId());
        jobPage.refreshSelectNext();
      } catch (ActivitiException ae) {
        String errorMessage = ae.getMessage() + (ae.getCause() != null ? " (" + ae.getCause().getClass().getName() + ")" : "");
        notificationManager.showErrorNotification(Messages.JOB_ERROR, errorMessage);

        // Refresh the current job
        jobPage.refreshCurrentJobDetails();
      }
    }
  });

  jobPage.getToolBar().removeAllButtons();
  jobPage.getToolBar().addButton(executeButton);
}
 
Example 38
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 39
Project: SecureBPMN   File: GroupsForUserQuery.java   Source Code and License 6 votes vote down vote up
public GroupItem(final Group group) {
  Button idButton = new Button(group.getId());
  idButton.addStyleName(Reindeer.BUTTON_LINK);
  idButton.addListener(new ClickListener() {
    public void buttonClick(ClickEvent event) {
      ExplorerApp.get().getViewManager().showGroupPage(group.getId());
    }
  });
  addItemProperty("id", new ObjectProperty<Button>(idButton, Button.class));
  
  if (group.getName() != null) {
    addItemProperty("name", new ObjectProperty<String>(group.getName(), String.class));
  }
  if (group.getType() != null) {
    addItemProperty("type", new ObjectProperty<String>(group.getType(), String.class));
  }
  
  Embedded deleteIcon = new Embedded(null, Images.DELETE);
  deleteIcon.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
  deleteIcon.addListener(new DeleteMembershipListener(identityService, userId, group.getId(), userDetailPanel));
  addItemProperty("actions", new ObjectProperty<Embedded>(deleteIcon, Embedded.class));
}
 
Example 40
Project: SecureBPMN   File: NewGroupPopupWindow.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.GROUP_CREATE));
  buttonLayout.addComponent(createButton);
  buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);
  
  createButton.addListener(new ClickListener() {
    public void buttonClick(ClickEvent event) {
    handleFormSubmit();
    }
  });
}