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:org.artificer.ui.client.local.pages.details.CustomPropertiesPanel.java

License:Apache License

/**
 * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean)
 *///from w  w  w .  java2  s . c  om
@Override
public void setValue(Map<String, String> value, boolean fireEvents) {
    this.value = new HashMap<String, String>(value);
    clear();
    if (value == null || value.isEmpty()) {
        // Put something here?  "No Properties found..." ?
    } else {
        Set<String> keys = new TreeSet<String>(value.keySet());
        for (final String propName : keys) {
            String propValue = value.get(propName);
            Label propLabel = new Label(propName + ":");
            propLabel.setStyleName("sramp-meta-data-section-label");
            CustomPropertyEditableInlineLabel propValueWidget = propValueLabelFactory.get();
            propValueWidget.addValueChangeHandler(new ValueChangeHandler<String>() {
                @Override
                public void onValueChange(ValueChangeEvent<String> event) {
                    Map<String, String> newValue = new HashMap<String, String>(
                            CustomPropertiesPanel.this.value);
                    String val = event.getValue();
                    if (val == null) {
                        newValue.remove(propName);
                    } else {
                        newValue.put(propName, val);
                    }
                    setValue(newValue, true);
                }
            });
            propValueWidget.setValue(propValue);
            propValueWidget.setStyleName("sramp-meta-data-section-value");
            Label clearFix = new Label();
            clearFix.setStyleName("clearfix");
            add(propLabel);
            add(propValueWidget);
            add(clearFix);
        }
    }
    if (fireEvents) {
        ValueChangeEvent.fire(this, this.value);
    }
}

From source file:org.artificer.ui.client.local.pages.ontologies.OntologyEditorTier.java

License:Apache License

/**
 * Called when the user clicks the 'Add Node' button.
 *///w w w . j a  v  a2 s.c o  m
protected void onAddItem() {
    AddOntologyNodeDialog dialog = addOntologyNodeDialogFactory.get();
    dialog.addValueChangeHandler(new ValueChangeHandler<OntologyClassBean>() {
        @Override
        public void onValueChange(ValueChangeEvent<OntologyClassBean> event) {
            OntologyClassBean bean = event.getValue();
            if (validator.canAddClass(bean)) {
                value.add(bean);
                OntologyEditorTierItem item = createItem(bean);
                items.add(item);
                ValueChangeEvent.fire(OntologyEditorTier.this, OntologyEditorTier.this.value);
            }
        }
    });
    dialog.show();
}

From source file:org.artificer.ui.client.local.pages.ontologies.OntologyEditorTier.java

License:Apache License

/**
 * Creates an item from the given ontology class bean.
 * @param ontologyClass// w ww  . java2 s  .  c o  m
 */
private OntologyEditorTierItem createItem(OntologyClassBean ontologyClass) {
    final OntologyEditorTierItem item = itemFactory.get();
    item.addValueChangeHandler(new ValueChangeHandler<OntologyClassBean>() {
        @Override
        public void onValueChange(ValueChangeEvent<OntologyClassBean> event) {
            // If the event value is null, that means we should remove the item.
            if (event.getValue() == null) {
                removeItem(item);
            }
            ValueChangeEvent.fire(OntologyEditorTier.this, OntologyEditorTier.this.value);
        }
    });
    item.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            selectTierItem(item);
        }
    });
    item.setValue(ontologyClass);
    return item;
}

From source file:org.artificer.ui.client.local.pages.ontologies.OntologyEditorTierItem.java

License:Apache License

/**
 * Called when the user clicks the Edit action.
 *//*  w ww  .  j  a  v  a  2  s  . c om*/
protected void onEdit() {
    EditOntologyNodeDialog dialog = dialogFactory.get();
    dialog.init(getValue());
    dialog.addValueChangeHandler(new ValueChangeHandler<OntologyClassBean>() {
        @Override
        public void onValueChange(ValueChangeEvent<OntologyClassBean> event) {
            OntologyClassBean updatedValue = event.getValue();
            OntologyClassBean currentValue = getValue();
            currentValue.setId(updatedValue.getId());
            currentValue.setLabel(updatedValue.getLabel());
            currentValue.setComment(updatedValue.getComment());
            label.setText(createLabel(currentValue));
            ValueChangeEvent.fire(OntologyEditorTierItem.this, currentValue);
        }
    });
    dialog.show();
}

