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:com.google.testing.testify.risk.frontend.client.view.impl.CapabilitiesViewImpl.java

License:Apache License

/**
 * Constructs a CapabilitiesViewImpl object.
 *///w  w w.j a  v a 2  s .c o  m
public CapabilitiesViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    capabilitiesGrid.addValueChangeHandler(new ValueChangeHandler<Pair<Component, Attribute>>() {
        @Override
        public void onValueChange(ValueChangeEvent<Pair<Component, Attribute>> event) {
            selectedIntersection = event.getValue();
            newCapabilityName.setText("");
            tryToPopulateCapabilitiesPanel();
        }
    });

    capabilitiesPanel.addWidgetsReorderedHandler(new WidgetsReorderedHandler() {
        @Override
        public void onWidgetsReordered(WidgetsReorderedEvent event) {
            if (presenter != null) {
                List<Long> ids = Lists.newArrayList();
                for (Widget w : event.getWidgetOrdering()) {
                    ids.add(((EditCapabilityWidget) w).getCapabilityId());
                }

                presenter.reorderCapabilities(ids);
            }
        }
    });

    newCapabilityName.getElement().setAttribute("placeholder", "Add new capability...");
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilitiesViewImpl.java

License:Apache License

/**
 * Populates the capabilities panel with capabilities widgets.  This requires data already be
 * loaded, so it will not show the panel if all data has not been loaded.
 *//*  w w w  . j a  v a2 s.  c  om*/
private void tryToPopulateCapabilitiesPanel() {
    if (selectedIntersection != null && attributes != null && components != null && capabilities != null) {
        Component component = selectedIntersection.getFirst();
        Attribute attribute = selectedIntersection.getSecond();

        capabilitiesContainer.setVisible(true);
        capabilitiesContainerTitle.setText(component.getName() + " is " + attribute.getName());

        List<EditCapabilityWidget> widgets = Lists.newArrayList();
        for (final Capability capability : capabilities) {
            // If we're interested in this capability (it matches our current filter).
            if (capability.getComponentId() == component.getComponentId()
                    && capability.getAttributeId() == attribute.getAttributeId()) {
                // Create and populate a capability widget for this capability.
                final EditCapabilityWidget widget = new EditCapabilityWidget(capability);
                widget.addValueChangeHandler(new ValueChangeHandler<Capability>() {
                    @Override
                    public void onValueChange(ValueChangeEvent<Capability> event) {
                        if (event.getValue() == null) {
                            // Since the value is null, we'll just use the old value to grab the ID.
                            removeCapability(capability);
                        } else {
                            updateCapability(event.getValue());
                            widget.showSaved();
                        }
                    }
                });
                widget.setComponents(components);
                widget.setAttributes(attributes);
                widget.setLabelSuggestions(projectLabels);
                if (isEditable) {
                    widget.makeEditable();
                }
                widgets.add(widget);
            }
        }

        capabilitiesPanel.setWidgets(widgets, new Function<EditCapabilityWidget, Widget>() {
            @Override
            public Widget apply(EditCapabilityWidget input) {
                return input.getCapabilityGripper();
            }
        });
    } else {
        capabilitiesContainer.setVisible(false);
    }
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilityDetailsViewImpl.java

License:Apache License

@SuppressWarnings("unchecked")
@Override/* w ww  .j ava  2 s  .co m*/
public void refresh() {
    // Don't re-draw until all data has successfully loaded.
    if (attributes != null && components != null && capability != null && bugs != null && tests != null
            && checkins != null) {
        splitData(tests, otherTests, capabilityTests);
        splitData(bugs, otherBugs, capabilityBugs);
        splitData(checkins, otherCheckins, capabilityCheckins);
        capabilityWidget = new EditCapabilityWidget(capability);
        capabilityWidget.setLabelSuggestions(projectLabels);
        capabilityWidget.setAttributes(attributes);
        capabilityWidget.setComponents(components);
        capabilityWidget.disableDelete();
        if (isEditable) {
            capabilityWidget.makeEditable();
        }
        capabilityWidget.expand();
        capabilityWidget.addValueChangeHandler(new ValueChangeHandler<Capability>() {
            @Override
            public void onValueChange(ValueChangeEvent<Capability> event) {
                capability = event.getValue();
                presenter.updateCapability(capability);
                refresh();
                capabilityWidget.showSaved();
            }
        });
        detailsSection.clear();
        detailsSection.add(capabilityWidget);
        updateTestSection();
        updateBugSection();
        updateCheckinsSection();
        detailsSection.setHeaderText(HEADER_TEXT + capability.getName());
    }
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.ComponentViewImpl.java

License:Apache License

/** Wires renaming the Component in the UI to the backing presenter. */
@UiHandler("componentName")
protected void onComponentNameChanged(ValueChangeEvent<String> event) {
    if (presenter != null) {
        if (event.getValue().length() == 0) {
            NotificationUtil.displayErrorMessage("Invalid name for Component.");
            presenter.refreshView();/*from   ww w . j a  v a 2 s . c  o m*/
        } else {
            presenter.onRename(event.getValue());
        }
    }
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.KnownRiskViewImpl.java

License:Apache License

public KnownRiskViewImpl() {
    String introText = "This shows the Total Risk to your application, taking into account any Risk Sources "
            + "as well as Mitigation Sources that are checked below.";
    setPageText("Known Risk", introText);
    sourcesPanel.addStyleName("tty-RiskSourcesPanel");
    contentPanel.add(sourcesPanel);// w ww.jav a  2s . co m
    this.content.add(contentPanel);

    addValueChangeHandler(new ValueChangeHandler<Pair<Integer, Integer>>() {
        @Override
        public void onValueChange(ValueChangeEvent<Pair<Integer, Integer>> event) {
            CapabilityIntersectionData cellData = getDataForCell(event.getValue().first,
                    event.getValue().second);
            bottomContent.clear();
            bottomContent.setWidget(createBottomWidget(cellData));
        }
    });
}

From source file:com.google.testing.testify.risk.frontend.client.view.widgets.EditCapabilityWidget.java

License:Apache License

private void createLabel(final AccLabel label) {
    final LabelWidget widget = new LabelWidget(label.getLabelText());
    widget.setLabelSuggestions(labelSuggestions);
    widget.setEditable(isEditable);/*from   w w w  .j  a  v a2  s. c om*/
    widget.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() == null) {
                labelsPanel.remove(widget);
                capability.removeLabel(label);
            } else {
                label.setLabelText(event.getValue());
            }
        }
    });
    labelsPanel.add(widget);
}

