List of usage examples for com.google.gwt.user.client Window confirm
public static boolean confirm(String msg)
From source file:eml.studio.client.ui.menu.DatasetDeleteMenu.java
License:Open Source License
public static MenuItem create(final DatasetLeaf node) { Command command = new MenuItemCommand(node) { @Override// w w w. ja v a2s .c om public void execute() { String id = node.getModule().getId(); boolean y = Window.confirm("Ready to delete " + node.getText() + ""); if (y) { DatasetServiceAsync svc = GWT.create(DatasetService.class); svc.delete(id, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(Void result) { node.delete(); } }); } this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("Delete", command); return item; }
From source file:eml.studio.client.ui.menu.DatasetDeprecateMenu.java
License:Open Source License
public static MenuItem create(final DatasetLeaf node) { Command command = new MenuItemCommand(node) { @Override/*from w w w . j a v a 2s .c o m*/ public void execute() { String id = node.getModule().getId(); boolean y = Window.confirm("Ready to deprecate " + node.getModule().getName() + ""); if (y) { DatasetServiceAsync svc = GWT.create(DatasetService.class); svc.deprecate(id, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(Void result) { node.delete(); } }); } this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("Deprecate", command); return item; }
From source file:eml.studio.client.ui.menu.JobAddExampleMenu.java
License:Open Source License
public static MenuItem create(final JobLeaf node) { Command command = new MenuItemCommand(node) { @Override//from w ww . j av a 2s. com public void execute() { String id = node.getModule().getJobId(); boolean y = Window.confirm("Are you sure you want to join the example task?"); if (y) { JobServiceAsync srv = GWT.create(JobService.class); srv.setExampleJobs(id, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(Void result) { node.delete(); } }); } this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("Join example task", command); return item; }
From source file:eml.studio.client.ui.menu.JobDeleteMenu.java
License:Open Source License
public static MenuItem create(final JobLeaf node) { Command command = new MenuItemCommand(node) { @Override//w w w . j a va 2s .c o m public void execute() { String id = node.getModule().getJobId(); boolean isExampleDir = node.getParentItem().getText().equals(Constants.studioUIMsg.examples()); if (!isExampleDir && node.getModule().getAccount().equals(AppController.email) && node.getModule().getIsExample()) Window.alert("The job is example job, please don't delete it in my task!"); else { boolean y = Window.confirm("Are you sure you want to delete?"); if (y) { JobServiceAsync srv = GWT.create(JobService.class); srv.deleteJob(id, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(Void result) { node.delete(); } }); } } this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("Delete", command); return item; }
From source file:eml.studio.client.ui.menu.ProgramDeleteMenu.java
License:Open Source License
public static MenuItem create(final ProgramLeaf node) { Command command = new MenuItemCommand(node) { @Override// ww w . j ava2s. c om public void execute() { String id = node.getModule().getId(); boolean y = Window.confirm("Are you ready to delete " + node.getText() + ""); if (y) { ProgramServiceAsync svc = GWT.create(ProgramService.class); svc.delete(id, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(Void result) { node.delete(); } }); } this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("delete", command); return item; }
From source file:eml.studio.client.ui.menu.ProgramDeprecateMenu.java
License:Open Source License
public static MenuItem create(final ProgramLeaf node) { Command command = new MenuItemCommand(node) { @Override/*from ww w. j a va 2s .c o m*/ public void execute() { String id = node.getModule().getId(); boolean y = Window.confirm("Are you ready to deprecate " + node.getModule().getName() + ""); if (y) { ProgramServiceAsync svc = GWT.create(ProgramService.class); svc.deprecate(id, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } @Override public void onSuccess(Void result) { node.delete(); } }); } this.component.getContextMenu().hide(); } }; MenuItem item = new MenuItem("deprecate", command); return item; }
From source file:eu.riscoss.client.entities.EntitiesModule.java
License:Apache License
protected void deleteEntity() { if (hasRisk)/*w w w . j a va 2 s. co m*/ Window.alert("Entities with associated risk sessions cannot be deleted"); else if (ppg.hasParents()) Window.alert("Entities with parents cannot be deleted"); else { Boolean b = Window.confirm("Are you sure that you want to delete entity " + selectedEntity + "?"); if (b) { RiscossJsonClient.deleteEntity(selectedEntity, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { mainView.remove(rightPanel); reloadData(); } }); } } }
From source file:eu.riscoss.client.layers.LayersModule.java
License:Apache License
private void loadRightPanel() { RiscossJsonClient.listLayers(new JsonCallback() { @Override/*from w w w. j a va 2s .c o m*/ public void onFailure(Method method, Throwable exception) { // TODO Auto-generated method stub } @Override public void onSuccess(Method method, JSONValue response) { selectedParent = ppg.getParent(); candidateParents = new ListBox(); candidateParents.insertItem("[top]", 0); if (selectedParent.equals("[top]")) candidateParents.setSelectedIndex(0); for (int i = 1; i <= response.isArray().size(); i++) { JSONObject o = (JSONObject) response.isArray().get(i - 1); if (!selectedLayer.equals(o.get("name").isString().stringValue())) { candidateParents.insertItem(o.get("name").isString().stringValue(), i); if (selectedParent.equals(o.get("name").isString().stringValue())) candidateParents.setSelectedIndex(i); } } mainView.remove(rightPanel); rightPanel = new VerticalPanel(); rightPanel.setStyleName("rightPanelLayer"); rightPanel.setWidth("90%"); rightPanel.setHeight("auto"); Label subtitle = new Label(selectedLayer); subtitle.setStyleName("subtitle"); rightPanel.add(subtitle); mainViewEntity.remove(rightPanelEntity); grid = new Grid(5, 1); grid.setStyleName("properties"); grid.setWidth("100%"); Grid properties = new Grid(2, 5); properties.setCellPadding(0); properties.setCellSpacing(0); properties.setBorderWidth(0); Label name = new Label("Name"); name.setStyleName("bold"); properties.setWidget(0, 0, name); nameL = new TextBox(); nameL.setText(selectedLayer); nameL.setStyleName("tag"); nameL.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { dataChanged = true; } }); properties.setWidget(0, 1, nameL); properties.setWidget(0, 2, space); Label parent = new Label("Parent"); parent.setStyleName("bold"); properties.setWidget(0, 3, parent); /*Label parentL = new Label(selectedParent); parentL.setStyleName("tag"); properties.setWidget(0, 4, parentL);*/ properties.setWidget(0, 4, candidateParents); descriptionData = new VerticalPanel(); descriptionData.setStyleName("description"); descriptionData.setWidth("100%"); Label descLabel = new Label("Description"); descLabel.setStyleName("bold"); descriptionData.add(descLabel); description = new TextBox(); description.setWidth("100%"); RiscossJsonClient.getLayerDescription(selectedLayer, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { description.setText(response.isString().stringValue()); } }); //description.setWidth("100%"); descriptionData.add(description); grid.setWidget(0, 0, properties); grid.setWidget(1, 0, descriptionData); HorizontalPanel buttons = new HorizontalPanel(); Button delete = new Button("Delete"); delete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (entities.size() > 0) { Window.alert("Layers with associated layers cannot be deleted"); } else { Boolean b = Window .confirm("Are you sure that you want to delete layer " + selectedLayer + "?"); if (b) { RiscossJsonClient.deleteLayer(selectedLayer, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { Window.Location.reload(); } }); } } } }); delete.setStyleName("button"); buttons.add(save); buttons.add(delete); grid.setWidget(2, 0, buttons); grid.setWidget(3, 0, null); ppg.setSelectedLayer(selectedLayer); grid.setWidget(4, 0, ppg); rightPanel.add(grid); RiscossJsonClient.listEntities(selectedLayer, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { list = response; reloadEntityTable(response); leftPanelEntity.clear(); HorizontalPanel layerData = new HorizontalPanel(); layerData.setStyleName("layerData"); Label name = new Label("Name"); name.setStyleName("bold"); layerData.add(name); entityName = new TextBox(); entityName.setWidth("120px"); entityName.setStyleName("layerNameField"); layerData.add(entityName); leftPanelEntity.add(layerData); HorizontalPanel buttons = new HorizontalPanel(); newEntityButton.setText("New " + selectedLayer + " entity"); buttons.add(newEntityButton); leftPanelEntity.add(buttons); leftPanelEntity.add(tablePanel); mainView.add(rightPanel); } }); } }); }
From source file:eu.riscoss.client.layers.LayersModule.java
License:Apache License
protected void deleteEntity() { if (hasRisk)/* w ww . ja v a 2 s . c om*/ Window.alert("Entities with associated risk sessions cannot be deleted"); if (ppgEnt.hasParents()) Window.alert("Entities with parents cannot be deleted"); else { Boolean b = Window.confirm("Are you sure that you want to delete entity " + selectedEntity + "?"); if (b) { RiscossJsonClient.deleteEntity(selectedEntity, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { mainView.remove(rightPanel); RiscossJsonClient.listEntities(selectedLayer, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { } @Override public void onSuccess(Method method, JSONValue response) { reloadEntityTable(response); } }); } }); } } }
From source file:eu.riscoss.client.models.ModelsModule.java
License:Apache License
protected void deleteRC() { if (hasRiskConfs) { Window.alert("Models with associated risk configurations cannot be deleted"); } else {/* w ww . j a v a 2 s.c o m*/ Boolean b = Window.confirm("Are you sure that you want to delete model " + selectedModel + "?"); if (b) { RiscossJsonClient.deleteModel(selectedModel, new JsonCallback() { @Override public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } @Override public void onSuccess(Method method, JSONValue response) { //dataProvider.getList().remove(getValue()); leftPanel.remove(tablePanel); tablePanel.clear(); mainView.remove(rightPanel); table = new CellTable<ModelInfo>(15, (Resources) GWT.create(TableResources.class)); table.addColumn(new Column<ModelInfo, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(ModelInfo object) { return new LinkHtml(object.getName(), "javascript:editModel(\"" + object.getName() + "\")"); }; }, "Model"); dataProvider = new ListDataProvider<ModelInfo>(); dataProvider.addDataDisplay(table); RiscossJsonClient.listModels(new JsonCallback() { public void onSuccess(Method method, JSONValue response) { GWT.log(response.toString()); if (response.isArray() != null) { for (int i = 0; i < response.isArray().size(); i++) { JSONObject o = (JSONObject) response.isArray().get(i); dataProvider.getList() .add(new ModelInfo(o.get("name").isString().stringValue())); } } } public void onFailure(Method method, Throwable exception) { Window.alert(exception.getMessage()); } }); SimplePager pager = new SimplePager(); pager.setDisplay(table); tablePanel = new VerticalPanel(); tablePanel.add(table); tablePanel.add(pager); leftPanel.add(tablePanel); } }); } } }