Example usage for com.google.gwt.user.client Window confirm

List of usage examples for com.google.gwt.user.client Window confirm

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window confirm.

Prototype

public static boolean confirm(String msg) 

Source Link

Usage

From source file:org.jahia.ajax.gwt.client.widget.toolbar.action.ZipActionItem.java

License:Open Source License

public void onComponentSelection() {
    final List<GWTJahiaNode> selectedItems = linker.getSelectionContext().getMultipleSelection();
    if (selectedItems != null && selectedItems.size() > 0) {
        final GWTJahiaNode selection = selectedItems.get(0);
        if (selection != null) {
            linker.loading(Messages.get("statusbar.zipping.label"));
            String defaultArchName;
            if (selectedItems.size() == 1) {
                defaultArchName = selection.getName() + ".zip";
            } else {
                defaultArchName = "archive.zip";
            }/*ww w . ja v a  2 s . co m*/
            final String archName = Window.prompt(Messages.get("confirm.archiveName.label"), defaultArchName);
            if (archName != null && archName.length() > 0) {
                final String parentPath = selection.getPath().substring(0,
                        selection.getPath().lastIndexOf('/'));
                JahiaContentManagementService.App.getInstance().checkExistence(parentPath + "/" + archName,
                        new BaseAsyncCallback<Boolean>() {
                            public void onApplicationFailure(Throwable throwable) {
                                if (throwable instanceof ExistingFileException) {
                                    if (Window.confirm(Messages.get("alreadyExists.label") + "\n"
                                            + Messages.get("confirm.overwrite.label"))) {
                                        forceZip(selectedItems, archName, linker);
                                    }
                                } else {
                                    Window.alert(Messages.get("failure.zip.label") + "\n"
                                            + throwable.getLocalizedMessage());
                                    linker.loaded();
                                }
                            }

                            public void onSuccess(Boolean aBoolean) {
                                forceZip(selectedItems, archName, linker);
                            }
                        });
            }
        }
    }
}

From source file:org.jason.mapmaker.client.presenter.dataVersions.ManageDataVersionsPresenter.java

License:Apache License

@Override
public void doUpdateTigerLineVersion() {

    boolean confirm = Window
            .confirm("Updating the version of the TIGER/Line version will cause all current imported locations "
                    + "to be deleted. Are you sure you wish to proceed?");

    if (confirm) {
        String tigerLineVersion = getView().getTigerLineYear().getValue();
        getView().getUpdateTigerYearButton().setEnabled(false);
        // TODO: Validate!

        dispatch.execute(new UpdateTigerLineVersionAction(tigerLineVersion),
                new AsyncCallback<UpdateTigerLineVersionResult>() {
                    @Override//  w ww.j  a v a  2  s.co m
                    public void onFailure(Throwable caught) {
                        caught.printStackTrace();
                        getView().getUpdateTigerYearButton().setEnabled(true);

                    }

                    @Override
                    public void onSuccess(UpdateTigerLineVersionResult result) {
                        Window.alert("Tiger Version updated!");
                        getView().getUpdateTigerYearButton().setEnabled(true);
                    }
                });
    }
}

From source file:org.jason.mapmaker.client.presenter.dataVersions.ManageDataVersionsPresenter.java

License:Apache License

@Override
public void doUpdateUsgsFeaturesDate() {

    boolean confirm = Window.confirm("Updating the version of the features will cause all currently imported"
            + " features to be deleted. Are you sure you wish to process?");

    if (confirm) {
        String usgsVersion = getView().getUsgsFeaturesDate().getValue();
        getView().getUpdateUsgsDateButton().setEnabled(false);

        dispatch.execute(new UpdateUsgsFeaturesVersionAction(usgsVersion),
                new AsyncCallback<UpdateUsgsFeaturesVersionResult>() {
                    @Override//  w w w.  j  a  va 2s.  c  o m
                    public void onFailure(Throwable caught) {
                        caught.printStackTrace();
                        getView().getUpdateUsgsDateButton().setEnabled(true);
                    }

                    @Override
                    public void onSuccess(UpdateUsgsFeaturesVersionResult result) {
                        Window.alert("USGS Features date updated!");
                        getView().getUpdateUsgsDateButton().setEnabled(true);
                    }
                });
    }
}

From source file:org.javahispano.javaleague.client.application.cars.car.CarPresenter.java

License:Apache License

private void onDeleteCar() {
    Boolean confirm = Window.confirm("Are you sure you want to delete " + carDto.getModel() + "?");
    if (confirm) {
        carsDelegate.withCallback(new ErrorHandlerAsyncCallback<Void>(this) {
            @Override/*from   ww w.ja v  a  2s . co m*/
            public void onSuccess(Void nothing) {
                NavigationTabEvent.fireClose(CarPresenter.this, CarPresenter.this);
            }
        }).car(carDto.getId()).delete();
    }
}

