Example usage for com.google.gwt.event.logical.shared ValueChangeEvent getValue

List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent getValue

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared ValueChangeEvent getValue.

Prototype

public T getValue() 

Source Link

Document

Gets the value.

Usage

From source file:eolus.client.EolusUI.java

License:EUPL

private void SetUp() {
    Element e = RootPanel.get("username").getElement();
    if (user.isAdmin() == true) {
        e.setInnerHTML("Welcome Admin");
        /* show more functionality for admins */
        RootPanel.get("tab6").removeStyleName("hidden"); //clusters
        RootPanel.get("tab5").removeStyleName("hidden");//hosts
        RootPanel.get("tab1").removeStyleName("hidden");//user management      
    } else {// w  w  w.  ja  v a  2 s.  c  o m
        e.setInnerHTML("Welcome User");
    }
    /* create an object that will handle navigation from one page to another */
    final PageLoader loader = new PageLoader();
    History.addValueChangeHandler(new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            loader.Load(event.getValue());
        }
    });

    if (History.getToken().length() == 0) {
        History.newItem("home");
    } else
        History.fireCurrentHistoryState();
}

From source file:es.uem.geoparser.client.AppController.java

License:Apache License

@Override
public void onValueChange(ValueChangeEvent<String> event) {
    String token = event.getValue();

    if (token != null) {
        if (token.equals("display")) {
            GWT.runAsync(new RunAsyncCallback() {
                public void onFailure(Throwable caught) {
                }/*from w  w w .j a  v a  2  s .c  o  m*/

                public void onSuccess() {
                    // lazily initialize our views, and keep them around to be reused
                    //
                    if (mapView == null) {
                        mapView = new MapViewImpl<NewMap>();
                    }
                    new GeoRSSPresenter(geoRSSService, eventBus, mapView).go(container);
                }
            });
        }
    }
}

From source file:es.upm.fi.dia.oeg.map4rdf.client.maplet.stats.StatisticsPresenter.java

License:Open Source License

private void refreshTimeline() {
    getDisplay().refreshTimeline();//from  w w w. j av a 2s.c o m
    getDisplay().setTimelineValueChangeHandler(new ValueChangeHandler<Year>() {
        @Override
        public void onValueChange(ValueChangeEvent<Year> event) {
            currentStatistic.getDimensions().clear();
            currentStatistic.getDimensions().add(event.getValue().getUri());
            getDisplay().clear();
            drawStatistics();

        }
    });
}

From source file:es.upm.fi.dia.oeg.map4rdf.client.widget.FacetWidget.java

License:Open Source License

public void addFacetSelectionOption(final String id, String label) {
    CheckBox checkBox = new CheckBox(label);
    checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override/*  w  w  w  .  ja  va 2 s.c  om*/
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            fireSelectionChanged(id, event.getValue());
        }
    });
    if (stylesheet != null) {
        checkBox.addStyleName(stylesheet.facetSelectionOption());
    }
    selectionOptions.put(id, checkBox);
    selectionsPanel.add(checkBox);
}

From source file:es.upm.fi.dia.oeg.map4rdf.client.widget.mapcontrol.StatisticsMapControl.java

License:Open Source License

public void showWebNMasUnoTimeLine(ArrayList<Year> annos) {
    Timeline timeline = new Timeline(annos, resources.css());
    timeline.addValueChangeHandler(new ValueChangeHandler<Year>() {
        @Override// www  . j a va 2 s  . c  o  m
        public void onValueChange(ValueChangeEvent<Year> event) {
            Window.alert("Agno elegido: " + event.getValue().getValue());
            //timeline.setCurrentValue(event.getValue().getValue(), true);
        }
    });
    timelineControl = new TimelineControl(timeline);
    getMap().addControl(timelineControl);
    getDisplay().stopProcessing();

    timeline.setCurrentValue(0, true);

}

From source file:es.upm.fi.dia.oeg.map4rdf.client.widget.mapcontrol.StatisticsMapControl.java