From source file:com.google.testing.testify.risk.frontend.client.view.widgets.EditCapabilityWidget.java

License:Apache License

private void addBlankLabel() {
    final String newText = "new label";
    addNewLabel = new LabelWidget(newText, true);
    addNewLabel.setLabelSuggestions(labelSuggestions);
    addNewLabel.setEditable(true);/*from  www  .j a  va2s.  c  o  m*/
    addNewLabel.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            labelsPanel.remove(addNewLabel);
            AccLabel label = capability.addLabel(event.getValue());
            createLabel(label);
            addBlankLabel();
        }
    });
    addNewLabel.setVisible(isEditable);
    labelsPanel.add(addNewLabel);
}

From source file:com.googlecode.gflot.client.PlotWithInteractiveLegend.java

License:Open Source License

private void addSeriesToLegend(final SeriesHandler handler) {
    LegendItem item = createLegendItem();
    item.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override//from  w w  w  .  j  ava 2 s.  c  o m
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            handler.setVisible(event.getValue());
            plot.redraw();
        }
    });
    legend.put(handler, item);
    legendPanel.add(item);
}

From source file:com.googlecode.mgwt.examples.showcase.client.activities.slider.SliderActivity.java

License:Apache License

@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
    super.start(panel, eventBus);
    final SliderView view = clientFactory.getSliderView();

    view.getHeader().setText("Slider");

    addHandlerRegistration(view.getSliderValue().addValueChangeHandler(new ValueChangeHandler<Integer>() {

        @Override//from   w w w . ja  v  a2  s  . c o  m
        public void onValueChange(ValueChangeEvent<Integer> event) {
            view.getTextField().setText("" + event.getValue());
        }
    }));

    panel.setWidget(view);
}

From source file:com.googlecode.mgwt.mvp.client.history.HTML5HistorianLegacyImpl.java

License:Apache License

@Override
public void onValueChange(ValueChangeEvent<String> event) {
    eventBus.fireEvent(new PopStateEvent(event.getValue(), Window.getTitle(), Window.Location.getHref()));
}