From source file:org.javahispano.javaleague.client.application.cars.CarsView.java

License:Apache License

private void initActionColumns() {
    Cell<CarDto> editCell = new ActionCell<>("Edit", new Delegate<CarDto>() {
        @Override/*from  www . jav a 2  s  .  co  m*/
        public void execute(CarDto carDto) {
            getUiHandlers().onEdit(carDto);
        }
    });

    Cell<CarDto> deleteCell = new ActionCell<>("Delete", new Delegate<CarDto>() {
        @Override
        public void execute(CarDto carDto) {
            Boolean confirm = Window.confirm("Are you sure you want to delete " + carDto.getModel() + "?");

            if (confirm) {
                getUiHandlers().onDelete(carDto);
            }
        }
    });

    IdentityColumn<CarDto> editColumn = new IdentityColumn<>(editCell);
    IdentityColumn<CarDto> deleteColumn = new IdentityColumn<>(deleteCell);

    carGrid.addColumn(editColumn, "Edit");
    carGrid.addColumn(deleteColumn, "Delete");

    carGrid.setColumnWidth(editColumn, 75, Unit.PX);
    carGrid.setColumnWidth(deleteColumn, 75, Unit.PX);
}

From source file:org.javahispano.javaleague.client.application.manufacturer.ManufacturerDetailPresenter.java

License:Apache License

private void deleteManufacturer() {
    Boolean confirm = Window.confirm("Are you sure you want to delete " + currentManufacturer.getName() + "?");
    if (confirm) {
        manufacturersDelegate.withCallback(new ErrorHandlerAsyncCallback<Void>(this) {
            @Override/*from  w w  w  . ja v  a  2  s.  co m*/
            public void onSuccess(Void nothing) {
                placeManager.revealPlace(new Builder().nameToken(NameTokens.getManufacturer()).build());
            }
        }).delete(currentManufacturer.getId());
    }
}

From source file:org.javahispano.javaleague.client.application.manufacturer.ManufacturerView.java

License:Apache License

private void initActionColumns() {
    Cell<ManufacturerDto> editCell = new ActionCell<>("Edit", new Delegate<ManufacturerDto>() {
        @Override/*from ww w  .j a  v a2  s  . co  m*/
        public void execute(ManufacturerDto manufacturerDto) {
            getUiHandlers().onEdit(manufacturerDto);
        }
    });

    Cell<ManufacturerDto> deleteCell = new ActionCell<>("Delete", new Delegate<ManufacturerDto>() {
        @Override
        public void execute(ManufacturerDto manufacturerDto) {
            Boolean confirm = Window
                    .confirm("Are you sure you want to delete " + manufacturerDto.getName() + "?");

            if (confirm) {
                getUiHandlers().onDelete(manufacturerDto);
            }
        }
    });

    IdentityColumn<ManufacturerDto> editColumn = new IdentityColumn<>(editCell);
    IdentityColumn<ManufacturerDto> deleteColumn = new IdentityColumn<>(deleteCell);

    manufacturerGrid.addColumn(editColumn, "Edit");
    manufacturerGrid.addColumn(deleteColumn, "Delete");

    manufacturerGrid.setColumnWidth(editColumn, 75, Unit.PX);
    manufacturerGrid.setColumnWidth(deleteColumn, 75, Unit.PX);
}

From source file:org.javahispano.javaleague.client.application.rating.RatingView.java

License:Apache License

private void initActionColumns() {
    Cell<RatingDto> deleteCell = new ActionCell<>("Delete", new ActionCell.Delegate<RatingDto>() {
        @Override/*www .  j av a2 s.co  m*/
        public void execute(RatingDto ratingDto) {
            Boolean confirm = Window.confirm("Are you sure you want to delete" + ratingDto.toString() + "?");

            if (confirm) {
                getUiHandlers().onDelete(ratingDto);
            }
        }
    });

    IdentityColumn<RatingDto> deleteColumn = new IdentityColumn<>(deleteCell);
    ratingGrid.addColumn(deleteColumn, "Delete");
    ratingGrid.setColumnWidth(deleteColumn, 75, Style.Unit.PX);
}

From source file:org.jboss.bpm.console.client.engine.DeploymentDetailView.java

License:Open Source License

