mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-16 01:01:02 +00:00
Replaced css class based state verification to a data attribute based
approach
This commit is contained in:
1 parent
63333e5cbe
commit
1428a836cc
3 files changed
+13
-8
No files matched your search
-1
@@ -33,7 +33,6 @@ public class SAPHeaderWithAuthentication extends SAPHeader {
|
||||
rightWithAuthentication.addStyleName(res.css().header_right_wrapper());
|
||||
|
||||
Anchor authenticationMenu = new Anchor();
|
||||
authenticationMenu.ensureDebugId("authenticationMenu");
|
||||
authenticationMenu.addStyleName(res.css().usermanagement_icon());
|
||||
rightWithAuthentication.add(authenticationMenu);
|
||||
authenticationMenuView = new AuthenticationMenuViewImpl(authenticationMenu, res.css().usermanagement_loggedin(), res.css().usermanagement_open());
|
||||
|
||||
+10
@@ -1,5 +1,6 @@
|
||||
package com.sap.sse.security.ui.authentication.view;
|
||||
|
||||
import com.google.gwt.debug.client.DebugInfo;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
@@ -35,6 +36,7 @@ public class AuthenticationMenuViewImpl implements AuthenticationMenuView {
|
||||
presenter.toggleFlyout();
|
||||
}
|
||||
});
|
||||
this.anchor.ensureDebugId("authenticationMenu");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,11 +52,19 @@ public class AuthenticationMenuViewImpl implements AuthenticationMenuView {
|
||||
@Override
|
||||
public void setAuthenticated(boolean authenticated) {
|
||||
anchor.setStyleName(loggedInStyle, authenticated);
|
||||
setDebugDataAttribute("data-auth", authenticated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOpen(boolean open) {
|
||||
anchor.setStyleName(openStyle, open);
|
||||
setDebugDataAttribute("data-open", open);
|
||||
}
|
||||
|
||||
private void setDebugDataAttribute(String name, boolean value) {
|
||||
if (DebugInfo.isDebugIdEnabled()) {
|
||||
anchor.getElement().setAttribute(name, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user