当前位置: 首页>>代码示例>>Java>>正文


Java HasText类代码示例

本文整理汇总了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);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:18,代码来源:WebTable.java

示例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;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:27,代码来源:TablePanel.java

示例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());
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:17,代码来源:WidgetEditorCell.java

示例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;
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:19,代码来源:RendererHelper.java

示例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));
		}
	}
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:17,代码来源:UpdateModelExecute.java

示例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;
	}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:20,代码来源:RendererHelper.java

示例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;
}
 
开发者ID:Rise-Vision,项目名称:rva,代码行数:24,代码来源:FormValidatorWidget.java

示例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;
}
 
开发者ID:Rise-Vision,项目名称:rva,代码行数:18,代码来源:FormValidatorWidget.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:FlowForm.java

示例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;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:10,代码来源:SimpleForm.java

示例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);
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:15,代码来源:UniTimeWidget.java

示例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;
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:14,代码来源:UrlValidator.java

示例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"));
}
 
开发者ID:BenDol,项目名称:Databind,代码行数:29,代码来源:PlatformSpecificGwt.java

示例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() : "");
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:16,代码来源:RenderedEditorCell.java

示例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));
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:30,代码来源:DefaultUiReader.java


注:本文中的com.google.gwt.user.client.ui.HasText类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。