當前位置: 首頁>>代碼示例>>Java>>正文


Java HasValue類代碼示例

本文整理匯總了Java中com.google.gwt.user.client.ui.HasValue的典型用法代碼示例。如果您正苦於以下問題:Java HasValue類的具體用法?Java HasValue怎麽用?Java HasValue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HasValue類屬於com.google.gwt.user.client.ui包,在下文中一共展示了HasValue類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValidator

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
public static Validator getValidator(DataType dataType, HasValue<String> value) {
	Validator validator = null;
	switch (dataType) {
		case DATE:
			validator = new DateFormatValidator(value);
			break;

		case DOUBLE:
		case FLOAT:
			validator = new NumberValidator(value, true);
			break;
			
		case LONG:
		case INTEGER:
			validator = new NumberValidator(value, false);
			break;

		case STRING:
			break;
			
		default:
			break;
	}

	return validator;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:27,代碼來源:ValidatorFactory.java

示例2: FieldsEditor

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
public FieldsEditor(ApiService service, String key) {
  super("");

  this.service = service;
  this.key = key;
  root = new CheckBox(key.isEmpty() ? "Select all/none" : key);
  root.setValue(false);
  root.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
    @Override
    public void onValueChange(ValueChangeEvent<Boolean> event) {
      for (HasValue<Boolean> checkBox : children.values()) {
        checkBox.setValue(event.getValue(), true);
      }
    }
  });
  add(root);
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:18,代碼來源:FieldsEditor.java

示例3: getData

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
private static Object getData(UIObject ui) {
	if (ui instanceof HasValue) {
		return ((HasValue)ui).getValue();
	} else if (ui instanceof HasText) {
		return ((HasText)ui).getText();
	} else if (ui instanceof HasData) {
		return ((HasData)ui).getData();
	} else if (ui instanceof ListBox) {
		ListBox listBox = (ListBox) ui;
		if(listBox.getSelectedIndex() > 0) {
			return listBox.getValue(listBox.getSelectedIndex());
		}
	} else if (ui instanceof ValueSpinner) {
		ValueSpinner spinner = (ValueSpinner) ui;
		return spinner.getTextBox().getValue();
	}
	return null;
}
 
開發者ID:qafedev,項目名稱:qafe-platform,代碼行數:19,代碼來源:RendererHelper.java

示例4: UTCDateTimeRangeController

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
/**
 * Creates a controller that will manage the date/time range
 * consisting of 2 date/time controls and an optional
 * allDayCheckbox.
 */
public UTCDateTimeRangeController(UTCDateBox startDate, UTCTimeBox startTime, UTCDateBox endDate, UTCTimeBox endTime, HasValue<Boolean> allDayCheckbox) {
    this.startDate = startDate;
    this.startTime = startTime;
    this.endDate = endDate;
    this.endTime = endTime;
    this.allDayCheckbox = allDayCheckbox;
    updateInterval();

    // attach the event handlers
    if (allDayCheckbox != null) {
        allDayCheckbox.addValueChangeHandler(new AllDayCheckboxHandler());
    }
    
    StartDateTimeHandler startHandler = new StartDateTimeHandler();
    EndDateTimeHandler endHandler = new EndDateTimeHandler();
    
    startDate.addValueChangeHandler(startHandler);
    startTime.addValueChangeHandler(startHandler);
    
    endDate.addValueChangeHandler(endHandler);
    endTime.addValueChangeHandler(endHandler);
}
 
開發者ID:tractionsoftware,項目名稱:gwt-traction,代碼行數:28,代碼來源:UTCDateTimeRangeController.java

