Java 类com.google.gwt.user.client.ui.HasName 实例源码

项目:listmaker    文件:FormBuilder.java   
public void addFieldWithLabel(Widget w, String id, String label, String... styles)
{
    // Prepend form ID for uniqueness
    id = formId + "_" + id;
    // Create HTML DIV for each field
    FlowPanel div = new FlowPanel();
    div.getElement().setId("div_" + id);
    if (w instanceof HasName)
    {
        ((HasName) w).setName(id);
    }
    w.getElement().setId(id);
    if (label != null)
    {
        div.add(createLabel(id, label));
    }
    div.add(w);
    for (String styleName : styles)
    {
        div.addStyleName(styleName);
    }
    contentPanel.add(div);
}
项目:gwtbootstrap3    文件:InputToggleButtonGwt.java   
@Override
public <T extends UIObject & HasName> void checkName(T button) {
    final String name = "name";
    final Element label = button.getElement();
    final InputElement input = InputElement.as(label.getFirstChildElement());
    button.setName(name);
    assertEquals(name, button.getName());
    assertEquals(name, input.getName());
}
项目:LAS    文件:VariableMetadataActivity.java   
/**
 * @see com.google.gwt.event.logical.shared.SelectionHandler#onSelection(com.google.gwt.event.logical.shared.SelectionEvent)
 */
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    if ( (view != null) && (event != null) ) {
        Object source = event.getSource();
        // Only proceed if the source was from the same panel
        if ( (source != null) && (source instanceof HasName) ) {
            String sourceName = ((HasName) source).getName();
            if ( view.getName().equalsIgnoreCase(sourceName) ) {
                TextBox breadcrumbs = view.getBreadcrumbs();
                TreeItem selectedItem = event.getSelectedItem();
                if ( selectedItem != null ) {
                    String selectedItemText = selectedItem.getText();
                    // Only bother to update the bread crumbs if the
                    // user
                    // has
                    // selected an item that has actually loaded
                    if ( !selectedItemText.equalsIgnoreCase(DatasetWidget.LOADING) ) {
                        // Update bread crumbs by walking the meta data
                        // categories GUI tree already in memory
                        TreeItem parentItem = selectedItem.getParentItem();
                        if ( parentItem != null ) {
                            // First clear bread crumbs so events fire
                            // even
                            // when there is no change in
                            // breadcrumbsText
                            // characters, but set boolean fireEvents to
                            // false to avoid unnecessary event firing.
                            breadcrumbs.setValue("", false);
                            String breadcrumbsText = getBreadcrumbsText(parentItem);
                            breadcrumbs.setValue(breadcrumbsText, true);
                        }
                    }
                }
            }
        }
    }
}
项目:blogwt    文件:PropertiesPage.java   
@Override
public void onValueChange (ValueChangeEvent<String> event) {
    String name = null;
    if (event.getSource() instanceof HasName) {
        name = ((HasName) event.getSource()).getName();
    }

    if (name != null) {
        propertyLookup.get(name).value = event.getValue();
    }
}
项目:platypus-js    文件:RadioGroup.java   
public void add(HasValue<Boolean> aItem) {
    if (!grouped.contains(aItem)) {
        if (aItem instanceof HasName) {
            ((HasName) aItem).setName(groupName);
        }
        groupedHandlers.put(aItem, aItem.addValueChangeHandler(this));
        grouped.add(aItem);
    }
}
项目:platypus-js    文件:RadioGroup.java   
public boolean remove(HasValue<Boolean> aItem) {
    HandlerRegistration handler = groupedHandlers.get(aItem);
    if (handler != null) {
        handler.removeHandler();
    }
    if (aItem instanceof HasName) {
        ((HasName) aItem).setName("");
    }
    return grouped.remove(aItem);
}
项目:platypus-js    文件:RadioGroup.java   
public void clear() {
    for (HandlerRegistration handler : groupedHandlers.values()) {
        if (handler != null) {
            handler.removeHandler();
        }
    }
    groupedHandlers.clear();
    for (HasValue<Boolean> item : grouped) {
        if (item instanceof HasName) {
            ((HasName) item).setName("");
        }
    }
    grouped.clear();
}
项目:platypus-js    文件:ModelDecoratorBox.java   
@Override
public void setJsName(String aValue) {
    name = aValue;
               if(decorated instanceof HasName){
                   ((HasName)decorated).setName(aValue);
               }
}
项目:gwtbootstrap3    文件:AbstractButtonGroup.java   
/**
 * Convenience method that will set the name of all child widgets that can have a name
 *
 * @param name Name of group
 * @see #add(com.google.gwt.user.client.ui.Widget)
 */
