本文整理汇总了Java中com.vaadin.shared.util.SharedUtil类的典型用法代码示例。如果您正苦于以下问题:Java SharedUtil类的具体用法?Java SharedUtil怎么用?Java SharedUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SharedUtil类属于com.vaadin.shared.util包,在下文中一共展示了SharedUtil类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createComponent
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
public Optional<Component> createComponent(Field field) {
Class<?> classToTest = field.getType();
while (classToTest != null) {
List<Pair<Predicate<Field>, Function<Field, Component>>> candidates = builders.get(classToTest);
if (candidates != null) {
Optional<Pair<Predicate<Field>, Function<Field, Component>>> match = candidates.stream()
.filter(e -> e.getFirst().test(field)).findFirst();
if (match.isPresent()) {
log.log(Level.INFO, "Fould build rule for field=<{0}> using type={1}",
new Object[] { field, classToTest });
return Optional.of(match.get().getSecond().apply(field));
}
}
log.log(Level.INFO, "No build rule for field=<{0}> with type=<{1}>", new Object[] { field, classToTest });
classToTest = classToTest.getSuperclass();
}
log.log(Level.INFO, "No match for field=<{1}> with type=<{2}>, generating a text field",
new Object[] { field, field.getType() });
return Optional.of(new TextField(SharedUtil.camelCaseToHumanFriendly(field.getName())));
}
示例2: equals
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ComboBoxMultiselectSuggestion)) {
return false;
}
ComboBoxMultiselectSuggestion other = (ComboBoxMultiselectSuggestion) obj;
if (this.key == null && other.key != null || this.key != null && !this.key.equals(other.key)) {
return false;
}
if (this.caption == null && other.caption != null
|| this.caption != null && !this.caption.equals(other.caption)) {
return false;
}
if (!SharedUtil.equals(this.untranslatedIconUri, other.untranslatedIconUri)) {
return false;
}
return SharedUtil.equals(this.style, other.style);
}
示例3: updateTextFromDataSource
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
private final void updateTextFromDataSource()
{
if (dataSource == null)
{
return;
}
// Update the internal value from the data source
final String newValue = getDataSourceValue();
if (SharedUtil.equals(newValue, getState(false).text))
{
return;
}
getState().text = newValue;
}
示例4: updateValueFromDataSource
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
/**
* Update component value using data source value
*/
private void updateValueFromDataSource() {
// Update the internal value from the data source
T newConvertedValue = getDataSourceValue();
if (!SharedUtil.equals(newConvertedValue, value)) {
value = newConvertedValue;
// update internal component
updateValue(value);
// fire value change
fireValueChange(value);
}
}
示例5: EGrid
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
public EGrid(BasicBinder<T> binder, Class<T> type) {
this.genericType = type;
getEditor().setBinder(new BinderAdapter<T>(binder, type));
binder.getBindings().stream().forEach(e -> {
e.getProperty().ifPresent(f -> {
int beginIndex = f.lastIndexOf('.');
String propertyName = f.substring(beginIndex == -1 ? 0 : beginIndex + 1);
Column<T, ?> col = addColumn(e.getGetter()).setCaption(SharedUtil.camelCaseToHumanFriendly(propertyName));
col.setEditorBinding(e);
});
});
}
示例6: onStateChanged
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
CalendarState state = getState();
VCalendar widget = getWidget();
// Enable or disable the forward and backward navigation buttons
widget.setForwardNavigationEnabled(hasEventListener(CalendarEventId.FORWARD));
widget.setBackwardNavigationEnabled(hasEventListener(CalendarEventId.BACKWARD));
widget.set24HFormat(state.format24H);
widget.setDayNames(state.dayNames);
widget.setMonthNames(state.monthNames);
widget.setFirstDayNumber(state.firstVisibleDayOfWeek);
widget.setLastDayNumber(state.lastVisibleDayOfWeek);
widget.setFirstHourOfTheDay(state.firstHourOfDay);
widget.setLastHourOfTheDay(state.lastHourOfDay);
widget.setDisabled(!state.enabled);
widget.setRangeSelectAllowed(hasEventListener(CalendarEventId.RANGESELECT));
widget.setRangeMoveAllowed(hasEventListener(CalendarEventId.ITEM_MOVE));
widget.setItemMoveAllowed(hasEventListener(CalendarEventId.ITEM_MOVE));
widget.setItemResizeAllowed(hasEventListener(CalendarEventId.ITEM_RESIZE));
widget.setItemCaptionAsHtml(state.itemCaptionAsHtml);
CalendarState.ItemSortOrder oldOrder = getWidget().getSortOrder();
if (!SharedUtil.equals(oldOrder, getState().itemSortOrder)) {
getWidget().setSortOrder(getState().itemSortOrder);
}
updateView();
updateSizes();
registerEventToolTips(state.items);
updateActionMap(state.actions);
}
示例7: resolveTranslationKey
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
@Override
public String resolveTranslationKey(String translationKey) {
if ("true".equals(translationKey)) {
return "yep";
} else if ("false".equals(translationKey)) {
return "nope";
} else if ("this.is.static.text".equals(translationKey)) {
return "Static footer text";
}
return SharedUtil.propertyIdToHumanFriendly(translationKey);
}
示例8: getPropertyHeader
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
protected String getPropertyHeader(String propertyName) {
String header = propertyToHeader.get(propertyName);
if (header == null) {
header = SharedUtil.propertyIdToHumanFriendly(propertyName);
}
return header;
}
示例9: setSource
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
@Override
public void setSource(Resource resource) {
if (SharedUtil.equals(this.resource, resource)) {
return;
}
updateValue(resource);
}
示例10: createCaptionByPropertyId
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
public String createCaptionByPropertyId(Object propertyId) {
if (hasResourceBundle()) {
String propertyIdString = propertyId.toString();
if (resourceBundle.containsKey(propertyIdString)) {
return resourceBundle.getString(propertyIdString);
}
}
return SharedUtil.propertyIdToHumanFriendly(propertyId);
}
示例11: setSignature
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
/**
* Set signature current signature value.
* @param signature Signature
* @param repaintIsNotNeeded Repaint is not needed
*/
public void setSignature(String signature, boolean repaintIsNotNeeded) {
String oldSignature = this.signature;
if (!SharedUtil.equals(oldSignature, signature)) {
this.signature = signature;
if (!repaintIsNotNeeded) {
updateSignature();
}
}
}
示例12: nextString
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
String nextString(boolean capitalize) {
if (++this.stringCount >= strings.length) {
this.stringCount = 0;
}
return capitalize ? SharedUtil.capitalize(strings[this.stringCount]) : strings[this.stringCount];
}
示例13: updateFromUIDL
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
@Override
public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
getWidget().client = client;
getWidget().id = uidl.getId();
if (uidl.hasAttribute("fontName")) {
RichTextArea.FontSize fontSize = null;
if (uidl.hasAttribute("fontSize")) {
int fontSizeValue = uidl.getIntAttribute("fontSize");
for (RichTextArea.FontSize fontSizesConstant : fontSizesConstants) {
if (fontSizesConstant.getNumber() == fontSizeValue) {
fontSize = fontSizesConstant;
}
}
}
getWidget().setFont(uidl.getStringAttribute("fontName"), fontSize);
}
if (uidl.hasAttribute("insertHtml")) {
getWidget().insertHtml(uidl.getStringAttribute("insertHtml"));
}
if (uidl.hasVariable("text")) {
String newValue = uidl.getStringVariable("text");
if (!SharedUtil.equals(newValue, cachedValue)) {
getWidget().setValue(newValue);
cachedValue = newValue;
}
}
if (!isRealUpdate(uidl)) {
return;
}
getWidget().setEnabled(isEnabled());
getWidget().setReadOnly(isReadOnly());
getWidget().immediate = getState().immediate;
int newMaxLength = uidl.hasAttribute("maxLength") ? uidl
.getIntAttribute("maxLength") : -1;
if (newMaxLength >= 0) {
if (getWidget().maxLength == -1) {
getWidget().keyPressHandler = getWidget().rta
.addKeyPressHandler(getWidget());
}
getWidget().maxLength = newMaxLength;
} else if (getWidget().maxLength != -1) {
getWidget().getElement().setAttribute("maxlength", "");
getWidget().maxLength = -1;
getWidget().keyPressHandler.removeHandler();
}
if (uidl.hasAttribute("selectAll")) {
getWidget().selectAll();
}
}
示例14: createCaptionByPropertyId
import com.vaadin.shared.util.SharedUtil; //导入依赖的package包/类
/**
* Create caption from propertyId
*
* Caveat: internally uses the FieldBinder from the Table;
* but it requires the adaptor to be a TableAdaptor!
*
* TODO: needs work for Grid
*
*/
protected String createCaptionByPropertyId(Object propertyId) {
if (getAdaptor() instanceof TableAdaptor) {
return getAdaptor().getFieldBinder().getFieldFactory().createCaptionByPropertyId(propertyId);
}
return SharedUtil.propertyIdToHumanFriendly(propertyId);
}