本文整理汇总了Java中com.vaadin.shared.MouseEventDetails类的典型用法代码示例。如果您正苦于以下问题:Java MouseEventDetails类的具体用法?Java MouseEventDetails怎么用?Java MouseEventDetails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MouseEventDetails类属于com.vaadin.shared包,在下文中一共展示了MouseEventDetails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: itemClick
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
@Override
public void itemClick(ItemClickEvent event) {
if (event.getButton() == MouseEventDetails.MouseButton.LEFT) {
Folder folder = (Folder) event.getItemId();
if (getItemClickable(folder)) {
openFolder((AbstractSearchFolder) event.getItemId());
} else if (isItemExpandable(folder)) {
Component tree = event.getComponent();
if (tree instanceof Tree) {
if (((Tree) tree).isExpanded(folder))
((Tree) tree).collapseItem(folder);
else
((Tree) tree).expandItem(folder);
}
}
}
}
示例2: MyComponentConnector
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
public MyComponentConnector() {
// To receive RPC events from server, we register ClientRpc implementation
registerRpc(MyComponentClientRpc.class, new MyComponentClientRpc() {
public void alert(String message) {
Window.alert(message);
}
});
// We choose listed for mouse clicks for the widget
getWidget().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final MouseEventDetails mouseDetails = MouseEventDetailsBuilder
.buildMouseEventDetails(event.getNativeEvent(),
getWidget().getElement());
// When the widget is clicked, the event is sent to server with ServerRpc
rpc.clicked(mouseDetails);
}
});
}
示例3: handleMouseEvent
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
private void handleMouseEvent(MouseEventDetails mouseEventDetails) {
int x = mouseEventDetails.getRelativeX();
int y = mouseEventDetails.getRelativeY();
if(mousePressed) {
scheduleExecutor();
canvas.beginPath();
canvas.moveTo(previousX, previousY);
canvas.lineTo(x, y);
canvas.stroke();
canvas.closePath();
drawer.drawLine(previousX, previousY, x, y);
}
previousX = x;
previousY = y;
}
示例4: createWidget
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
@Override
public Button createWidget() {
final Button b = GWT.create(Button.class);
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder
.buildMouseEventDetails(event.getNativeEvent(),
b.getElement());
Element e = b.getElement();
rpc.onClick(e.getPropertyString(ROW_KEY_PROPERTY),
e.getPropertyString(COLUMN_ID_PROPERTY),mouseEventDetails);
event.stopPropagation();
}
});
b.setStylePrimaryName("v-nativebutton");
return b;
}
示例5: attachClickHandler
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
protected void attachClickHandler() {
clickReg = getWidget().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//TODO: also add text selection check here!
if (getState().enabled) {
MouseEventDetails details = MouseEventDetailsBuilder
.buildMouseEventDetails(event.getNativeEvent(), getWidget()
.getElement());
event.stopPropagation();
event.preventDefault();
getRpcProxy(LabelButtonServerRpc.class).onClick(details);
}
}
});
}
示例6: init
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
/**
* dirty hack because of the convertion within {@link ClickableRenderer} of {@link ClickEvent} to {@link NativeEvent} were the
* RelativeElement get lost... before rpc-call is fired ask Widget of it's last relativeX value that should be this current onClickEvent
*/
@Override
protected void init() {
this.clickRegistration = addClickHandler(new RendererClickHandler<JsonObject>() {
@Override
public void onClick(final RendererClickEvent<JsonObject> event) {
MouseEventDetails details = MouseEventDetailsBuilder.buildMouseEventDetails(event.getNativeEvent());
// get relativeX from Widget itself
details.setRelativeX(getRenderer().getClickedBITM());
getRpcProxy(RendererClickRpc.class).click(getRowKey(event.getCell()
.getRow()), getColumnId(event.getCell()
.getColumn()), details);
}
});
}
示例7: init
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
ActiveLink link = new ActiveLink("Click Me", new ExternalResource(
"http://blog.porotype.com"));
link.addListener(new LinkActivatedListener() {
@Override
public void linkActivated(LinkActivatedEvent event) {
MouseEventDetails d = event.getMouseEventDetails();
String caption = "Link " + d.getButtonName() + "-clicked";
String msg = "Ctrl: " + d.isCtrlKey() + " Shift: "
+ d.isShiftKey() + " Alt: " + d.isAltKey() + " Meta: "
+ d.isMetaKey();
Notification.show(caption, msg, Type.WARNING_MESSAGE);
System.err.println(caption + " " + msg);
}
});
layout.addComponent(link);
}
示例8: onClick
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
public void onClick(final ClickEvent event) {
final MouseEventDetails mouseDetails = MouseEventDetailsBuilder
.buildMouseEventDetails(event.getNativeEvent(), getWidget()
.getElement());
rpc.clicked(mouseDetails);
if (!mouseDetails.isCtrlKey() && !mouseDetails.isAltKey()
&& !mouseDetails.isShiftKey() && !mouseDetails.isMetaKey()) {
// RPC gets lost if we don't delay
event.preventDefault();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
getWidget().onClick(mouseDetails);
}
});
}
}
示例9: onStateChanged
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
// Only add a mouse move handler if someone is interested in, as
// otherwise
// they would generate a large amount of server side traffic.
if (stateChangeEvent.hasPropertyChanged("listenMouseMove")
&& getState().listenMouseMove)
getWidget().addMouseMoveHandler(new MouseMoveHandler() {
@Override
public void onMouseMove(MouseMoveEvent event) {
if (getState().listenMouseMove) {
MouseEventDetails med = MouseEventDetailsBuilder
.buildMouseEventDetails(event.getNativeEvent(),
getWidget().getElement());
rpc.mouseMoved(med);
}
}
});
}
示例10: fromClickEvent
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
private static MouseEventDetails fromClickEvent(ItemClickEvent event) {
MouseEventDetails d = new MouseEventDetails();
d.setButton(event.getButton());
d.setAltKey(event.isAltKey());
d.setCtrlKey(event.isCtrlKey());
d.setShiftKey(event.isShiftKey());
d.setType(event.isDoubleClick() ? 0x00002 : 0);
d.setClientX(event.getClientX());
d.setClientY(event.getClientY());
d.setRelativeX(event.getRelativeX());
d.setRelativeY(event.getRelativeY());
return d;
}
示例11: buildStepLabel
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
/**
* Build a new label for the given step.
*
* @param step
* The step to build the label for
*
* @return The label for the step
*/
protected StepLabel buildStepLabel(Step step) {
StepLabel stepLabel = labelFactory.get();
stepLabel.setIcon(buildStepLabelIcon(step));
stepLabel.setCaption(step.getCaption());
stepLabel.setDescription(step.getDescription());
stepLabel.addLayoutClickListener(event -> {
boolean isLeftClick = event.getButton() == MouseEventDetails.MouseButton.LEFT;
if (isLeftClick && stepLabel.isClickable()) {
stepIterator.moveTo(step);
}
});
return stepLabel;
}
示例12: fireClick
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
@Override
protected void fireClick(final MouseEventDetails details) {
ConfirmDialog dialog = ConfirmDialog.show(getUI(), getConfirmWindowCaption(), getConfirmationText(), getOkCaption(),
getCancelCaption(), new Runnable() {
@Override
public void run() {
doFireClickListener(details);
}
});
dialog.getOkButton().addStyleName(confirmWindowOkButtonStyle);
}
示例13: doFireClickListener
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
protected void doFireClickListener(final MouseEventDetails details) {
ConfirmButton.super.fireClick(details);
if (clickListeners != null) {
final Button.ClickListener[] array = clickListeners.toArray(new Button.ClickListener[clickListeners.size()]);
for (Button.ClickListener l : array) {
l.buttonClick(null);
}
}
}
示例14: itemClick
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
@Override
public void itemClick(ItemClickEvent event) {
MenuItem item = (MenuItem) event.getItemId();
if (item.isMenu()) {
Component tree = event.getComponent();
if (tree instanceof Tree) {
switchExpandState((Tree) tree, item);
}
} else {
if (event.getButton() == MouseEventDetails.MouseButton.LEFT) {
tree.select(item);
openWindow(item);
}
}
}
示例15: nodeClicked
import com.vaadin.shared.MouseEventDetails; //导入依赖的package包/类
@Override
public void nodeClicked(String nodeId, MouseEventDetails mouseDetails) {
Subgraph.Node gnode = graph.getNode(nodeId);
if (gnode != null) {
fireEvent(new NodeClickEvent(VizComponent.this, gnode,
mouseDetails));
}
}