示例5: RegExValidator

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
public RegExValidator(final RegExValidatableWidget<?> validatableWidget, final HasValue<String> value, final boolean isMandatory,
		final boolean isMultiplePattern, final boolean isPatternValidator, final String patternDelimiter,
		final DCMARemoteServiceAsync remoteServiceAsync) {
	this._value = value;
	this.validatableWidget = validatableWidget;
	this.isMandatory = isMandatory;
	this.isMultiplePattern = isMultiplePattern;
	this.isOnlyPatternValidator = isPatternValidator;
	this.patternDelimiter = patternDelimiter;
	this.remoteService = remoteServiceAsync;
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:12,代碼來源:RegExValidator.java

示例6: onLoad

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
@Override
protected void onLoad() {
    super.onLoad();

    HandlerRegistration handlerRegistration = addClickHandler(event -> {
        // Stop propagation of event when checkbox / other elements has
        // been clicked to avoid duplicate events.
        if (Element.as(event.getNativeEvent().getEventTarget()) != getElement()) {
            if (getType() == CollectionType.CHECKBOX) {
                event.stopPropagation();
                event.preventDefault();
            }
        }
        for (Widget w : MaterialCollectionItem.this) {
            if (w instanceof MaterialCollectionSecondary) {
                for (Widget a : (MaterialCollectionSecondary) w) {
                    if (a instanceof HasValue) {
                        try {
                            @SuppressWarnings("unchecked")
                            HasValue<Boolean> cb = (HasValue<Boolean>) a;
                            if (cb.getValue()) {
                                cb.setValue(false);
                            } else {
                                cb.setValue(true);
                            }
                        } catch (ClassCastException ex) {
                            // Ignore non-boolean has value handlers.
                        }
                    }
                }
            }
        }
    });
    registerHandler(handlerRegistration);

    JsMaterialElement.initDismissableCollection();
}
 
開發者ID:GwtMaterialDesign,項目名稱:gwt-material,代碼行數:38,代碼來源:MaterialCollectionItem.java

示例7: checkValueChangeEvent

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
public static <H extends HasValueChangeHandlers & HasValue & HasEnabled & HasAttachHandlers> void checkValueChangeEvent(
        H widget, Object value, Object secondValue) {
    assertNotSame(value, secondValue);
    // Widget must be enabled before firing the event
    widget.setEnabled(true);
    assertTrue(widget.isEnabled());
    // Ensure the widget is attached to the root panel
    assertTrue(widget.isAttached());
    // Register value change handler that listens when the widget
    // set the value
    final boolean[] isValueChanged = {false};
    widget.addValueChangeHandler(event -> isValueChanged[0] = true);
    // By default setValue(boolean) will not fire the value change event.
    widget.setValue(value);
    assertEquals(value, widget.getValue());
    // Expected result : false
    assertFalse(isValueChanged[0]);
    // Calling setValue(value, fireEvents) with fireEvents set to false
    widget.setValue(secondValue, false);
    // Expected result : secondValue
    assertEquals(secondValue, widget.getValue());
    // Expected result : false
    assertFalse(isValueChanged[0]);
    // Calling setValue(value, fireEvents) with fireEvents set to true
    widget.setValue(value, true);
    // Expected result : true
    assertTrue(isValueChanged[0]);
    // Expected result : value
    assertEquals(value, widget.getValue());
}
 
開發者ID:GwtMaterialDesign,項目名稱:gwt-material,代碼行數:31,代碼來源:WidgetTestCase.java

示例8: getValue

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
/**
 * Returns this field's checked value, or if it has children, whether all its
 * children are checked.
 */
@Override
public Boolean getValue() {
  if (children.isEmpty()) {
    return root.getValue();
  }

  return Iterables.all(children.entrySet(),
      new Predicate<Map.Entry<String, HasValue<Boolean>>>() {
        @Override
        public boolean apply(Entry<String, HasValue<Boolean>> input) {
          return input.getValue().getValue();
        }
      });
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:19,代碼來源:FieldsEditor.java

示例9: setValue

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
/**
 * Sets this field's checked value, and all of its childrens' if it has any.
 */
@Override
public void setValue(Boolean value) {
  for (HasValue<Boolean> hasValue : children.values()) {
    hasValue.setValue(value);
  }
  this.root.setValue(value);
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:11,代碼來源:FieldsEditor.java

示例10: gatherForm

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
private void gatherForm(Map<String, String> aFormData, HasWidgets aContainer) {
	Iterator<Widget> widgets = aContainer.iterator();
	while (widgets.hasNext()) {
		Widget w = widgets.next();
		if (w instanceof HasValue<?> && w instanceof HasJsName) {
			String name = ((HasJsName) w).getJsName();
			Object value = ((HasValue<Object>) w).getValue();
			if (name != null && !name.isEmpty() && (value == null || value instanceof String || value instanceof Number)) {
				aFormData.put(name, value != null ? value.toString() : null);
			}
		}
		if (w instanceof HasWidgets)
			gatherForm(aFormData, (HasWidgets) w);
	}
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:16,代碼來源:PlatypusWindow.java

示例11: add

import com.google.gwt.user.client.ui.HasValue; //導入依賴的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);
	}
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:10,代碼來源:RadioGroup.java

示例12: remove

import com.google.gwt.user.client.ui.HasValue; //導入依賴的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);
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:11,代碼來源:RadioGroup.java

示例13: getChild

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
public HasPublished getChild(int i) {
	HasValue<Boolean> child = super.get(i);
	if (child instanceof HasPublished)
		return (HasPublished) child;
	else
		return null;
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:8,代碼來源:ButtonGroup.java

示例14: placeWidgetToMenu

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
private void placeWidgetToMenu(Widget aWidget, ButtonGroup aBtnGroup, String aStyleName) {
	aWidget.getElement().getStyle().setWidth(elementWidth, Style.Unit.PX);
	aWidget.getElement().getStyle().setHeight(elementHeight, Style.Unit.PX);
	if (aStyleName != null && !aStyleName.isEmpty()) {
		aWidget.addStyleName(aStyleName);
	}
	if (aBtnGroup != null) {
		if (aWidget instanceof HasValue) {
			aBtnGroup.add((HasValue<Boolean>) aWidget);
		}
	}
	toolBar.add(aWidget);
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:14,代碼來源:PlatypusHtmlEditor.java

示例15: setValue

import com.google.gwt.user.client.ui.HasValue; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void setValue(final T pvalue, final boolean pfireEvents) {
  if (this.contents.getWidget() instanceof TakesValue<?>) {
    this.clearErrors();
    if (this.contents.getWidget() instanceof HasValue<?>) {
      ((HasValue<T>) this.contents.getWidget()).setValue(pvalue, pfireEvents);
    } else {
      ((TakesValue<T>) this.contents.getWidget()).setValue(pvalue);
    }
  }
}
 
開發者ID:ManfredTremmel,項目名稱:gwt-bean-validators,代碼行數:13,代碼來源:AbstractDecorator.java


注:本文中的com.google.gwt.user.client.ui.HasValue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。