License:Open Source License

public void setStatistics(StatisticDefinition statistic) {
    this.statistic = statistic;
    GetStatisticYears action = new GetStatisticYears(statistic.getDataset());
    getDisplay().startProcessing();/*from  w  w w.  j a  v a  2  s .  c  om*/
    dispatchAsync.execute(action, new AsyncCallback<ListResult<Year>>() {
        @Override
        public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub
            getDisplay().stopProcessing();
        }

        public void onSuccess(ListResult<Year> result) {
            Timeline timeline = new Timeline(result.asList(), resources.css());
            timeline.addValueChangeHandler(new ValueChangeHandler<Year>() {

                @Override
                public void onValueChange(ValueChangeEvent<Year> event) {
                    StatisticsMapControl.this.statistic.getDimensions().clear();
                    StatisticsMapControl.this.statistic.getDimensions().add(event.getValue().getUri());
                    clear();
                    drawStatistics(StatisticsMapControl.this.statistic);
                }
            });
            timelineControl = new TimelineControl(timeline);
            getMap().addControl(timelineControl);

            getDisplay().stopProcessing();

            timeline.setCurrentValue(0, true);
        };
    });
}

From source file:es.upm.fi.dia.oeg.map4rdf.client.widget.Timeline.java

License:Open Source License

private void bindEvents(SliderBar slider) {
    slider.addValueChangeHandler(new ValueChangeHandler<Double>() {
        @Override//from ww  w .jav a 2 s.  com
        public void onValueChange(ValueChangeEvent<Double> event) {
            double val = event.getValue();
            double intVal = Math.floor(val);
            ValueChangeEvent.fire(Timeline.this, sortedYears.get((int) intVal));
        }
    });

}

From source file:eu.cloud4soa.frontend.widget.monitoring.client.views.gxt.DeployedApplicationsGXTViewImpl.java

License:Open Source License

