List of usage examples for com.google.gwt.user.client.ui Label addClickHandler
public HandlerRegistration addClickHandler(ClickHandler handler)
From source file:org.bonitasoft.console.client.view.identity.UserMetadataListWidget.java
License:Open Source License
@Override protected FlowPanel buildTopNavBar() { final FlowPanel theFirstCell = new FlowPanel(); final CustomMenuBar theTopMenu = new CustomMenuBar(); theTopMenu.addItem(constants.add(), new Command() { public void execute() { addItem();//from w w w. java 2 s .c o m } }); theTopMenu.addItem(constants.delete(), new Command() { public void execute() { // add a ConfirmationDialogbox when you delete user Metadata. if (myItemSelection.getSize() > 0) { confirmationDialogbox = new ConfirmationDialogbox(constants.deleteUserMetadataDialogbox(), patterns.deleteUserMetadataWarn(myItemSelection.getSelectedItems().size()), constants.okButton(), constants.cancelButton()); confirmationDialogbox.addCloseHandler(new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> event) { if (confirmationDialogbox.getConfirmation()) { deleteSelectedItems(); } } }); } else { if (myMessageDataSource != null) { myMessageDataSource.addWarningMessage(messages.noUserMetadataSelectedWarn()); } } } }); Label theRefreshLink = new Label(constants.refresh()); theRefreshLink.setStylePrimaryName(CSSClassManager.LINK_LABEL); theRefreshLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent aEvent) { myBonitaDataSource.reload(); } }); // Create the Selector Widget theFirstCell.add(new SimpleSelectorWidget<BonitaUUID, UserMetadataItem, SimpleFilter>(myBonitaDataSource)); theFirstCell.add(theTopMenu); theFirstCell.add(theRefreshLink); return theFirstCell; }
From source file:org.bonitasoft.console.client.view.identity.UsersListWidget.java
License:Open Source License
@Override protected FlowPanel buildTopNavBar() { final FlowPanel theFirstCell = new FlowPanel(); final CustomMenuBar theTopMenu = new CustomMenuBar(); theTopMenu.addItem(constants.add(), new Command() { public void execute() { addUser();//w w w.j a v a 2s. com } }); myVisibleItems = myBonitaDataSource.getVisibleItems(); theTopMenu.addItem(constants.delete(), new Command() { public void execute() { //you can not delete your own account. final List<UserUUID> selectList = myItemSelection.getSelectedItems(); Boolean hasUser = false; for (UserUUID theBonitaUUID : selectList) { final User theItem = ((UserDataSource) myBonitaDataSource).getItem(theBonitaUUID); final String selectedName = theItem.getUsername(); final String userName = new UserUUID(BonitaConsole.userProfile.getUsername()).getValue(); if (selectedName.equals(userName)) { hasUser = true; myMessageDataSource.addWarningMessage(messages.deleteYourAccountWarn()); break; } } //add a ConfirmationDialogbox when you delete a user. if (!hasUser) { if (myItemSelection.getSize() > 0) { confirmationDialogbox = new ConfirmationDialogbox(constants.deleteUsers(), patterns.deleteUsersWarn(selectList.size()), constants.okButton(), constants.cancelButton()); confirmationDialogbox.addCloseHandler(new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> event) { if (confirmationDialogbox.getConfirmation()) { deleteSelectedUsers(); } } }); } else { if (myMessageDataSource != null) { myMessageDataSource.addWarningMessage(messages.noUserSelected()); } } } } }); Label theRefreshLink = new Label(constants.refresh()); theRefreshLink.setStylePrimaryName(CSSClassManager.LINK_LABEL); theRefreshLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent aEvent) { myBonitaDataSource.reload(); } }); // Create the Selector Widget theFirstCell.add(new SimpleSelectorWidget<UserUUID, User, UserFilter>(myBonitaDataSource)); theFirstCell.add(theTopMenu); theFirstCell.add(theRefreshLink); return theFirstCell; }
From source file:org.bonitasoft.console.client.view.labels.LabelAssociationWidget.java
License:Open Source License
/** * Update the UI.//w ww . j a va 2 s . co m */ private void update() { // first of all clean the panel myLabelSelection.clear(); final List<LabelModel> theLabels = myLabelDataSource.getAllLabels(); // CheckBox theCheckBox; Image theSelectorImage; LabelModel theLabelModel; Image theLabelIcon; Label theLabel; MouseHandler theMouseHandler; LabelClickHandler theClickHandler; int theNbSelectedCaseHavingCurrentLabel; int theNbCaseSelected = myCaseSelection.getSelectedItems().size(); int row = 0; // Create an entry for each label. for (int i = 0; i < theLabels.size(); i++) { theLabelModel = theLabels.get(i); if (theLabelModel.isAssignableByUser()) { // The state of the checkbox depends on the number of // occurrences. // If the label is associated to all cases it must be // selected. // If the label is not associated to any case it must NOT be // selected. // If it is associated at least one but not all cases, it must // be // "partially" selected. theSelectorImage = new Image(PICTURE_PLACE_HOLDER); theNbSelectedCaseHavingCurrentLabel = countSelectedCases(theLabelModel.getUUID()); // myCaseSelection.getSelectedCaseCount(theLabelModel); if (theNbSelectedCaseHavingCurrentLabel == 0 || theNbCaseSelected == 0) { // Empty checkbox theSelectorImage.setStylePrimaryName(EMPTY_TRISTATECHECKBOX); theClickHandler = new LabelClickHandler(theLabelModel.getUUID(), TriState.EMPTY, theSelectorImage); theSelectorImage.addClickHandler(theClickHandler); } else { if (theNbSelectedCaseHavingCurrentLabel == theNbCaseSelected) { // Checkbox fully checked theSelectorImage.setStylePrimaryName(CHECKED_TRISTATECHECKBOX); theClickHandler = new LabelClickHandler(theLabelModel.getUUID(), TriState.FULL, theSelectorImage); theSelectorImage.addClickHandler(theClickHandler); } else { // Checkbox partially checked theSelectorImage.setStylePrimaryName(PARTIALLY_CHECKED_TRISTATECHECKBOX); theClickHandler = new LabelClickHandler(theLabelModel.getUUID(), TriState.PARTIAL, theSelectorImage); theSelectorImage.addClickHandler(theClickHandler); } } theLabel = new Label(LocaleUtil.translate(theLabelModel.getUUID())); theMouseHandler = new MouseHandler(row); theLabel.addMouseOverHandler(theMouseHandler); theLabel.addMouseOutHandler(theMouseHandler); // Bind the same click handler as the checkbox, to allow the // user to click on the label or the check box to achieve the // same result. theLabel.addClickHandler(theClickHandler); theLabelIcon = new Image(PICTURE_PLACE_HOLDER); if (theLabelModel.getIconCSSStyle() != null && theLabelModel.getIconCSSStyle().trim().length() > 0) { theLabelIcon.setStylePrimaryName(theLabelModel.getIconCSSStyle()); } else { theLabelIcon.setWidth("60%"); } theLabelIcon.addMouseOverHandler(theMouseHandler); theLabelIcon.addMouseOutHandler(theMouseHandler); // Bind the same click handler as the checkbox, to allow the // user to click on the label or the check box to achieve the // same result. theLabelIcon.addClickHandler(theClickHandler); myLabelSelection.setWidget(row, 0, theSelectorImage); myLabelSelection.setWidget(row, 1, theLabel); myLabelSelection.setWidget(row, 2, theLabelIcon); myLabelSelection.getRowFormatter().setStyleName(row, CSSClassManager.POPUP_MENU_ENTRY); myLabelSelection.getFlexCellFormatter().setColSpan(row, 0, 1); row++; } } if (row > 0) { myLabelSelection.getRowFormatter().setStyleName(row, "menu_separator"); myLabelSelection.getFlexCellFormatter().setColSpan(row, 0, 3); row++; myLabelSelection.setWidget(row, 0, myApplyLabel); myLabelSelection.getFlexCellFormatter().setColSpan(row, 0, 3); myLabelSelection.getFlexCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_CENTER); myLabelSelection.getRowFormatter().setStyleName(row, CSSClassManager.POPUP_MENU_ENTRY); theMouseHandler = new MouseHandler(row); myApplyLabel.addMouseOverHandler(theMouseHandler); myApplyLabel.addMouseOutHandler(theMouseHandler); } }
From source file:org.bonitasoft.console.client.view.labels.LabelStyleSelectorWidget.java
License:Open Source License
/** * /* w w w . ja v a 2 s . c om*/ * Default constructor. * * @param aLabelDataSource * @param aLabelModel */ public LabelStyleSelectorWidget(final LabelDataSource aLabelDataSource, final LabelModel aLabelModel) { super(); myLabelDataSource = aLabelDataSource; myLabelModel = aLabelModel; myErrorMessage = new Label(); myErrorMessage.setStylePrimaryName(CSSClassManager.VALIDATION_ERROR_MESSAGE); myCreateDialogBox = createDialogBox(); FlexTable theOuterPanel = new FlexTable(); Label theLabel; DecoratorPanel theContainer; theLabel = new Label(TITLE_LABEL_KEY); theOuterPanel.setWidget(0, 0, theLabel); theOuterPanel.getFlexCellFormatter().setColSpan(0, 0, 4); // if (editableCSSClassName.length != readonlyCSSClassName.length || editableCSSClassName.length != previewCSSClassName.length) { Window.alert("Invalid list of CSS style definitions in class LabelStyleSelectorWidget!"); } int theRow = 1; int theCol = 0; for (int i = 0; i < editableCSSClassName.length; i++) { theContainer = new DecoratorPanel(); theLabel = new Label(B_CHARACTER); theContainer.add(theLabel); theContainer.setStylePrimaryName(previewCSSClassName[i] + CONTAINER_CSS_SUFFIX); theLabel.setStyleName(previewCSSClassName[i]); theLabel.addClickHandler(new StyleClickHandler(aLabelModel, editableCSSClassName[i], previewCSSClassName[i], readonlyCSSClassName[i])); theOuterPanel.setWidget(theRow, theCol, theContainer); // Go to a new line every 4 choices. if (theCol == 3) { theRow++; theCol = 0; } else { theCol++; } } // Add a separator. theRow++; theOuterPanel.setHTML(theRow, 0, "<HR>"); theOuterPanel.getFlexCellFormatter().setColSpan(theRow, 0, 4); // Add a menu. theRow++; Label theRenameLink = new Label(constants.renameLabel()); theRenameLink.setStylePrimaryName(CSSClassManager.LINK_LABEL); theOuterPanel.setWidget(theRow, 0, theRenameLink); theOuterPanel.getFlexCellFormatter().setColSpan(theRow, 0, 4); theRenameLink.addClickHandler(new ClickHandler() { /* * (non-Javadoc) * * @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google .gwt.event.dom.client.ClickEvent) */ public void onClick(final ClickEvent aClickEvent) { myCreateDialogBox.setPopupPositionAndShow(new PopupPanel.PositionCallback() { public void setPosition(int anOffsetWidth, int anOffsetHeight) { int left = ((Window.getClientWidth() / 2) - (anOffsetWidth / 2)); int top = aClickEvent.getNativeEvent().getClientY() - (anOffsetHeight / 2); myCreateDialogBox.setPopupPosition(left, top); } }); myNewLabelName.setText(myLabelModel.getUUID().getValue()); myNewLabelName.setFocus(true); LabelStyleSelectorWidget.this.hide(); } }); this.add(theOuterPanel); // Set the auto hide feature. setAutoHideEnabled(true); }
From source file:org.bonitasoft.console.client.view.labels.LabelViewer.java
License:Open Source License
private DecoratorPanel buildLabelTable(LabelModel aLabelModel) { DecoratorPanel theContainer = new DecoratorPanel(); // Create the layout container. final HorizontalPanel theTable = new HorizontalPanel(); final Label theNameLabel = new Label(buildShortName(LocaleUtil.translate(aLabelModel.getUUID()))); theNameLabel.setTitle(LocaleUtil.translate(aLabelModel.getUUID())); theTable.add(theNameLabel);/*from w w w .ja v a2 s .co m*/ aLabelModel.addModelChangeListener(LabelModel.NAME_PROPERTY, new ModelChangeListener() { public void modelChange(ModelChangeEvent anEvt) { theNameLabel.setText(buildShortName(((LabelUUID) anEvt.getNewValue()).getValue())); } }); if (isDeletable && aLabelModel.isAssignableByUser()) { final Label theRemoveLabel; theTable.setStylePrimaryName(aLabelModel.getEditableCSSStyleName()); theRemoveLabel = new Label("X"); theRemoveLabel.addClickHandler(new RemoveLabelClickHandler(aLabelModel)); theRemoveLabel.setStyleName("remove"); theTable.add(theRemoveLabel); } else { theTable.setStylePrimaryName(aLabelModel.getReadonlyCSSStyleName()); } theContainer.add(theTable); theContainer.setStylePrimaryName(aLabelModel.getReadonlyCSSStyleName() + ROUNDED_CORNER_SUFFIX_STYLE_NAME); return theContainer; }
From source file:org.bonitasoft.console.client.view.processes.ProcessFinderPanel.java
License:Open Source License
private FlexTable buildContent() { FlexTable thePanel = new FlexTable(); thePanel.setWidget(0, 0, myErrorMessageLabel); thePanel.getFlexCellFormatter().setStyleName(0, 0, CSSClassManager.VALIDATION_ERROR_MESSAGE); thePanel.getFlexCellFormatter().setColSpan(0, 0, 3); final ProcessList myItemList = new ProcessList(null, (ProcessSelection) myItemFinderDataSource.getItemSelection(), myItemFinderDataSource) { @Override//from w ww . java 2 s.co m protected void initView() { super.initView(); if (myBottomNavBar.getWidgetCount() == 2) { myBottomNavBar.remove(1); } } @Override public void notifyItemClicked(BonitaProcessUUID anItem, ClickEvent anEvent) { // Modify item selection. if (anItem != null) { final Cell theCell = myInnerTable.getCellForEvent(anEvent); if (theCell != null) { final int theCellIndex = theCell.getCellIndex(); if (theCellIndex != mySelectColumnIndex) { if (mySelectionIsMultiple) { if (myItemSelection.getSelectedItems().contains(anItem)) { myItemSelection.removeItemFromSelection(anItem); } else { myItemSelection.addItemToSelection(anItem); } } else { if (!myItemSelection.getSelectedItems().contains(anItem)) { myItemSelection.clearSelection(); myItemSelection.addItemToSelection(anItem); } else { myItemSelection.clearSelection(); } } } else { // The check box has already inserted the item into the selection. if (mySelectionIsMultiple) { // Nothing to do here. } else { if (myItemSelection.getSize() > 1) { // I have to solve the inconsistency here. myItemSelection.clearSelection(); myItemSelection.addItemToSelection(anItem); } } } } } } @Override protected FlowPanel buildTopNavBar() { final FlowPanel theResult = new FlowPanel(); final Label theRefreshLink = new Label(constants.refresh()); theRefreshLink.setStyleName(CSSClassManager.LINK_LABEL); theRefreshLink.addClickHandler(new ClickHandler() { public void onClick(ClickEvent aEvent) { myBonitaDataSource.reload(); } }); theResult.add(theRefreshLink); return theResult; } @Override protected FlowPanel buildBottomNavBar() { final FlowPanel theResult = new FlowPanel(); final CustomMenuBar theActionMenu = new CustomMenuBar(); theActionMenu.addItem(constants.add(), new Command() { public void execute() { setSelectedItems(myItemSelection); } }); theActionMenu.addItem(constants.cancel(), new Command() { public void execute() { cancel(); } }); theResult.add(theActionMenu); return theResult; } }; thePanel.setWidget(2, 0, myItemList); thePanel.getFlexCellFormatter().setColSpan(2, 0, 3); return thePanel; }
From source file:org.bonitasoft.console.client.view.StartCasePanel.java
License:Open Source License
/** * Update the User Interface./*from ww w . j a v a 2s. c o m*/ * * @param aProcessesList * */ private void update(Collection<BonitaProcess> aProcessesList) { // First of all clean up the panel. myVisibleEntries.clear(); myHiddenEntries.clear(); // myProcessOracle.clear(); if (aProcessesList != null && !aProcessesList.isEmpty()) { // Create an entry for each process the current user is allowed to // start. Label theLabel; ProcessMouseHandler theMouseHandler; Image theStartIcon; int theRow = 0; String theProcessDisplayName = null; for (BonitaProcess theProcessDefinition : aProcessesList) { theMouseHandler = new ProcessMouseHandler(theProcessDefinition, new Label(constants.startCase())); // When the name of the process is to long, add of "..." a the end of the name if (theProcessDefinition.getDisplayName() != null) { StringBuilder nameDisplayed = new StringBuilder(); String[] nameSplitted = theProcessDefinition.getDisplayName().split(" "); for (int i = 0; i < nameSplitted.length; i++) { if (nameSplitted[i].length() > 22) { nameDisplayed.append(nameSplitted[i].substring(0, 19)); nameDisplayed.append("..."); break; } else { nameDisplayed.append(nameSplitted[i]); nameDisplayed.append(" "); } } theProcessDisplayName = nameDisplayed.toString(); } theLabel = new Label(theProcessDisplayName); theLabel.addMouseOverHandler(theMouseHandler); theLabel.addMouseOutHandler(theMouseHandler); theLabel.addClickHandler(new ProcessClickHandler(theProcessDefinition)); theLabel.setStyleName("menu_choice"); theStartIcon = new Image(PICTURE_PLACE_HOLDER); theStartIcon.addMouseOverHandler(theMouseHandler); theStartIcon.addMouseOutHandler(theMouseHandler); theStartIcon.addClickHandler(new ProcessClickHandler(theProcessDefinition)); theStartIcon.setStyleName("start_case_icon"); if (theProcessDefinition.isVisible()) { myVisibleEntries.setWidget(theRow, 0, theLabel); myVisibleEntries.setWidget(theRow, 1, theStartIcon); } else { myHiddenEntries.setWidget(theRow, 0, theLabel); myHiddenEntries.setWidget(theRow, 1, theStartIcon); } // add the process into the suggestbox's oracle // myProcessOracle.add(theProcessDisplayName); theRow++; } if (myHiddenEntries.getRowCount() > 0) { myOuterPanel.add(myMoreMenu); } else { myOuterPanel.remove(myMoreMenu); } } else { myVisibleEntries.setWidget(0, 0, myEmptyListMessage); myOuterPanel.remove(myMoreMenu); } }
From source file:org.bonitasoft.console.client.view.steps.StepEditor.java
License:Open Source License
protected Widget buildAssignToMeMenuEntry() { final FlowPanel theAssignToMeContainer = new FlowPanel(); final Image theAssignToMeIcon = new Image(PICTURE_PLACE_HOLDER); final Label theAssignToMeLink = new Label(constants.assignToMe()); ClickHandler theAssignToMeClickHandler = new ClickHandler() { public void onClick(ClickEvent aEvent) { myStepDataSource.assignStepToMe(myStep); }/*from w w w . j a v a2s.co m*/ }; theAssignToMeContainer.add(theAssignToMeIcon); theAssignToMeContainer.add(theAssignToMeLink); // Associate CSS styles theAssignToMeContainer.setStyleName("inline_block"); theAssignToMeIcon.setStylePrimaryName("assign_to_me_icon"); theAssignToMeLink.setStyleName(CSSClassManager.LINK_LABEL); // Associate the click handlers theAssignToMeIcon.addClickHandler(theAssignToMeClickHandler); theAssignToMeLink.addClickHandler(theAssignToMeClickHandler); return theAssignToMeContainer; }
From source file:org.bonitasoft.console.client.view.steps.StepEditor.java
License:Open Source License
protected Widget buildSuspendMenuEntry() { final FlowPanel theSuspendContainer = new FlowPanel(); final Image theSuspendIcon = new Image(PICTURE_PLACE_HOLDER); final Label theSuspendLink = new Label(constants.suspend()); ClickHandler theSuspendClickHandler = new ClickHandler() { public void onClick(ClickEvent aEvent) { myStepDataSource.suspendStep(myStep); }/*from ww w . jav a2s .c o m*/ }; theSuspendContainer.add(theSuspendIcon); theSuspendContainer.add(theSuspendLink); // Associate CSS styles theSuspendIcon.setStylePrimaryName("suspend_icon"); theSuspendContainer.setStyleName("inline_block"); theSuspendLink.setStyleName(CSSClassManager.LINK_LABEL); // Associate the click handlers theSuspendIcon.addClickHandler(theSuspendClickHandler); theSuspendLink.addClickHandler(theSuspendClickHandler); return theSuspendContainer; }
From source file:org.bonitasoft.console.client.view.steps.StepEditor.java
License:Open Source License
protected Widget buildResumeStepMenuEntry() { final FlowPanel theResumeContainer = new FlowPanel(); final Image theResumeIcon = new Image(PICTURE_PLACE_HOLDER); final Label theResumeLink = new Label(constants.resume()); ClickHandler theResumeClickHandler = new ClickHandler() { public void onClick(ClickEvent aEvent) { myStepDataSource.resumeStep(myStep); }/*from w ww .j a va2 s. c om*/ }; theResumeContainer.add(theResumeIcon); theResumeContainer.add(theResumeLink); // Associate CSS styles theResumeIcon.setStylePrimaryName("resume_icon"); theResumeContainer.setStyleName("inline_block"); theResumeLink.setStyleName(CSSClassManager.LINK_LABEL); // Associate the click handlers theResumeIcon.addClickHandler(theResumeClickHandler); theResumeLink.addClickHandler(theResumeClickHandler); return theResumeContainer; }