List of usage examples for com.google.gwt.user.client Window confirm
public static boolean confirm(String msg)
From source file:org.drools.guvnor.client.ruleeditor.toolbar.ActionToolbar.java
License:Apache License
public void setArchiveCommand(final Command archiveCommand) { archive.setCommand(new Command() { public void execute() { if (Window.confirm(constants.AreYouSureYouWantToArchiveThisItem() + "\n" + constants.ArchiveThisAssetThisWillNotPermanentlyDeleteIt())) { archiveCommand.execute(); }/*from www . j av a 2s . c o m*/ } }); }
From source file:org.drools.guvnor.client.ruleeditor.toolbar.ActionToolbar.java
License:Apache License
public void setDeleteCommand(final Command deleteCommand) { delete.setCommand(new Command() { public void execute() { if (Window.confirm(constants.DeleteAreYouSure())) { deleteCommand.execute(); }//from w w w .j a v a 2 s .c o m } }); }
From source file:org.drools.guvnor.client.scorecards.GuidedScorecardWidget.java
License:Apache License
private void removeCharacteristic(DirtyableFlexTable selectedTable) { if (selectedTable != null) { TextBox tbName = (TextBox) selectedTable.getWidget(0, 1); String name = tbName.getValue(); if (name == null || name.trim().length() == 0) { name = "Untitled"; }/* ww w .j a v a 2s.c o m*/ String msg = "Are you sure you want to delete '" + (name) + "' Characteristic?"; if (Window.confirm(msg)) { characteristicsTables.remove(selectedTable); characteristicsAttrMap.remove(selectedTable); Widget parent = selectedTable.getParent().getParent(); int i = characteristicsPanel.getWidgetIndex(parent); characteristicsPanel.remove(parent); characteristicsPanel.remove(i); } } }
From source file:org.drools.guvnor.client.scorecards.GuidedScorecardWidget.java
License:Apache License
private Widget addAttributeCellTable(final DirtyableFlexTable cGrid, final Characteristic characteristic) { final CellTable<Attribute> attributeCellTable = new CellTable<Attribute>(); List<String> operators = new ArrayList<String>(); String dataType;/*from ww w. ja va 2 s .co m*/ if (characteristic == null) { dataType = "String"; } else { dataType = characteristic.getDataType(); } if ("String".equalsIgnoreCase(dataType)) { operators.addAll(Arrays.asList(stringOperators)); } else if ("boolean".equalsIgnoreCase(dataType)) { operators.addAll(Arrays.asList(booleanOperators)); } else { operators.addAll(Arrays.asList(numericOperators)); } DynamicSelectionCell categoryCell = new DynamicSelectionCell(operators); Column<Attribute, String> operatorColumn = new Column<Attribute, String>(categoryCell) { public String getValue(Attribute object) { return object.getOperator(); } }; Column<Attribute, String> valueColumn = new Column<Attribute, String>(new CustomEditTextCell()) { public String getValue(Attribute attribute) { return attribute.getValue(); } }; final EditTextCell partialScoreCell = new EditTextCell(); Column<Attribute, String> partialScoreColumn = new Column<Attribute, String>(partialScoreCell) { public String getValue(Attribute attribute) { return "" + attribute.getPartialScore(); } }; Column<Attribute, String> reasonCodeColumn = new Column<Attribute, String>(new EditTextCell()) { public String getValue(Attribute attribute) { return attribute.getReasonCode(); } }; ActionCell.Delegate<Attribute> delegate = new ActionCell.Delegate<Attribute>() { public void execute(Attribute attribute) { if (Window.confirm("Remove this attribute?")) { List<Attribute> list = characteristicsAttrMap.get(cGrid).getList(); list.remove(attribute); ((EnumDropDown) cGrid.getWidget(2, 0)).setEnabled(list.size() == 0); ((EnumDropDown) cGrid.getWidget(2, 1)).setEnabled(list.size() == 0); ((Button) cGrid.getWidget(0, 3)).setEnabled(list.size() != 2); attributeCellTable.redraw(); } } }; Cell<Attribute> actionCell = new ActionCell<Attribute>("Remove", delegate); Column<Attribute, String> actionColumn = new IdentityColumn(actionCell); reasonCodeColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { object.setReasonCode(value); attributeCellTable.redraw(); } }); operatorColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { object.setOperator(value); attributeCellTable.redraw(); } }); valueColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { object.setValue(value); attributeCellTable.redraw(); } }); partialScoreColumn.setFieldUpdater(new FieldUpdater<Attribute, String>() { public void update(int index, Attribute object, String value) { try { double d = Double.parseDouble(value); object.setPartialScore(d); } catch (Exception e1) { partialScoreCell.clearViewData(object); } attributeCellTable.redraw(); } }); // Add the columns. attributeCellTable.addColumn(operatorColumn, "Operator"); attributeCellTable.addColumn(valueColumn, "Value"); attributeCellTable.addColumn(partialScoreColumn, "Partial Score"); attributeCellTable.addColumn(reasonCodeColumn, "Reason Code"); attributeCellTable.addColumn(actionColumn, "Actions"); attributeCellTable.setWidth("100%", true); attributeCellTable.setColumnWidth(operatorColumn, 5.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(valueColumn, 10.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(partialScoreColumn, 10.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(reasonCodeColumn, 10.0, Style.Unit.PCT); attributeCellTable.setColumnWidth(actionColumn, 5.0, Style.Unit.PCT); ListDataProvider<Attribute> dataProvider = new ListDataProvider<Attribute>(); dataProvider.addDataDisplay(attributeCellTable); characteristicsAttrMap.put(cGrid, dataProvider); return (attributeCellTable); }
From source file:org.drools.guvnor.client.widgets.DiscussionWidget.java
License:Apache License
private void showNewCommentButton() { newCommentLayout.clear();/* w ww. j ava 2 s.c o m*/ HorizontalPanel hp = new HorizontalPanel(); Button createNewComment = new Button(constants.AddADiscussionComment()); createNewComment.setEnabled(!this.readOnly); hp.add(createNewComment); if (UserCapabilities.INSTANCE.hasCapability(Capability.SHOW_ADMIN)) { Button adminClearAll = new Button(constants.EraseAllComments()); adminClearAll.setEnabled(!readOnly); hp.add(adminClearAll); adminClearAll.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { if (Window.confirm(constants.EraseAllCommentsWarning())) { assetService.clearAllDiscussionsForAsset(artifact.getUuid(), new GenericCallback<java.lang.Void>() { public void onSuccess(Void v) { updateCommentList(new ArrayList<DiscussionRecord>()); } }); } } }); } final String feedURL = GWT.getModuleBaseURL() + "feed/discussion?package=" + ((Asset) artifact).getMetaData().getModuleName() + "&assetName=" + URL.encode(artifact.getName()) + "&viewUrl=" + Util.getSelfURL(); Image image = GuvnorImages.INSTANCE.Feed(); image.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { Window.open(feedURL, "_blank", null); } }); hp.add(image); newCommentLayout.add(hp); newCommentLayout.setCellHorizontalAlignment(hp, HasHorizontalAlignment.ALIGN_RIGHT); createNewComment.addClickHandler(new ClickHandler() { public void onClick(ClickEvent sender) { showAddNewComment(); } }); }
From source file:org.drools.guvnor.client.widgets.drools.toolbar.AssetEditorActionToolbar.java
License:Apache License
public void setArchiveCommand(final Command archiveCommand) { archive.setCommand(new Command() { public void execute() { if (Window.confirm(Constants.INSTANCE.AreYouSureYouWantToArchiveThisItem())) { archiveCommand.execute(); }//from w ww . jav a2 s . c om } }); }
From source file:org.drools.guvnor.client.widgets.drools.toolbar.AssetEditorActionToolbar.java
License:Apache License
public void setDeleteCommand(final Command deleteCommand) { delete.setCommand(new Command() { public void execute() { if (Window.confirm(Constants.INSTANCE.DeleteAreYouSure())) { deleteCommand.execute(); }/*from w ww .j av a 2s . co m*/ } }); }
From source file:org.drools.guvnor.client.widgets.drools.toolbar.AssetEditorActionToolbar.java
License:Apache License
protected void verifyAndDoCheckinConfirm(final boolean closeAfter) { if (editor instanceof RuleModeller) { ((RuleModeller) editor).verifyRule(new Command() { public void execute() { if (((RuleModeller) editor).hasVerifierErrors() || ((RuleModeller) editor).hasVerifierWarnings()) { if (!Window .confirm(Constants.INSTANCE.theRuleHasErrorsOrWarningsDotDoYouWantToContinue())) { return; }//from w ww . ja v a 2 s .com } doCheckinConfirm(closeAfter); } }); } else if (editor instanceof BusinessProcessEditor) { if (((BusinessProcessEditor) editor).hasErrors()) { return; } else { doCheckinConfirm(closeAfter); } } else { doCheckinConfirm(closeAfter); } }
From source file:org.drools.guvnor.client.widgets.drools.toolbar.AssetEditorActionToolbar.java
License:Apache License
private void doPromptToGlobal() { if (asset.getMetaData().getModuleName().equals("globalArea")) { Window.alert(Constants.INSTANCE.ItemAlreadyInGlobalArea()); return;/*from ww w.j av a 2 s .c o m*/ } if (Window.confirm(Constants.INSTANCE.PromoteAreYouSure())) { assetService.promoteAssetToGlobalArea(asset.getUuid(), new GenericCallback<Void>() { public void onSuccess(Void data) { Window.alert(Constants.INSTANCE.Promoted()); flushSuggestionCompletionCache(asset.getMetaData().getModuleName(), null); flushSuggestionCompletionCache("globalArea", null); eventBus.fireEvent(new RefreshModuleEditorEvent(asset.getMetaData().getModuleUUID())); eventBus.fireEvent( new RefreshAssetEditorEvent(asset.getMetaData().getModuleName(), asset.getUuid())); } @Override public void onFailure(Throwable t) { super.onFailure(t); } }); } }
From source file:org.drools.guvnor.client.widgets.soa.toolbar.AssetEditorActionToolbar.java
License:Apache License
public void setArchiveCommand(final Command archiveCommand) { archive.setCommand(new Command() { public void execute() { if (Window.confirm(constants.AreYouSureYouWantToArchiveThisItem())) { archiveCommand.execute(); }//from ww w. j a v a 2s . c o m } }); }