本文整理汇总了Java中com.google.gwt.text.shared.Renderer类的典型用法代码示例。如果您正苦于以下问题:Java Renderer类的具体用法?Java Renderer怎么用?Java Renderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Renderer类属于com.google.gwt.text.shared包,在下文中一共展示了Renderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NumberBox
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
protected NumberBox(AvroUiStyle style, Element element, String promptText,
final Renderer<T> renderer, final Parser<T> parser) {
super(element, renderer, parser);
sinkEvents(Event.ONPASTE);
this.style = style;
this.promptText = promptText;
this.renderer = renderer;
if (Utils.isNotBlank(promptText)) {
this.addFocusHandler(this);
this.addClickHandler(this);
setPrompts();
}
this.addKeyDownHandler(this);
this.addBlurHandler(this);
}
示例2: reset
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
protected void reset() {
if (this.type == null) {
this.type = NumberType.LONG;
}
this.setRenderer((Renderer<N>) this.type.renderer);
this.setParser((Parser<N>) this.type.parser);
this.maskHelper.reset();
if (this.signed) {
this.maskHelper.addTokenHelper(new StaticStringTokenHelper(InputNumber.NUMBER_CONSTANTS.minusSign(), true));
}
this.maskHelper.addTokenHelper(new IntegerTokenHelper(0, Integer.MIN_VALUE, Integer.MAX_VALUE, -1, "0"));
switch (this.type) {
case FLOAT:
case DOUBLE:
case BIG_DECIMAL:
this.maskHelper.addTokenHelper(new StaticStringTokenHelper(InputNumber.NUMBER_CONSTANTS.decimalSeparator(),
true, ',', '.'));
this.maskHelper.addTokenHelper(new IntegerTokenHelper(0, Integer.MIN_VALUE, Integer.MAX_VALUE, -1, "0"));
break;
default:
break;
}
}
示例3: MultiValueListBox
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
/**
* Instantiates a new MultiValueListBox.
*/
public MultiValueListBox(Renderer<T> renderer, ProvidesKey<T> keyProvider) {
this.keyProvider = keyProvider;
this.renderer = renderer;
ListBox listBox = new ListBox();
listBox.setMultipleSelect(true);
initWidget(listBox);
getListBox().addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
List<T> newValue = new ArrayList<>();
for (int i = 0; i < values.size(); i++) {
if (getListBox().isItemSelected(i)) {
newValue.add(values.get(i));
}
}
setValue(newValue, true);
}
});
}
示例4: ValueMultiListBox
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
public ValueMultiListBox(Renderer<T> renderer2, ProvidesKey<T> keyProvider2) {
this.keyProvider = keyProvider2;
this.renderer = renderer2;
initWidget(new ListBox(true));
getListBox().setVisibleItemCount(2);
getListBox().addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
ListBox lb = getListBox();
Collection<T> newValue = new ArrayList<T>();
for (int i = 0; i < values.size(); i++) {
if (lb.isItemSelected(i)) {
newValue.add(values.get(i));
}
}
setValue(newValue, true);
}
});
}
示例5: initPersonalTitle
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
private void initPersonalTitle() {
personalTitleListBox = new ValueListBox<PersonalTitle>(new Renderer<PersonalTitle>() {
@Override
public String render(PersonalTitle object) {
return object != null ? object.toString() : "";
}
@Override
public void render(PersonalTitle object, Appendable appendable)
throws IOException {
appendable.append(render(object));
}
});
List<PersonalTitle> titles = new ArrayList<PersonalTitle>();
titles.add(null);
titles.addAll(Arrays.asList(PersonalTitle.values()));
personalTitleListBox.setAcceptableValues(titles);
}
示例6: ExplicitValueBox
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
protected ExplicitValueBox(Element aElement, Renderer<T> aRenderer, Parser<T> aParser) {
super(aElement, aRenderer, aParser);
renderer = aRenderer;
parser = aParser;
addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
if (!settingValue) {
String text = ExplicitValueBox.super.getText();
setText(text);
}
}
});
}
示例7: ExtendedValueListBox
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
public ExtendedValueListBox(Renderer<T> renderer,
ProvidesKey<T> keyProvider, AvroUiStyle style, String promptText) {
super(renderer, keyProvider);
this.style = style;
this.promptText = promptText;
}
示例8: AbstractSelectionCell
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
public AbstractSelectionCell(Renderer<T> renderer) {
super(BrowserEvents.CHANGE);
if (template == null) {
template = GWT.create(Template.class);
}
this.renderer = renderer;
}
示例9: ValueSelectionCell
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
/**
* Construct a new {@link ValueSelectionCell} with the specified options.
*
* @param options the options in the cell
* @param renderer the renderer to render options in the cell
*/
public ValueSelectionCell(List<T> options, Renderer<T> renderer) {
super(BrowserEvents.CHANGE);
if (template == null) {
template = GWT.create(Template.class);
}
this.options = new ArrayList<T>(options);
this.renderer = renderer;
int index = 0;
for (T option : options) {
indexForOption.put(option, index++);
}
}
示例10: visit
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
@Override
public <A, B extends Editor> boolean visit(Context<B> context) {
Editor editor = context.getEditor();
if (editor instanceof AbstractInputChoice) {
ModelDriver<?> driver = context.getDriver();
MessageHelper messageHelper = driver.getMessageHelper();
Class<A> propertyType = null;
Path path = context.getPath();
Model<?> model = ModelUtils.resolveModel(driver.getModel(), path);
if (model instanceof ModelCollection) {
propertyType = (Class<A>) model.getLeafType();
} else {
propertyType = ModelUtils.resolveType(driver.getModel(), path);
}
if (ModelUtils.isEnumType(propertyType)) {
AbstractInputChoice inputChoice = (AbstractInputChoice) editor;
Renderer<?> renderer = new EnumRenderer<>(messageHelper);
inputChoice.setItemRenderer(renderer);
inputChoice.setItems(Lists.newArrayList(propertyType.getEnumConstants()));
if (inputChoice instanceof AbstractInputSelect) {
((AbstractInputSelect) inputChoice).setSelectionRenderer(renderer);
}
}
}
return true;
}
示例11: render
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
protected <V> String render(V value, Renderer<V> renderer) {
if (value == null) {
return this.renderNull();
}
if (renderer != null) {
return renderer.render(value);
}
return value.toString();
}
示例12: setRenderer
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
@Override
public void setRenderer(Renderer<T> renderer) {
super.setRenderer(renderer);
if (oracle.getDelegate() instanceof SimpleOracle) {
SimpleOracle<T> simpleOracle = (SimpleOracle<T>) oracle.getDelegate();
simpleOracle.setRenderer(renderer);
}
}
示例13: setRenderer
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
public void setRenderer(Renderer<T> renderer) {
this.renderer = renderer;
if (renderer != null) {
this.setText(renderer.render(this.getValue()));
}
}
示例14: getItemRenderer
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
@Override
public Renderer<T> getItemRenderer() {
return this.itemRenderer;
}
示例15: setItemRenderer
import com.google.gwt.text.shared.Renderer; //导入依赖的package包/类
@Override
public void setItemRenderer(Renderer<T> renderer) {
this.itemRenderer = renderer;
}