You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2017/05/26 14:04:29 UTC
syncope git commit: [SYNCOPE-1081] fix onlick event handling on data
tables
Repository: syncope
Updated Branches:
refs/heads/master ca0fcf1b7 -> 7e0d67750
[SYNCOPE-1081] fix onlick event handling on data tables
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7e0d6775
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7e0d6775
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7e0d6775
Branch: refs/heads/master
Commit: 7e0d6775047d2bf66fa9978f4a5385ab3f5b45fb
Parents: ca0fcf1
Author: fmartelli <fa...@gmail.com>
Authored: Fri May 26 16:02:25 2017 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Fri May 26 16:04:13 2017 +0200
----------------------------------------------------------------------
.../console/panels/AjaxDataTablePanel.java | 12 ++++++
.../data/table/AjaxFallbackDataTable.java | 43 +++++++++++++++++++-
2 files changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/7e0d6775/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
index c2098b2..9204aa1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
@@ -46,10 +46,13 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.CheckGroup;
+import org.apache.wicket.markup.html.form.CheckGroupSelector;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.util.visit.IVisit;
+import org.apache.wicket.util.visit.IVisitor;
public final class AjaxDataTablePanel<T extends Serializable, S> extends DataTablePanel<T, S> {
@@ -203,6 +206,15 @@ public final class AjaxDataTablePanel<T extends Serializable, S> extends DataTab
@Override
protected void onUpdate(final AjaxRequestTarget target) {
+ group.visitChildren(
+ CheckGroupSelector.class, new IVisitor<CheckGroupSelector, List<CheckGroupSelector>>() {
+
+ @Override
+ public void component(final CheckGroupSelector t, final IVisit<List<CheckGroupSelector>> ivisit) {
+ target.focusComponent(t);
+ ivisit.stop();
+ }
+ });
}
});
bulkActionForm.add(group);
http://git-wip-us.apache.org/repos/asf/syncope/blob/7e0d6775/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
index 15c6a0d..b8bc02f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
@@ -22,6 +22,7 @@ import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.panels.AjaxDataTablePanel;
import org.apache.syncope.client.console.wicket.ajax.markup.html.navigation.paging.AjaxDataNavigationToolbar;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksTogglePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
@@ -36,9 +37,14 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
import org.apache.wicket.extensions.markup.html.repeater.data.table.NoRecordsToolbar;
import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Check;
+import org.apache.wicket.markup.html.form.CheckGroupSelector;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.OddEvenItem;
import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.util.visit.IVisit;
+import org.apache.wicket.util.visit.IVisitor;
public class AjaxFallbackDataTable<T extends Serializable, S> extends DataTable<T, S> {
@@ -129,8 +135,43 @@ public class AjaxFallbackDataTable<T extends Serializable, S> extends DataTable<
@Override
protected void onEvent(final AjaxRequestTarget target) {
- if (target.getLastFocusedElementId() == null) {
+ final String lastFocussedElementId = target.getLastFocusedElementId();
+ if (lastFocussedElementId == null) {
togglePanel.toggleWithContent(target, getActions(model), model.getObject());
+ } else {
+ final AjaxDataTablePanel<?, ?> parent = findParent(AjaxDataTablePanel.class);
+ final Model<Boolean> isCheck = Model.<Boolean>of(Boolean.FALSE);
+
+ parent.visitChildren(CheckGroupSelector.class,
+ new IVisitor<CheckGroupSelector, List<CheckGroupSelector>>() {
+
+ @Override
+ public void component(
+ final CheckGroupSelector t,
+ final IVisit<List<CheckGroupSelector>> ivisit) {
+ if (t.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
+ isCheck.setObject(Boolean.TRUE);
+ ivisit.stop();
+ }
+ }
+ });
+
+ if (!isCheck.getObject()) {
+ parent.visitChildren(Check.class, new IVisitor<Check<?>, List<Check<?>>>() {
+
+ @Override
+ public void component(final Check<?> t, final IVisit<List<Check<?>>> ivisit) {
+ if (t.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
+ isCheck.setObject(Boolean.TRUE);
+ ivisit.stop();
+ }
+ }
+ });
+ }
+
+ if (!isCheck.getObject()) {
+ togglePanel.toggleWithContent(target, getActions(model), model.getObject());
+ }
}
}
});