本文整理汇总了Java中com.vaadin.client.VConsole类的典型用法代码示例。如果您正苦于以下问题:Java VConsole类的具体用法?Java VConsole怎么用?Java VConsole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VConsole类属于com.vaadin.client包,在下文中一共展示了VConsole类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onBrowserEvent
import com.vaadin.client.VConsole; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (fastClickAt != null && event.getTypeInt() == Event.ONCLICK
&& (new Date().getTime() - fastClickAt.getTime()) < IGNORE_SIMULATED_CLICKS_THRESHOLD) {
VConsole.log("Ignored simulated event fired by old ios or android "
+ (new Date().getTime() - fastClickAt.getTime()));
fastClickAt = null;
return;
}
super.onBrowserEvent(event);
}
开发者ID:vaadin,项目名称:touchkit,代码行数:12,代码来源:TouchButton.java
示例2: onStateChanged
import com.vaadin.client.VConsole; //导入依赖的package包/类
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
getWidget().setButtonsVisible(getState().showButtons);
int numberOfValues = getState().values.size();
getWidget().setValueAmount(numberOfValues);
for (int i = 0; i < numberOfValues; ++i) {
getWidget().setValuePresentation(i, getState().values.get(i),
getState().valuesInHTML);
}
if (getState().currentValue != null) {
getWidget().setValue(getState().currentValue);
} else {
VConsole.error("Current value missing");
}
}
开发者ID:alump,项目名称:Picker,代码行数:21,代码来源:PickerConnector.java
示例3: setValuePresentation
import com.vaadin.client.VConsole; //导入依赖的package包/类
/**
* Define presentation for given value
*
* @param index
* Index of value
* @param presentation
* Presentation of value
* @param isHTML
* Is content safe HTML (true), or plain text (false)
*/
public void setValuePresentation(int index, String presentation,
boolean isHTML) {
try {
Element element = valueElements.get(index);
if (presentation == null || presentation.isEmpty()) {
element.setInnerHTML(" ");
} else {
if (isHTML) {
element.setInnerHTML(presentation);
} else {
element.setInnerText(presentation);
}
}
} catch (IndexOutOfBoundsException e) {
VConsole.error("Failed to get value presentation");
}
}
开发者ID:alump,项目名称:Picker,代码行数:29,代码来源:GwtPicker.java
示例4: stringToDate
import com.vaadin.client.VConsole; //导入依赖的package包/类
/**
* Convert string value from input field to Date
*
* @param string
* String value of input field
* @return Date value or null if failure
*/
private Date stringToDate(String string) {
Date date = null;
try {
date = getDateParser().stringToDate(string);
// break;
} catch (Exception e) {
// Doesn't matter
}
// }
if (date == null) {
VConsole.error("Failed to parse: " + string);
}
return date;
}
开发者ID:vaadin,项目名称:touchkit,代码行数:26,代码来源:DatePicker.java
示例5: onChange
import com.vaadin.client.VConsole; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public void onChange(ChangeEvent event) {
if (!text.getText().equals("")) {
try {
String enteredDate = text.getText();
setDate(getDateTimeService().parseDate(enteredDate,
getFormatString(), lenient));
if (lenient) {
// If date value was leniently parsed, normalize text
// presentation.
// FIXME: Add a description/example here of when this is
// needed
text.setValue(
getDateTimeService().formatDate(getDate(),
getFormatString()), false);
}
// remove possibly added invalid value indication
removeStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME);
} catch (final Exception e) {
VConsole.log(e);
addStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME);
setDate(null);
}
} else {
setDate(null);
// remove possibly added invalid value indication
removeStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME);
}
}
开发者ID:vaadin,项目名称:grid-renderers-collection-addon,代码行数:37,代码来源:VMyPopupCalendar.java
示例6: setValue
import com.vaadin.client.VConsole; //导入依赖的package包/类
/**
* Change value of picker
*
* @param index
* New index to be selected
* @param move
* If picker should scroll to given position
* @param fire
* If value change should be fired. If null it will be fired if
* value has changed.
*/
protected void setValue(int index, boolean move, Boolean fire) {
try {
boolean doFire = (currentValue == null || currentValue != index);
if (fire != null) {
doFire = fire;
}
currentValue = index;
if (move) {
Element element = valueElements.get(currentValue);
double elementTop = element.getOffsetTop();
double elementHeight = element.getClientHeight();
double scrollerHeight = outerScrollElement.getClientHeight();
int scrollTop = (int) Math.round(scrollerHeight / 2
- elementHeight / 2 - elementTop);
setTransitionMode(TransitionMode.STEPPING);
setScrollTop(scrollTop, true);
}
updateCurrentValueStyles();
if (doFire) {
ValueChangeEvent.fire(this, currentValue);
}
} catch (IndexOutOfBoundsException e) {
VConsole.error("Failed to set value");
}
}
开发者ID:alump,项目名称:Picker,代码行数:42,代码来源:GwtPicker.java
示例7: dragStart
import com.vaadin.client.VConsole; //导入依赖的package包/类
protected void dragStart(HumanInputEvent event) {
NativeEvent ne = event.getNativeEvent();
VConsole.log("Drag start" + ne.getType());
if (!dragging && np != null && isEnabled()) {
dragging = true;
touchDrag = Event.as(ne).getTypeInt() == Event.ONTOUCHSTART;
dragstartX = Util.getTouchOrMouseClientX(ne);
dragstartY = Util.getTouchOrMouseClientY(ne);
if (!BrowserInfo.get().isTouchDevice()) {
// avoid drag start on images
// FIXME shouln't be this way, but disables dragstart on images
// in demo with desktop browsers and this way makes development
// easier
Element el = ne.getEventTarget().cast();
String msg = el.getParentElement().getClassName();
if (msg.contains("embedded")) {
ne.preventDefault();
}
}
new Timer() {
@Override
public void run() {
// Swipe must start soon or drag start will be ignored
if(!swiping) {
dragging = false;
}
}
}.schedule(200);;
}
}
开发者ID:vaadin,项目名称:touchkit,代码行数:31,代码来源:VSwipeView.java
示例8: dragEnd
import com.vaadin.client.VConsole; //导入依赖的package包/类
protected void dragEnd(HumanInputEvent event) {
if (dragging) {
Event.releaseCapture(getElement());
VConsole.log("Drag end");
dragging = false;
if (swiping) {
if (np != null) {
NativeEvent ne = event.getNativeEvent();
int x = Util.getTouchOrMouseClientX(ne);
int deltaX = x - dragstartX;
VConsole.log("Speed" + lastSpeed);
if (np.getPreviousView() != null
&& (deltaX > getOffsetWidth() / 2 || lastSpeed > SPEED_THRESHOLD)) {
// navigate backward
np.navigateBackward();
if (swipeListener != null) {
swipeListener.onSwipeBack();
}
} else if (np.getNextView() != null
&& (deltaX < -getOffsetWidth() / 2 || (lastSpeed < -SPEED_THRESHOLD))) {
// navigate forward
np.navigateForward();
if (swipeListener != null) {
swipeListener.onSwipeForward();
}
} else {
np.setHorizontalOffset(0, true);
}
}
swiping = false;
}
}
}
开发者ID:vaadin,项目名称:touchkit,代码行数:34,代码来源:VSwipeView.java
示例9: debug
import com.vaadin.client.VConsole; //导入依赖的package包/类
private void debug(String string) {
if (this.enableDebug) {
VConsole.error(string);
}
}
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:6,代码来源:VComboBoxMultiselect.java
示例10: init
import com.vaadin.client.VConsole; //导入依赖的package包/类
@Override
protected void init() {
super.init();
getWidget().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (!getWidget().isEnabled()) {
return;
}
VNavigationManager panel = getWidget().findNavigationPanel();
if (panel != null) {
if (getTargetWidget() != null) {
if (getTargetWidget().getParent() == panel) {
panel.setCurrentWidget(getTargetWidget());
} else {
NavigationManagerConnector navigationManager;
ServerConnector parent2 = getParent();
while (parent2 != null
&& !(parent2 instanceof NavigationManagerConnector)) {
parent2 = parent2.getParent();
}
navigationManager = (NavigationManagerConnector) parent2;
AbstractComponentConnector previousComponent = (AbstractComponentConnector) navigationManager
.getState().getPreviousComponent();
AbstractComponentConnector nextComponent = (AbstractComponentConnector) navigationManager
.getState().getNextComponent();
if (previousComponent != null
&& getState().getTargetView()
.getConnectorId() == previousComponent
.getConnectorId()) {
// See #11436 && #11437
// VConsole.error("Ehh, equal with previous based on identifiers, but widget is different"
// + (getTargetWidget() !=
// previousComponent.getWidget()));
// get target widget widget via hierarchy
panel.setCurrentWidget(previousComponent
.getWidget());
} else if (nextComponent != null
&& getState().getTargetView()
.getConnectorId() == nextComponent
.getConnectorId()) {
// See #11436 && #11437
// VConsole.error("Ehh!, equal with next based on identifiers, but widget is different"
// + (getTargetWidget() !=
// nextComponent.getWidget()));
panel.setCurrentWidget(nextComponent
.getWidget());
} else {
panel.setNextWidget(getTargetWidget());
panel.navigateForward();
}
}
} else {
VConsole.error("Placeholder navigation..");
panel.navigateToPlaceholder(getPlaceHolderCaption());
}
}
}
});
}
开发者ID:vaadin,项目名称:touchkit,代码行数:66,代码来源:NavigationButtonConnector.java
示例11: dragMove
import com.vaadin.client.VConsole; //导入依赖的package包/类
protected void dragMove(HumanInputEvent event) {
if (np != null) {
NativeEvent ne = event.getNativeEvent();
if (touchDrag && Event.as(ne).getTypeInt() != Event.ONTOUCHMOVE) {
return;
}
int x = Util.getTouchOrMouseClientX(ne);
int y = Util.getTouchOrMouseClientY(ne);
long time = new Date().getTime();
// screens per second
double screenwidths = (x - lastX) / (double) getOffsetWidth();
double seconds = (time - lastTs) / 100d;
lastSpeed = screenwidths / seconds;
lastX = x;
lastTs = time;
int deltaX = x - dragstartX;
if (swiping) {
VConsole.log("Swipe move " + deltaX);
np.setHorizontalOffset(deltaX, false);
ne.preventDefault(); // prevent page scroll
} else if (dragging) {
Event.setCapture(getElement());
int dragY = dragstartY - y;
if (Math.abs(deltaX / (double) dragY) > 2) {
swiping = true;
np.setHorizontalOffset(deltaX, false);
ne.preventDefault(); // prevent page scroll
}
if (BrowserInfo.get().requiresTouchScrollDelegate()) {
if (Math.abs(deltaX / (double) dragY) < 0.5) {
if (Event.as(event.getNativeEvent()).getTypeInt() == Event.ONTOUCHMOVE) {
/*
* We'll "lazyly" activate touchScrollDelegate if
* the direction is enough down.
*/
dragStartEvent.setNativeEvent(event
.getNativeEvent());
touchScrollDelegate.onTouchStart(dragStartEvent);
VConsole.log("Lazy started");
dragging = false;
}
}
}
}
}
}
开发者ID:vaadin,项目名称:touchkit,代码行数:47,代码来源:VSwipeView.java
注:本文中的com.vaadin.client.VConsole类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论