本文整理汇总了Java中com.google.gwt.user.client.ui.HasText类的典型用法代码示例。如果您正苦于以下问题:Java HasText类的具体用法?Java HasText怎么用?Java HasText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HasText类属于com.google.gwt.user.client.ui包,在下文中一共展示了HasText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LockCell
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public LockCell(boolean check, String text, String ariaLabel) {
super(null);
if (CONSTANTS.listOfClassesUseLockIcon()) {
iCheck = new AriaToggleButton(RESOURCES.locked(), RESOURCES.unlocked());
} else {
iCheck = new AriaCheckBox();
}
if (text != null)
((HasText)iCheck).setText(text);
iCheck.setValue(check);
((HasClickHandlers)iCheck).addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
event.stopPropagation();
}
});
if (ariaLabel != null) setAriaLabel(ariaLabel);
}
示例2: addToolButton
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public Widget addToolButton(final GeneralCommand cmd, boolean alignRight) {
final FocusWidget btn = new Button(cmd.getLabel());
updateHighlighted(btn, cmd);
btn.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent ev) {
cmd.execute();
}
});
cmd.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent pce) {
if (pce.getPropertyName().equals(GeneralCommand.PROP_TITLE)) {
if (btn instanceof HasText) {
((HasText) btn).setText(String.valueOf(pce.getNewValue()));
}
} else if (pce.getPropertyName().equals(GeneralCommand.PROP_HIGHLIGHT)) {
updateHighlighted(btn, cmd);
}
}
});
if (!StringUtils.isEmpty(cmd.getShortDesc())) {
btn.setTitle(cmd.getShortDesc());
}
addToolButton(btn, alignRight);
return btn;
}
示例3: setEditor
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public void setEditor(Widget aEditor) {
editor = aEditor;
if (editor == null || ((editor instanceof HasValue<?>) && (editor instanceof HasText))) {
valueHost = (HasValue<C>) editor;
} else {
throw new IllegalArgumentException("Editor must implement interfaces HasValue<?> and HasText");
}
if (editor instanceof Focusable) {
focusHost = (Focusable) editor;
focusHost.setTabIndex(1);
}
if (editor != null){
CommonResources.INSTANCE.commons().ensureInjected();
editor.getElement().addClassName(CommonResources.INSTANCE.commons().borderSized());
}
}
示例4: getData
import com.google.gwt.user.client.ui.HasText; //导入依赖的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;
}
示例5: updateChecksum
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
private void updateChecksum(UIObject uiObject, DataMap dataMap) {
UIObject component = getComponentByName(uiObject, DataContainerGVO.QAFE_CHECKSUM);
if (component != null) {
int checksum = 0;
for (Map.Entry<String, DataContainerGVO> field : dataMap.entrySet()) {
if (!isMetaData(field.getKey())) {
Object value = field.getValue().createType();
checksum += QAMLUtil.calculateChecksum(field.getKey(), value);
}
}
if (component instanceof HasText) {
HasText hasText = (HasText)component;
hasText.setText(String.valueOf(checksum));
}
}
}
示例6: getData
import com.google.gwt.user.client.ui.HasText; //导入依赖的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;
}
示例7: validate
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public boolean validate(){
boolean result = true;
clear();
for (FormValidatorInfo formValidator : formValidatorList) {
if (formValidator.getValidationType().equals(FormValidatorInfo.urlValidator)) {
result = validateItemUrl(formValidator) && result;
}
else {
if (formValidator.getUiElement() instanceof CheckBox) {
result = validate(((CheckBox)formValidator.getUiElement()).getValue(), formValidator.getUiElementName(), formValidator.getValidationType(), formValidator.isCustomMessage()) && result;
}
else if (formValidator.getUiElement() instanceof RiseListBox) {
result = validate(((RiseListBox)formValidator.getUiElement()).getSelectedValue(), formValidator.getUiElementName(), formValidator.getValidationType(), formValidator.isCustomMessage()) && result;
}
else if (formValidator.getUiElement() instanceof HasText) {
result = validate(((HasText)formValidator.getUiElement()).getText(), formValidator.getUiElementName(), formValidator.getValidationType(), formValidator.isCustomMessage()) && result;
}
}
}
return result;
}
示例8: validateItemRequired
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
private boolean validateItemRequired(FormValidatorInfo formValidator){
boolean result = true;
if (formValidator.getUiElement() instanceof HasText)
result = !((HasText)formValidator.getUiElement()).getText().isEmpty();
else if (formValidator.getUiElement() instanceof HasValue<?>)
result = (((HasValue<?>)formValidator.getUiElement()).getValue() != null);
if (!result) {
if (!formValidator.isCustomMessage())
addErrorMessage("* " + formValidator.getUiElementName() + " is a required field.");
else
addErrorMessage(formValidator.getUiElementName());
}
return result;
}
示例9: getCell
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public int getCell(String text) {
for (int i = 0; i < getWidgetCount(); i++) {
Widget w = getWidget(i);
if ("header-cell".equals(w.getStylePrimaryName()) && w instanceof HasText && text.equals(((HasText)w).getText())) {
return 1 + i;
}
}
return -1;
}
示例10: getRow
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public int getRow(String text) {
for (int row = 0; row < getRowCount(); row ++) {
if (getCellCount(row) > 1) {
Widget w = getWidget(row, 0);
if (w instanceof HasText && text.equals(((HasText)w).getText())) return row;
}
}
return -1;
}
示例11: setText
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public void setText(String html) {
if (iReadOnly == null) {
iReadOnly = new P("label");
iReadOnly.setVisible(!getWidget().isVisible());
if (iPrint != null)
iReadOnly.addStyleName("unitime-NoPrint");
insert(iReadOnly, 1);
}
if (iReadOnly instanceof HasHTML) {
((HasHTML)iReadOnly).setHTML(html);
} else if (iReadOnly instanceof HasText) {
((HasText)iReadOnly).setText(html);
}
}
示例12: validate
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
public static boolean validate(String url, HasText errorWidget) {
if(url != null && url.trim().length() > 0) {
try {
UrlParser.parse(url.trim());
return true;
} catch(Exception e) {
if(errorWidget != null) {
errorWidget.setText(e.getMessage());
}
}
}
return false;
}
示例13: processDataAdapter
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
@Override
public void processDataAdapter(Object object, Object context, String property, Class<?> srcType,
DataAdapterInfo res) {
// try to guess the HasValue type
res.setDataType(Object.class);
if (object instanceof HasText) {
res.setDataType(String.class);
}
String debugString = "";
// try to find a converter if dataType does not match srcType
Class<?> dataType = res.getDataType();
if (srcType != null && dataType != null && dataType != srcType && srcType != Property.class) {
// try to find a converter, if not : fail
res.setConverter(DefaultConverters.findConverter(srcType, dataType));
if (res.getConverter() == null) {
debugString = "[ERROR: Cannot find converter from " + srcType + " to " + dataType + "]";
} else {
debugString = "[" + srcType.getSimpleName() + ">" + dataType.getSimpleName() + "] " + debugString;
}
}
debugString += "\"" + property + ".$HasValue\"";
res.setDebugString(debugString);
res.setAdapter(new CompositePropertyAdapter(context, property + ".$HasValue"));
}
示例14: renderCell
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
protected void renderCell(Context context, T value, SafeHtmlBuilder sb) {
if (editor != null) {
String display = null;
T oldValue = ((HasValue<T>) editor).getValue();
((HasValue<T>) editor).setValue(value);
try {
display = ((HasText) editor).getText();
} finally {
((HasValue<T>) editor).setValue(oldValue);
}
sb.appendEscaped(display != null ? display : "");
} else {
sb.appendEscaped(value != null ? value.toString() : "");
}
}
示例15: readImageParagraph
import com.google.gwt.user.client.ui.HasText; //导入依赖的package包/类
@Override
public void readImageParagraph(Element anElement, final UIObject aImageParagraph) throws Exception {
if (Utils.hasAttribute(anElement, "i", "icon") && aImageParagraph instanceof HasImageResource) {
String iconImage = Utils.getAttribute(anElement, "i", "icon", null);
PlatypusImageResource.load(iconImage, new CallbackAdapter<ImageResource, String>() {
@Override
protected void doWork(ImageResource aResult) throws Exception {
((HasImageResource) aImageParagraph).setImageResource(aResult);
}
@Override
public void onFailure(String reason) {
Logger.getLogger(PlatypusWindow.class.getName()).log(Level.SEVERE, "Factory failed to load button icon. " + reason);
}
});
}
if (Utils.hasAttribute(anElement, "tx", "text") && aImageParagraph instanceof HasText) {
((HasText) aImageParagraph).setText(Utils.getAttribute(anElement, "tx", "text", null));
}
if (aImageParagraph instanceof HasImageParagraph) {
HasImageParagraph hip = (HasImageParagraph) aImageParagraph;
hip.setHorizontalAlignment(Utils.getIntegerAttribute(anElement, "ha", "horizontalAlignment",
aImageParagraph instanceof ImageButton || aImageParagraph instanceof DropDownButton ? HasImageParagraph.CENTER : HasImageParagraph.LEFT));
hip.setVerticalAlignment(Utils.getIntegerAttribute(anElement, "va", "verticalAlignment", HasImageParagraph.CENTER));
hip.setIconTextGap(Utils.getIntegerAttribute(anElement, "itg", "iconTextGap", 4));
hip.setHorizontalTextPosition(Utils.getIntegerAttribute(anElement, "htp", "horizontalTextPosition", HasImageParagraph.RIGHT));
hip.setVerticalTextPosition(Utils.getIntegerAttribute(anElement, "vtp", "verticalTextPosition", HasImageParagraph.CENTER));
}
}