@Override
public void setName(final String name) {
    this.name = name;

    if (name == null) {
        return;
    }

    for (final Widget w : getChildren()) {
        if (w instanceof HasName) {
            ((HasName) w).setName(name);
        }
    }
}
项目:gwtbootstrap3    文件:AbstractButtonGroup.java   
@Override
public void add(final Widget w) {
    super.add(w);

    if (name == null) {
        return;
    }

    // Add group's name to child widgets that can have a name
    if (w instanceof HasName) {
        ((HasName) w).setName(name);
    }
}
项目:LAS    文件:MultiVariableSelectorActivity.java   
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
    if ( (view != null) && (event != null) ) {
        Object source = event.getSource();
        // Only proceed if the source was from the same panel or from
        // the comparePanel
        if ( (source != null) && (source instanceof HasName) ) {
            String sourceName = ((HasName) source).getName();
            String viewName = view.getName();
            if ( ((viewName != null) && viewName.equalsIgnoreCase(sourceName)) || CONSTANTS.comparePanelName().equalsIgnoreCase(sourceName) ) { //$NON-NLS-1$
                // Get variables from the tree
                TreeItem selectedItem = event.getSelectedItem();
                if ( selectedItem != null ) {
                    Object userObject = selectedItem.getUserObject();
                    if ( (userObject != null) && (userObject instanceof VariableSerializable) ) {
                        VariableSerializable selectedVariable = (VariableSerializable) userObject;
                        // Find all siblings if any
                        Vector<VariableSerializable> variables = new Vector<VariableSerializable>();
                        // Vector<TreeItem> children = new
                        // Vector<TreeItem>();
                        int selectedIndex = 0;
                        TreeItem parent = selectedItem.getParentItem();
                        if ( parent == null ) {
                            // There are no reachable siblings without a
                            // parent, so just use the selectedVariable
                            // and leave selectedIndex == 0
                            variables.add(selectedVariable);
                            // children.add(selectedItem);
                        } else {
                            for ( int i = 0; i < parent.getChildCount(); i++ ) {
                                TreeItem child = parent.getChild(i);
                                userObject = child.getUserObject();
                                if ( (userObject != null) && (userObject instanceof VariableSerializable) ) {
                                    variables.add((VariableSerializable) userObject);
                                    // children.add(child);
                                }
                            }
                            selectedIndex = variables.indexOf(selectedVariable);
                        }
                        // Add the variables to the view
                        view.setVariables(variables, selectedIndex);
                    }
                }
            }
        }
    }
}
项目:qafe-platform    文件:LabeledTextAreaFieldWidget.java   
public String getName() {
    if (uiObject instanceof HasName){
        return ((HasName)uiObject).getName();
    }
    return null;
}
项目:qafe-platform    文件:LabeledTextAreaFieldWidget.java   
public void setName(String arg0) {
    if (uiObject instanceof HasName){
        ((HasName)uiObject).setName(arg0);
    }
}
项目:qafe-platform    文件:LabeledTextFieldWidget.java   
public String getName() {
    if (textbox instanceof HasName) {
        return ((HasName)textbox).getName();
    }   
    return null;
}
项目:qafe-platform    文件:LabeledTextFieldWidget.java   
public void setName(String arg0) {
    if (textbox instanceof HasName) {
        ((HasName)textbox).setName(arg0);
    }     
}
项目:gwtbootstrap3    文件:BaseGwt.java   
public <T extends UIObject & HasName> void checkName(T button) {
    final String name = "name";
    button.setName(name);
    assertEquals(name, button.getName());
}