Skip to content

Commit

Permalink
Fix indentations
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Kerola committed Feb 18, 2017
1 parent 4276fd9 commit 454fbc1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public interface PopupVisibilityListener extends Serializable {

Method popupVisibilityMethod = ReflectTools.findMethod(
PopupVisibilityListener.class, "popupVisibilityChange",
PopupVisibilityEvent.class);
PopupVisibilityEvent.class);

/**
* Pass to {@link PopupButton.PopupVisibilityEvent} to start listening
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,41 +151,41 @@ public void onPreviewNativeEvent(NativePreviewEvent event) {
Element target = Element
.as(event.getNativeEvent().getEventTarget());
switch (event.getTypeInt()) {
case Event.ONCLICK:
if (getWidget().isOrHasChildOfButton(target)) {
if (getState().popupVisible && getState().buttonClickTogglesPopupVisibility) {
getWidget().sync();
rpc.setPopupVisible(false);
case Event.ONCLICK:
if (getWidget().isOrHasChildOfButton(target)) {
if (getState().popupVisible && getState().buttonClickTogglesPopupVisibility) {
getWidget().sync();
rpc.setPopupVisible(false);
}
}
}
break;
case Event.ONMOUSEDOWN:
if (!getWidget().isOrHasChildOfPopup(target)
&& !getWidget().isOrHasChildOfConsole(target)
&& !getWidget().isOrHasChildOfButton(target)
&& getState().closePopupOnOutsideClick) {
break;
case Event.ONMOUSEDOWN:
if (!getWidget().isOrHasChildOfPopup(target)
&& !getWidget().isOrHasChildOfConsole(target)
&& !getWidget().isOrHasChildOfButton(target)
&& getState().closePopupOnOutsideClick) {
if (getState().popupVisible) {
getWidget().sync();
rpc.setPopupVisible(false);
}
}
break;
case Event.ONKEYPRESS:
if (getWidget().isOrHasChildOfPopup(target)) {
// Catch children that use keyboard, so we can unfocus
// them
// when
// hiding
getWidget().addToActiveChildren(target);
}
break;
case Event.ONKEYDOWN:
if (getState().popupVisible) {
getWidget().sync();
rpc.setPopupVisible(false);
getWidget().onKeyDownOnVisiblePopup(event.getNativeEvent(), this);
}
}
break;
case Event.ONKEYPRESS:
if (getWidget().isOrHasChildOfPopup(target)) {
// Catch children that use keyboard, so we can unfocus
// them
// when
// hiding
getWidget().addToActiveChildren(target);
}
break;
case Event.ONKEYDOWN:
if (getState().popupVisible) {
getWidget().onKeyDownOnVisiblePopup(event.getNativeEvent(), this);
}
break;
default:
break;
break;
default:
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

public class PopupButtonState extends ButtonState {

public boolean popupVisible;
public Connector popupPositionConnector;
public boolean popupVisible;
public Connector popupPositionConnector;

@DelegateToWidget
public int direction = 0;
Expand Down
16 changes: 8 additions & 8 deletions demo/src/main/java/org/vaadin/hene/popupbutton/DefaultView.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ public DefaultView() {
listenerButton.setCaption("VisibilityListener");
listenerButton.addPopupVisibilityListener(event -> {
String msg = "Popup closed";
if (event.getPopupButton().isPopupVisible()) {
msg = "Popup opened";
b.setClickShortcut(ShortcutAction.KeyCode.ENTER);
} else {
b.removeClickShortcut();
}
Notification.show(msg);
});
if (event.getPopupButton().isPopupVisible()) {
msg = "Popup opened";
b.setClickShortcut(ShortcutAction.KeyCode.ENTER);
} else {
b.removeClickShortcut();
}
Notification.show(msg);
});
horizontalLayout.addComponent(listenerButton);
listenerButton.addClickListener(event -> {
if (!listenerButton.isButtonClickTogglesPopupVisibility()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ShortcutActionTestView() {
VerticalLayout popupLayout = new VerticalLayout();
popupLayout.addComponent(new TextField());
Button button = new Button("Click me!", event ->
Notification.show("Hello World!")
Notification.show("Hello World!")
);

// When the popup is open pressing the enter should show "Hello World!"
Expand Down

0 comments on commit 454fbc1

Please sign in to comment.