private void createView() {
    setLayout(new FitLayout());

    // Panel/*from   w w  w  .j av a 2s  .c o  m*/
    ContentPanel cp = new ContentPanel();
    cp.setHeading("Deployed Applications");
    cp.setHeaderVisible(true);
    cp.setBorders(true);
    cp.setLayout(new FitLayout());
    //      cp.setHeight(height);

    // // Toolbar
    ToolBar toolBar = new ToolBar();
    toolBar.addStyleName("c4s-white-bg");
    cp.setTopComponent(toolBar);

    btnStartStop = new Button("Start/Stop");
    btnStartStop.setScale(ButtonScale.LARGE);
    btnStartStop.setIconAlign(IconAlign.BOTTOM);
    btnStartStop.setIcon(AbstractImagePrototype.create(Icons.RESOURCES.buttonPower()));
    btnStartStop.setToolTip("Start/Stop application");
    toolBar.add(btnStartStop);

    SelectionListener<ButtonEvent> sl = new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            String commandName = ce.getButton().getText();
            List<ApplicationModel> applications = grid.getSelectionModel().getSelectedItems();
            String message = "";
            C4SCommand command = null;
            if (applications == null || applications.isEmpty()) {
                message = "Please, select one deployed application";
                DialogHelper.showDialog(null, message);
            } else if (!commandName.equals(BUTTON_MONITORING_DETAILS) && applications.size() > 1) {
                message = "Please, select only one deployed application";
                DialogHelper.showDialog(null, message);
            } else {
                if (commandName.equals("Start")) {
                    message = "Do you want to start the application " + applications.get(0).getTitle() + "?";
                    command = C4SCommand.START;
                } else if (commandName.equals("Stop")) {
                    message = "Do you want to stop the application " + applications.get(0).getTitle() + "?";
                    command = C4SCommand.STOP;
                } else if (commandName.equals("Undeploy")) {
                    message = "Do you want to undeploy application " + applications.get(0).getTitle() + "?";
                    command = C4SCommand.UNDEPLOY;
                } else if (commandName.equals(BUTTON_MONITORING_DETAILS)) {
                    message = "Do you want to see monitoring details of selected applications?";
                    command = C4SCommand.SEE_MONITORING_DETAILS;
                } else if (commandName.equals(BUTTON_SLA_CONTRACT)) {
                    message = "Do you want to see the SLA contract of selected application?";
                    command = C4SCommand.SEE_SLA_CONTRACT;
                }

                if (commandName.equals(BUTTON_MONITORING_DETAILS)) {
                    showMonitoringApplicationConfirmationDialog(message, applications);
                } else if (commandName.equals(BUTTON_SLA_CONTRACT)) {
                    String slaContractId = applications.get(0).getSLAContractId();
                    showSLAContractViewConfirmationDialog(message, slaContractId);
                } else {
                    new PaaSCommandManagement().managePaaSCommand(instance, instance, message, command,
                            applications.get(0));
                }
            }
        }
    };

    btnStartStop.addListener(Events.Select, sl);

    Button btnUndeploy = new Button("Undeploy");
    btnUndeploy.setScale(ButtonScale.LARGE);
    btnUndeploy.setIconAlign(IconAlign.BOTTOM);
    btnUndeploy.setToolTip("Undeploy application");
    btnUndeploy.setIcon(AbstractImagePrototype.create(Icons.RESOURCES.buttonRemove()));
    toolBar.add(btnUndeploy);

    btnUndeploy.addListener(Events.Select, sl);

    Button btnMonitor = new Button(BUTTON_MONITORING_DETAILS);
    btnMonitor.setScale(ButtonScale.LARGE);
    btnMonitor.setIconAlign(IconAlign.BOTTOM);
    btnMonitor.setToolTip("See application monitoring details");
    btnMonitor.setIcon(AbstractImagePrototype.create(Icons.RESOURCES.buttonOscilloscope()));
    toolBar.add(btnMonitor);

    btnMonitor.addListener(Events.Select, sl);

    Button btnSLAContract = new Button(BUTTON_SLA_CONTRACT);
    btnSLAContract.setScale(ButtonScale.LARGE);
    btnSLAContract.setIconAlign(IconAlign.BOTTOM);
    btnSLAContract.setToolTip("See application SLA contract details");
    btnSLAContract.setIcon(AbstractImagePrototype.create(Icons.RESOURCES.slaContract()));
    toolBar.add(btnSLAContract);

    btnSLAContract.addListener(Events.Select, sl);

    Button btnSLAViolation = new Button(BUTTON_SLA_VIOLATION);
    btnSLAViolation.setScale(ButtonScale.LARGE);
    btnSLAViolation.setIconAlign(IconAlign.BOTTOM);
    btnSLAViolation.setToolTip("See SLA violations");
    btnSLAViolation.setIcon(AbstractImagePrototype.create(Icons.RESOURCES.slaViolation()));
    toolBar.add(btnSLAViolation);

    btnSLAViolation.addListener(Events.Select, new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            String message = "Do you want to see the SLA violations?";
            showSLAViolationViewConfirmationDialog(message);
        }

    });

    cp.setTopComponent(toolBar);

    GridCellRenderer<ApplicationModel> status = new GridCellRenderer<ApplicationModel>() {
        @Override
        public Object render(ApplicationModel model, String property, ColumnData config, int rowIndex,
                int colIndex, ListStore<ApplicationModel> store, Grid<ApplicationModel> grid) {

            return getStatusIcon(model, property);
        }

    };

    GridCellRenderer<ApplicationModel> ratingRenderer = new GridCellRenderer<ApplicationModel>() {

        @Override
        public Object render(final ApplicationModel model, String property, ColumnData config,
                final int rowIndex, final int colIndex, ListStore<ApplicationModel> store,
                Grid<ApplicationModel> grid) {

            Rating ratingWidget = new Rating(model.<Integer>get(property), 5);
            ratingWidget.addValueChangeHandler(new ValueChangeHandler() {
                @Override
                public void onValueChange(ValueChangeEvent event) {
                    GWT.log("selected: " + event.getValue());
                    //Modify rating of PaaS Offering
                    presenter.onRatingPaaSOffering(model, (Integer) event.getValue());
                }
            });
            return ratingWidget;
        }
    };

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();
    column.setId(ApplicationModel.TITLE);
    column.setHeader("Application");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId(ApplicationModel.PAAS_PROVIDER);
    column.setHeader("Provider");
    column.setWidth(100);
    configs.add(column);

    GridCellRenderer<ApplicationModel> urlRender = new GridCellRenderer<ApplicationModel>() {
        @Override
        public String render(ApplicationModel model, String property, ColumnData config, int rowIndex,
                int colIndex, ListStore<ApplicationModel> store, Grid<ApplicationModel> grid) {
            String url = (String) model.get(property);
            return "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>";
        }
    };

    column = new ColumnConfig();
    column.setId(ApplicationModel.DEPLOYMENT_URL);
    column.setHeader("URL");
    column.setWidth(100);
    column.setRenderer(urlRender);
    configs.add(column);

    column = new ColumnConfig();
    column.setId(ApplicationModel.RATING);
    column.setHeader("Rating");
    column.setWidth(100);
    column.setRenderer(ratingRenderer);
    configs.add(column);

    column = new ColumnConfig();
    column.setId(ApplicationModel.STATUS);
    column.setHeader("Status");
    column.setRenderer(status);
    column.setWidth(75);
    column.setAlignment(HorizontalAlignment.CENTER);
    configs.add(column);

    final ListStore<ApplicationModel> store = new ListStore<ApplicationModel>();
    store.add(new ApplicationStore().getApplications(lstDeployedApps));

    cm = new ColumnModel(configs);

    grid = new Grid<ApplicationModel>(store, cm);
    grid.getSelectionModel().setSelectionMode(SelectionMode.MULTI);
    grid.setStyleAttribute("borderTop", "none");
    grid.setAutoExpandColumn(ApplicationModel.TITLE);
    grid.getView().setForceFit(true);
    grid.setBorders(false);
    add(grid);

    // Getting selection
    grid.getSelectionModel().addListener(Events.SelectionChange,
            new Listener<SelectionChangedEvent<ApplicationModel>>() {

                @Override
                public void handleEvent(SelectionChangedEvent<ApplicationModel> be) {
                    if (be.getSelectedItem() == null) {
                        return;
                    }
                    Info.display("Selected application", be.getSelectedItem().getTitle());
                    boolean online = be.getSelectedItem().get(ApplicationModel.STATUS)
                            .equals(ApplicationModel.STATUS_ONLINE);
                    btnStartStop.setText(online ? "Stop" : "Start");
                    btnStartStop.setToolTip(online ? "Stop application" : "Start application");
                    btnStartStop.setIcon(online ? AbstractImagePrototype.create(Icons.RESOURCES.buttonStop())
                            : AbstractImagePrototype.create(Icons.RESOURCES.buttonPlay()));

                    //If SLA Violation shown filter violations of selected application
                    presenter.onFilterSLAViolations(be.getSelectedItem().getKey());
                }

            });

    cp.add(grid);
    add(cp);

}

