本文整理汇总了Java中com.google.gwt.user.client.ui.HasName类的典型用法代码示例。如果您正苦于以下问题:Java HasName类的具体用法?Java HasName怎么用?Java HasName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HasName类属于com.google.gwt.user.client.ui包,在下文中一共展示了HasName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFieldWithLabel
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
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);
}
示例2: checkName
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
@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());
}
示例3: onSelection
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
/**
* @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);
}
}
}
}
}
}
}
示例4: onValueChange
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
@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();
}
}
示例5: add
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
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);
}
}
示例6: remove
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
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);
}
示例7: clear
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
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();
}
示例8: setJsName
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
@Override
public void setJsName(String aValue) {
name = aValue;
if(decorated instanceof HasName){
((HasName)decorated).setName(aValue);
}
}
示例9: setName
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
/**
* 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);
}
}
}
示例10: add
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
@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);
}
}
示例11: onSelection
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
@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);
}
}
}
}
}
}
示例12: getName
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
public String getName() {
if (uiObject instanceof HasName){
return ((HasName)uiObject).getName();
}
return null;
}
示例13: setName
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
public void setName(String arg0) {
if (uiObject instanceof HasName){
((HasName)uiObject).setName(arg0);
}
}
示例14: getName
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
public String getName() {
if (textbox instanceof HasName) {
return ((HasName)textbox).getName();
}
return null;
}
示例15: setName
import com.google.gwt.user.client.ui.HasName; //导入依赖的package包/类
public void setName(String arg0) {
if (textbox instanceof HasName) {
((HasName)textbox).setName(arg0);
}
}