From source file:org.artificer.ui.client.local.pages.ontologies.OntologySummaryPanel.java

License:Apache License

/**
 * Creates an item from the given ontology class bean.
 * @param ontologyClass/*from  w  w  w  . j  a va  2  s .com*/
 */
private OntologySummaryPanelItem createItem(OntologySummaryBean ontologyClass) {
    final OntologySummaryPanelItem item = itemFactory.get();
    item.addValueChangeHandler(new ValueChangeHandler<OntologySummaryBean>() {
        @Override
        public void onValueChange(ValueChangeEvent<OntologySummaryBean> event) {
            // If the event value is null, that means we should remove the item.
            if (event.getValue() == null) {
                removeItem(item);
            }
            ValueChangeEvent.fire(OntologySummaryPanel.this, OntologySummaryPanel.this.value);
        }
    });
    item.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            selectItem(item);
        }
    });
    item.setValue(ontologyClass);
    return item;
}

From source file:org.artificer.ui.client.local.widgets.common.EditableInlineLabel.java

License:Apache License

/**
 * Called when the user clicks the Edit action.
 *//* w ww.j  a va2  s  .  com*/
protected void onEditProperty() {
    EditCustomPropertyDialog dialog = editDialogFactory.get();
    if (this.getDialogLabel() != null)
        dialog.setLabel(getDialogLabel());
    if (this.getDialogTitle() != null) {
        dialog.setTitle(getDialogTitle());
    }
    dialog.setValue(getValue());
    dialog.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            setValue(event.getValue(), true);
        }
    });
    dialog.show();
}

From source file:org.bonitasoft.console.client.controller.AbstractViewController.java

License:Open Source License

/**
 * History management./*from  w w w  .  j  av  a2s.c o  m*/
 */
public void onValueChange(ValueChangeEvent<String> aEvent) {
    if (aEvent.getValue() == null) {
        displayDefaultViewAccordingToPrivileges();
    } else if (myCurrentTokenName == null
            || (!(aEvent.getValue().equals(myCurrentTokenName) || (aEvent.getValue()
                    .equals(myCurrentTokenName + ConsoleConstants.TOKEN_SEPARATOR + myCurrentTokenParam))))) {
        // Update the view only in case of different token.
        // Calling twice the same URL will NOT make the UI to be refreshed.
        updateViewAccordingToToken(aEvent.getValue());
    }
}

From source file:org.bonitasoft.console.client.view.cases.AbstractCaseEditorWidget.java

License:Open Source License

/**
 * @return/*from w  w  w  .  j  a va  2  s .co  m*/
 */
private Widget buildModeChooser() {
    if (myModeSelector == null) {
        myModeSelector = new FlowPanel();
        myRecapModeRB = new RadioButton(MODE_SELECTOR, constants.caseRecapModeSelector());
        myRecapModeRB.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

            public void onValueChange(ValueChangeEvent<Boolean> aEvent) {
                if (aEvent.getValue()) {
                    myMode = Mode.OVERVIEW;
                    update();
                }
            }
        });

        myDetailModeRB = new RadioButton(MODE_SELECTOR, constants.caseStepModeSelector());
        myDetailModeRB.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

            public void onValueChange(ValueChangeEvent<Boolean> aEvent) {
                if (aEvent.getValue()) {
                    myMode = Mode.DETAILS;
                    update();
                }
            }
        });
        myModeSelector.add(myDetailModeRB);
        myModeSelector.add(myRecapModeRB);
        switch (myMode) {
        case OVERVIEW:
            myRecapModeRB.setValue(true, false);
            break;
        case DETAILS:
            myDetailModeRB.setValue(true, false);
            break;
        default:
            Window.alert("AbstractCaseEditor.buildModeChooser(): Mode not yet supported!");
            break;
        }
    }
    myModeSelector.setStylePrimaryName("bos_mode_chooser");
    return myModeSelector;
}

From source file:org.bonitasoft.console.client.view.NavigationLinkWidget.java

License:Open Source License

public void onValueChange(ValueChangeEvent<String> aEvent) {
    // History token has changed.
    setSelected((aEvent.getValue() != null && aEvent.getValue().equals(myHitoryTokenValue)));
}

From source file:org.bonitasoft.console.client.view.processes.ProcessEditor.java

License:Open Source License

/**
 * Default constructor./*from www  . j a  v  a2s. co  m*/
 */