From source file:eu.cloud4soa.frontend.widget.search.client.views.gxt.SearchResultGrid.java

License:Open Source License

private void createGridView(List<Offering> offerings) {
    PagingModelMemoryProxy proxy = new PagingModelMemoryProxy(offerings);

    // loader//w w  w . j  a v a  2 s. com
    final PagingLoader loader = new BasePagingLoader(proxy);
    loader.setRemoteSort(true);

    store = new ListStore<Offering>(loader);

    toolBar = new PagingToolBar(10);
    toolBar.bind(loader);
    loader.load(0, 10);

    GridCellRenderer<Offering> ratingRenderer = new GridCellRenderer<Offering>() {

        @Override
        public Object render(final Offering model, String property, ColumnData config, final int rowIndex,
                final int colIndex, ListStore<Offering> store, Grid<Offering> grid) {

            Rating rating = new Rating(model.<Integer>get(property), 5);
            rating.setReadOnly(true);
            rating.addValueChangeHandler(new ValueChangeHandler() {
                @Override
                public void onValueChange(ValueChangeEvent event) {
                    GWT.log("selected: " + event.getValue());
                }
            });
            return rating;
        }
    };

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(new ColumnConfig("name", "PaaS Offer", 200));
    columns.add(new ColumnConfig("provider", "PaaS Provider", 180));
    columns.add(new ColumnConfig("deploymentMethod", "Deployment Method", 100));
    ColumnConfig ratingConfig = new ColumnConfig("averageRating", "Rating", 100);
    ratingConfig.setRenderer(ratingRenderer);
    columns.add(ratingConfig);
    columns.add(new ColumnConfig("score", "Matching score (%)", 100));

    // See more details column.
    ColumnConfig selection = new ColumnConfig("selected", "", 40);
    GridCellRenderer<Offering> renderer = new GridCellRenderer<Offering>() {
        @Override
        public Object render(final Offering model, String property, ColumnData config, final int rowIndex,
                final int colIndex, ListStore<Offering> store, Grid<Offering> grid) {

            SelectionListener sl = new SelectionListener<ButtonEvent>() {
                @Override
                public void componentSelected(ButtonEvent ce) {
                    Info.display("Selected PaaS Offering", "<ul><li>" + model.get("name") + "</li></ul>");
                    ((SearchResultGXTViewImpl) searchResultView).showPaaSOfferingDetailsView();
                }
            };

            Button b = null;
            if (grid.getSelectionModel().getSelectedItem() != null && grid.getSelectionModel().getSelectedItem()
                    .get("name").equals(store.getAt(rowIndex).get("name"))) {
                b = new Button(" ", sl);
                b.setIcon(AbstractImagePrototype.create(Icons.RESOURCES.moreDetails()));
                b.setIconAlign(IconAlign.LEFT);
                b.setToolTip("Click for more information");
                b.setScale(ButtonScale.SMALL);
                b.setSize(32, 32);
            }
            return b;
        }
    };
    selection.setRenderer(renderer);
    columns.add(selection);

    cm = new ColumnModel(columns);

    grid = new Grid<Offering>(store, cm);
    grid.addListener(Events.RowClick, new Listener<GridEvent<Offering>>() {

        @Override
        public void handleEvent(GridEvent<Offering> be) {
            String offering = be.getGrid().getSelectionModel().getSelectedItem().getName();
            Info.display("Selected PaaS Offering", offering);
            selectedPaaSOffering = paaSofferingResults.get(be.getRowIndex());

            // Refreshing grid view to show more details button
            be.getGrid().getView().refresh(false);

            // Send Paas Offering selected event
            searchResultView.getPresenter().onPaaSOfferingSelected(selectedPaaSOffering);
        }

    });

    grid.setLoadMask(true);
    grid.setBorders(true);
    grid.setAutoExpandColumn("name");
    grid.getView().setForceFit(true);

    gridPanel.add(grid);
    gridPanel.setBottomComponent(toolBar);
}

From source file:fi.jyu.student.jatahama.onlineinquirytool.client.OnlineInquiryTool.java

License:Open Source License

@Override
public void onValueChange(ValueChangeEvent<String> event) {
    if ("welcome".equals(event.getValue())) {
        claimAnalysisPanel.setClaim(null);
        claimAnalysisPanel.updateLayout();
        claimAnalysisPanel.updateClaimTitleAndConclusionWidgets();
    } else if ("instructions".equals(event.getValue())) {
        helpPanel.center();//from w w w. ja va2s.com
        // Just to get create link working when clicking multiple times in a row
        // TODO: Check if there's a better way to do this!
        History.newItem("edit");
    }
}