You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/05/01 07:56:11 UTC
[5/5] isis git commit: ISIS-1603: enables tabbing to checkboxes.
ISIS-1603: enables tabbing to checkboxes.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5278ba07
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5278ba07
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5278ba07
Branch: refs/heads/master
Commit: 5278ba07da087268fef14ff97bae7df2c1e72873
Parents: 19987fb
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon May 1 08:54:12 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon May 1 08:54:12 2017 +0100
----------------------------------------------------------------------
.../scalars/primitive/BooleanPanel.java | 32 +++++++++++++-------
.../ui/pages/jquery.isis.wicket.viewer.js | 2 +-
2 files changed, 22 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/5278ba07/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
index 2deb00b..3579cac 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/primitive/BooleanPanel.java
@@ -37,20 +37,13 @@ import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkboxx.CheckBoxX;
import de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkboxx.CheckBoxXConfig;
+import de.agilecoders.wicket.jquery.Key;
/**
* Panel for rendering scalars of type {@link Boolean} or <tt>boolean</tt>.
*/
public class BooleanPanel extends ScalarPanelAbstract2 {
- private static final CheckBoxXConfig THREE_STATE_CONFIG = new CheckBoxXConfig()
- .withSize(CheckBoxXConfig.Sizes.xs)
- .withEnclosedLabel(false)
- .withIconChecked("<i class='fa fa-fw fa-check'></i>")
- .withIconNull("<i class='fa fa-fw fa-square'></i>");
-
- private static final CheckBoxXConfig TWO_STATE_CONFIG = new CheckBoxXConfig(THREE_STATE_CONFIG).withThreeState(false);
-
private static final long serialVersionUID = 1L;
private CheckBoxX checkBox;
@@ -111,6 +104,9 @@ public class BooleanPanel extends ScalarPanelAbstract2 {
}
private CheckBoxX createCheckBox(final String id) {
+
+ final CheckBoxXConfig config = configFor(getModel().isRequired());
+
final CheckBoxX checkBox = new CheckBoxX(id, new Model<Boolean>() {
private static final long serialVersionUID = 1L;
@@ -129,9 +125,7 @@ public class BooleanPanel extends ScalarPanelAbstract2 {
}) {
@Override
public CheckBoxXConfig getConfig() {
- return BooleanPanel.this.getModel().isRequired()
- ? TWO_STATE_CONFIG
- : THREE_STATE_CONFIG;
+ return config;
}
};
checkBox.setOutputMarkupId(true);
@@ -149,6 +143,22 @@ public class BooleanPanel extends ScalarPanelAbstract2 {
return checkBox;
}
+ private static CheckBoxXConfig configFor(final boolean required) {
+ final CheckBoxXConfig config = new CheckBoxXConfig() {
+ {
+ // so can tab to the checkbox
+ // not part of the API, so have to use this object initializer
+ put(new Key<String>("tabindex"), "0");
+ }
+ };
+ return config
+ .withSize(CheckBoxXConfig.Sizes.xs)
+ .withEnclosedLabel(false)
+ .withIconChecked("<i class='fa fa-fw fa-check'></i>")
+ .withIconNull("<i class='fa fa-fw fa-square'></i>")
+ .withThreeState(!required);
+ }
+
@Override
protected void onBeforeRenderWhenEnabled() {
super.onBeforeRenderWhenEnabled();
http://git-wip-us.apache.org/repos/asf/isis/blob/5278ba07/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
index 1bd0c35..01401d3 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
@@ -101,7 +101,7 @@ $(function() {
Wicket.Event.subscribe(Isis.Topic.FOCUS_FIRST_PARAMETER, function(jqEvent, modalWindowId) {
setTimeout(function() {
- $('#'+modalWindowId).find('.inputFormTable.parameters').find('input,textarea,select').filter(':visible:first').focus();
+ $('#'+modalWindowId).find('.inputFormTable.parameters').find('input,textarea,select,div.cbx').filter(':visible:first').focus();
}, 0);
});