-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.EventHelper;
import com.vaadin.terminal.gwt.client.EventId;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
if (BrowserInfo.get().isSafari()) {
VButton.this.setFocus(true);
}
- client.updateVariable(id, "state", true, false);
-
- // Add mouse details
- MouseEventDetails details = new MouseEventDetails(
- event.getNativeEvent());
- client.updateVariable(id, "mousedetails", details.serialize(), true);
+ client.updateVariable(id, "state", true, true);
clickPending = false;
}
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
import com.vaadin.event.ShortcutListener;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
-import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.ui.VButton;
import com.vaadin.ui.ClientWidget.LoadStyle;
import com.vaadin.ui.themes.BaseTheme;
boolean switchMode = false;
- /* Last mouse details from the last click event */
- private MouseEventDetails mouseDetails;
-
/**
* Creates a new push button. The value of the push button is false and it
* is immediate by default.
final Boolean newValue = (Boolean) variables.get("state");
final Boolean oldValue = (Boolean) getValue();
- // Handle mouse details
- if (variables.containsKey("mousedetails")) {
- mouseDetails = MouseEventDetails.deSerialize((String) variables
- .get("mousedetails"));
- }
-
if (isSwitchMode()) {
// For switch button, the event is only sent if the
*/
public class ClickEvent extends Component.Event {
- private MouseEventDetails details;
-
/**
* New instance of text change event.
*
super(source);
}
- /**
- * Event which is trigged when the button was clicked
- *
- * @param source
- * The Component that triggered the event
- * @param details
- * Additional details about the mouse event
- */
- public ClickEvent(Component source, MouseEventDetails details) {
- super(source);
- this.details = details;
- }
-
/**
* Gets the Button where the event occurred.
*
public Button getButton() {
return (Button) getSource();
}
-
- /**
- * Checks if the Alt key was down when the mouse event took place.
- *
- * @return true if Alt was down when the event occured, false otherwise
- */
- public boolean isAltKey() {
- if (details != null) {
- return details.isAltKey();
- }
- return false;
- }
-
- /**
- * Checks if the Ctrl key was down when the mouse event took place.
- *
- * @return true if Ctrl was pressed when the event occured, false
- * otherwise
- */
- public boolean isCtrlKey() {
- if (details != null) {
- return details.isCtrlKey();
- }
- return false;
- }
-
- /**
- * Checks if the Meta key was down when the mouse event took place.
- *
- * @return true if Meta was pressed when the event occured, false
- * otherwise
- */
- public boolean isMetaKey() {
- if (details != null) {
- return details.isMetaKey();
- }
- return false;
- }
-
- /**
- * Checks if the Shift key was down when the mouse event took place.
- *
- * @return true if Shift was pressed when the event occured, false
- * otherwise
- */
- public boolean isShiftKey() {
- if (details != null) {
- return details.isShiftKey();
- }
- return false;
- }
}
/**
* Emits the options change event.
*/
protected void fireClick() {
- fireEvent(new Button.ClickEvent(this, mouseDetails));
+ fireEvent(new Button.ClickEvent(this));
}
@Override