public DeploymentDetailView() {
    //TODO: -Rikkola-
    //        super("Deployment details");
    super.setStyleName("bpm-detail-panel");

    grid = new PropertyGrid(new String[] { "ID:", "Name:", "Processes:" });
    HorizontalPanel propLayout = new HorizontalPanel();
    propLayout.add(grid);/*w w w  .java  2s.c o  m*/

    suspendBtn = new Button("Retire", new ClickHandler() {

        public void onClick(ClickEvent clickEvent) {

            DeploymentRef deploymentRef = getSelection();
            if (deploymentRef != null) {
                if (Window.confirm(
                        "Retire deployment. Do you want to retire this deployment? Any associated process will be suspended.")) {
                    controller.handleEvent(new Event(SuspendDeploymentAction.ID, getSelection().getId()));
                }
            } else {
                Window.alert("Missing selection. Please select a deployment");
            }
        }
    });

    resumeBtn = new Button("Activate", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            DeploymentRef deploymentRef = getSelection();
            if (deploymentRef != null) {
                if (Window.confirm("Activate deployment. Do you want to resume this deployment?")) {
                    controller.handleEvent(new Event(ResumeDeploymentAction.ID, getSelection().getId()));
                }

            } else {
                Window.alert("Missing selection. Please select a deployment");
            }
        }
    });

    VerticalPanel btnLayout = new VerticalPanel();
    btnLayout.add(suspendBtn);
    btnLayout.add(resumeBtn);
    propLayout.add(btnLayout);

    // properties
    final VerticalPanel deck = new VerticalPanel();
    deck.add(propLayout);

    // resource info
    ScrollPanel scrollPanel = new ScrollPanel();
    resourcePanel = new ResourcePanel();
    scrollPanel.add(resourcePanel);
    deck.add(scrollPanel);

    // selection
    final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
    dropBox.setStyleName("bpm-operation-ui");
    dropBox.addItem("Properties");
    dropBox.addItem("Resources");
    dropBox.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            //TODO: -Rikkola-
            //                deck.showWidget(dropBox.getSelectedIndex());
            //                deck.layout();
        }
    });

    //        this.getHeader().add(dropBox, Caption.CaptionRegion.RIGHT);
    this.add(dropBox);
    this.add(deck);

    //        deck.showWidget(dropBox.getSelectedIndex());

    this.add(deck);

}

From source file:org.jboss.bpm.console.client.engine.DeploymentListView.java

License:Open Source License

public void initialize() {
    if (!initialized) {
        deploymentList = new VerticalPanel();

        // toolbar

        final HorizontalPanel toolBox = new HorizontalPanel();

        final MenuBar toolBar = new MenuBar();
        toolBar.addItem("Refresh", new Command() {
            public void execute() {

                reset();/*  w  w  w .j a  v  a 2 s  .  c o  m*/

                // force loading
                controller.handleEvent(new Event(UpdateDeploymentsAction.ID, null));
            }
        });

        MenuItem deleteBtn = new MenuItem("Delete", new Command() {
            public void execute() {
                DeploymentRef deploymentRef = getSelection();
                if (deploymentRef != null) {
                    if (Window.confirm(
                            "Delete deployment. Do you want to delete this deployment? Any related data will be removed.")) {
                        controller.handleEvent(new Event(DeleteDeploymentAction.ID, getSelection().getId()));
                    }
                } else {
                    Window.alert("Missing selection. Please select a deployment");
                }
            }
        });

        if (!isRiftsawInstance) {
            toolBar.addItem(deleteBtn);
        }

        toolBox.add(toolBar);

        // filter
        VerticalPanel filterPanel = new VerticalPanel();
        filterPanel.setStyleName("mosaic-ToolBar");
        final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
        dropBox.setStyleName("bpm-operation-ui");
        dropBox.addItem("All");
        dropBox.addItem("Active");
        dropBox.addItem("Retired");

        dropBox.addChangeListener(new ChangeListener() {
            public void onChange(Widget sender) {
                switch (dropBox.getSelectedIndex()) {
                case 0:
                    currentFilter = FILTER_NONE;
                    break;
                case 1:
                    currentFilter = FILTER_ACTIVE;
                    break;
                case 2:
                    currentFilter = FILTER_SUSPENDED;
                    break;
                default:
                    throw new IllegalArgumentException("No such index");
                }

                renderFiltered();
            }
        });
        filterPanel.add(dropBox);

        toolBox.add(filterPanel);

        this.deploymentList.add(toolBox);
        this.deploymentList.add(listBox);

        // details
        // detail panel
        detailView = new DeploymentDetailView();
        controller.addView(DeploymentDetailView.ID, detailView);

        Timer t = new Timer() {
            @Override
            public void run() {
                controller.handleEvent(new Event(UpdateDeploymentsAction.ID, null));
            }
        };

        t.schedule(500);

        initialized = true;
    }

}