public ProcessEditor(ProcessDataSource aProcessDataSource, CategoryDataSource aCategoryDataSource) {
    super();
    myProcessDataSource = aProcessDataSource;
    myCategoryDataSource = aCategoryDataSource;

    /* Application URL */
    myXPURLRB.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> aEvent) {
            if (aEvent.getValue()) {
                myURLTB.setValue(ProcessDataSource.DEFAULT_APPLICATION_URL, true);
                myURLTB.setEnabled(false);
                mySaveURLButton.setVisible(!myURLTB.getValue().equals(myItem.getApplicationUrl()));
            }
        }
    });
    myLocalWebAppURLRB.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> aEvent) {
            if (aEvent.getValue()) {
                myURLTB.setValue(myProcessDataSource.buildWebAppURL(myItem), true);
                myURLTB.setEnabled(false);
                mySaveURLButton.setVisible(!myURLTB.getValue().equals(myItem.getApplicationUrl()));
            }
        }
    });
    myExternalWebAppURLRB.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> aEvent) {
            if (aEvent.getValue()) {
                myURLTB.setValue(myItem.getApplicationUrl(), true);
                myURLTB.setEnabled(true);
                mySaveURLButton.setVisible(false);
            }
        }
    });

    /* Pattern */
    myPatternTB.addKeyUpHandler(new KeyUpHandler() {
        public void onKeyUp(KeyUpEvent aEvent) {
            mySaveButton.setVisible(!myPatternTB.getValue().equals(myItem.getCustomDescriptionDefinition())
                    && (myItem.getCustomDescriptionDefinition() != null
                            || !ProcessDataSource.DEFAULT_CASEDESCRIPTION_PATTERN
                                    .equals(myPatternTB.getValue())));
        }
    });
    /* Categories */
    myCategoriesListEditorView = new CategoriesListEditorView(myCategoryDataSource);
    myCategoriesListEditorView.addAddHandler(new AddItemHandler<Category>() {

        public void addItemRequested(Category anItem) {
            if (anItem != null) {
                final BonitaProcess theNewProcess = new BonitaProcess();
                theNewProcess.updateItem(myItem);
                final List<String> theCategories = new ArrayList<String>();
                if (myItem.getCategoriesName() != null && !myItem.getCategoriesName().isEmpty()) {
                    theCategories.addAll(myItem.getCategoriesName());
                }
                theCategories.add(anItem.getName());
                theNewProcess.setCategoriesName(theCategories);
                myProcessDataSource.updateItem(myItem.getUUID(), theNewProcess, myProcessUpdateHandler);
            }
        }
    });
    myCategoriesListEditorView.addRemoveHandler(new RemoveItemsHandler<Category>() {

        public void removeItemsRequested(Collection<Category> anItemSelection) {
            if (anItemSelection != null && !anItemSelection.isEmpty()) {
                final BonitaProcess theNewProcess = new BonitaProcess();
                theNewProcess.updateItem(myItem);
                final List<String> theCategories = new ArrayList<String>();
                if (myItem.getCategoriesName() != null && !myItem.getCategoriesName().isEmpty()) {
                    theCategories.addAll(myItem.getCategoriesName());
                }
                for (Category theCategory : anItemSelection) {
                    theCategories.remove(theCategory.getName());
                }
                theNewProcess.setCategoriesName(theCategories);
                myProcessDataSource.updateItem(myItem.getUUID(), theNewProcess, myProcessUpdateHandler);
            }
        }
    });

    myOuterPanel = new FlowPanel();
    myOuterPanel.setStylePrimaryName("bos_process_editor");

    buildItemDefinitonPanel();
    buildItemApplicationURLEditor();
    buildItemPatternEditor();
    buildCategoriesEditor();

    myBackToLabel.setStyleName(CSSClassManager.LINK_LABEL);
    myBackToLabel.setText(patterns.backToDestination(constants.processes()));
    myBackToLabel.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent aArg0) {
            redirectUserToProcessList();
        }
    });

    myOuterPanel.add(myBackToLabel);
    myOuterPanel.add(myIDCardPanelWrapper);
    myOuterPanel.add(myURLEditorWrapper);
    myOuterPanel.add(myPatternEditorWrapper);
    myOuterPanel.add(myCategoriesEditorWrapper);

    initWidget(myOuterPanel);
}