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 2014/02/26 09:07:09 UTC
[1/2] git commit: ISIS-680: implement simple clipboard as replacement
for zclip (flash)
Repository: isis
Updated Branches:
refs/heads/master b4ee8405f -> 47ed4b32d
ISIS-680: implement simple clipboard as replacement for zclip (flash)
Also:
- rebind bookmarked pages sliding panel's key to alt+[ (instead of alt+])
- bind the simple clipboard modal window popup to be alt+]
Also:
- move bookmarked panel tab to be in a more unobstructive place
- bind esc key to quickly close the bookmarked pages sliding panel
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2b3e6fb0
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2b3e6fb0
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2b3e6fb0
Branch: refs/heads/master
Commit: 2b3e6fb0c6a9c9e98e0f50509dae3979cc59c3eb
Parents: b4ee840
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Feb 26 07:59:36 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Feb 26 07:59:36 2014 +0000
----------------------------------------------------------------------
.../bookmarkedpages/BookmarkedPagesPanel.css | 4 +-
.../components/bookmarkedpages/slide-panel.js | 8 +-
.../zclip/SimpleClipboardModalWindow.java | 108 +++++++++++++++++++
.../zclip/SimpleClipboardModalWindowForm.css | 42 ++++++++
.../zclip/SimpleClipboardModalWindowForm.java | 29 +++++
.../zclip/SimpleClipboardModalWindowPanel.css | 31 ++++++
.../zclip/SimpleClipboardModalWindowPanel.html | 35 ++++++
.../zclip/SimpleClipboardModalWindowPanel.java | 32 ++++++
.../widgets/zclip/ZeroClipboardPanel.css | 3 +
.../widgets/zclip/ZeroClipboardPanel.html | 3 +-
.../widgets/zclip/ZeroClipboardPanel.java | 66 +++++++++++-
11 files changed, 356 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css
index 95f2dfa..32160e8 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/BookmarkedPagesPanel.css
@@ -97,7 +97,8 @@
.bookmarkedPagesPanel .showPanelTab {
border-radius: 0px 8px 8px 0px;
width:10px;
- height:200px;
+ margin-top: -120px;
+ height:100px;
position:fixed;
left:0px;
top:120px;
@@ -116,6 +117,7 @@
left:0px;
top:80px;
background-color:#F0EFEA;
+ margin-top: -100px;
height:800px;
width:0;/*new line*/
z-index: 998;
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/slide-panel.js
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/slide-panel.js b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/slide-panel.js
index 1968489..38f4592 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/slide-panel.js
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/bookmarkedpages/slide-panel.js
@@ -46,13 +46,17 @@ $(document).ready(function(){
$('body').keydown(function(e) {
- // alt+]
- if(e.which === 221 && e.altKey) {
+ // alt+[
+ if(e.which === 219 && e.altKey) {
if($('#bookmarkedPagesSlidingDiv .content').is(":visible")) {
hideBookmarksQuickly();
} else {
showBookmarks();
}
}
+
+ if(e.which === 27) {
+ hideBookmarksQuickly();
+ }
});
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java
new file mode 100644
index 0000000..a55e352
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindow.java
@@ -0,0 +1,108 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.components.widgets.zclip;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
+
+public class SimpleClipboardModalWindow extends ModalWindow implements ActionPrompt {
+
+ private static final long serialVersionUID = 1L;
+
+ public static SimpleClipboardModalWindow newModalWindow(String id) {
+ SimpleClipboardModalWindow modalWindow = new SimpleClipboardModalWindow(id);
+ modalWindow.setCssClassName("w_isis_zclip");
+ return modalWindow;
+ }
+
+
+ // //////////////////////////////////////
+
+
+ public SimpleClipboardModalWindow(String id) {
+ super(id);
+ setMaskType(MaskType.SEMI_TRANSPARENT);
+ add(new CloseOnEscapeKeyBehavior(this));
+ }
+
+ private static class CloseOnEscapeKeyBehavior extends AbstractDefaultAjaxBehavior {
+ private static final long serialVersionUID = 1L;
+ private final ModalWindow modal;
+ public CloseOnEscapeKeyBehavior(ModalWindow modal) {
+ this.modal = modal;
+ }
+ @Override
+ protected void respond(AjaxRequestTarget target) {
+ if(modal.isShown()) {
+ modal.close(target);
+ }
+ }
+ @Override
+ public void renderHead(Component component, IHeaderResponse response) {
+ String javaScript = ""
+ + "$(document).ready(function() {\n"
+ + "\n"
+ + " // close with escape\n"
+ + " $(document).bind('keyup', function(evt) {\n"
+ + " if (evt.keyCode == 27) {\n"
+ + getCallbackScript() + "\n"
+ + " evt.preventDefault();\n"
+ + " }\n"
+ + " });\n"
+ + " \n"
+ + " \n"
+ + " // open with alt+] \n"
+ + " $(document).bind('keyup', function(evt) {\n"
+ + " if (evt.keyCode == 221 && evt.altKey) {\n"
+ + " $('.zeroClipboardPanel a.copyLink').click();\n"
+ + " }\n"
+ + " });\n"
+ + "});";
+ String id ="closeSimpleClipboardModal";
+ response.render(JavaScriptHeaderItem.forScript(javaScript, id));
+ }
+ }
+
+ @Override
+ public void setPanel(Component component, AjaxRequestTarget target) {
+ setContent(component);
+ }
+
+
+ @Override
+ public void show(AjaxRequestTarget target) {
+
+ // http://stackoverflow.com/questions/8013364/how-to-defeat-browser-dialog-popup-when-calling-wicket-setresponsepage-from-mo/8679946#8679946
+ target.prependJavaScript("Wicket.Window.unloadConfirmation = false;");
+
+ super.show(target);
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("$('.first-field input').focus();\n");
+ builder.append("Wicket.Window.get().autoSizeWindow();\n");
+ target.appendJavaScript(builder.toString());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.css
new file mode 100644
index 0000000..7745cbc
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.css
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+.simpleClipboardPanel form {
+ margin: 20px;
+ background-color: white;
+}
+
+.simpleClipboardPanel div.inner {
+ margin: 20px;
+ width:640px;
+}
+
+.simpleClipboardPanel div.inner p.scalarName {
+ padding-top: 40px;
+ padding-bottom: 10px;
+}
+
+.simpleClipboardPanel form input.textField {
+ width:600px;
+ margin-bottom: 60px;
+}
+
+.simpleClipboardPanel form input.ok {
+ margin-bottom: 20px;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.java
new file mode 100644
index 0000000..6b0423e
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowForm.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.components.widgets.zclip;
+
+import org.apache.isis.viewer.wicket.ui.panels.FormAbstract;
+
+public class SimpleClipboardModalWindowForm extends FormAbstract<String> {
+
+ private static final long serialVersionUID = 1L;
+
+ public SimpleClipboardModalWindowForm(String id) {
+ super(id);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.css
new file mode 100644
index 0000000..1c8dfa7
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.css
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+div.wicket-modal div.w_content_3,
+div.wicket-modal div.w_content_2,
+div.wicket-modal div.w_content_1,
+div.wicket-modal div.w_content,
+.wicket-modal .w_content_container,
+.w_isis_zclip,
+.simpleClipboardPanel form {
+ border-radius:4px;
+ -moz-border-radius:4px;
+ -webkit-border-radius:4px;
+}
+
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.html
new file mode 100644
index 0000000..5b37206
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.html
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+ <body>
+ <wicket:panel>
+ <div class="simpleClipboardPanel">
+ <form wicket:id="form">
+ <div class="inner">
+ <p class="scalarName">Copy this URL:</p>
+ <input wicket:id="textField" class="textField"/>
+ <input type="submit" value="OK" class="ok"></input>
+ </div>
+ </form>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.java
new file mode 100644
index 0000000..d8ce5a2
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/SimpleClipboardModalWindowPanel.java
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.viewer.wicket.ui.components.widgets.zclip;
+
+import org.apache.wicket.model.Model;
+
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class SimpleClipboardModalWindowPanel extends PanelAbstract<Model<String>> {
+
+ private static final long serialVersionUID = 1L;
+
+ public SimpleClipboardModalWindowPanel(String id) {
+ super(id);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.css
index 3fbc5c3..b62e3ba 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.css
@@ -21,3 +21,6 @@
display: none;
}
+.zeroClipboardPanel a:hover {
+ text-decoration: none;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.html
index de48ded..ec728c7 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.html
@@ -21,10 +21,11 @@
<body>
<wicket:panel>
<div class="zeroClipboardPanel">
- <a wicket:id="copyLink" href="#">
+ <a wicket:id="copyLink" href="#" class="copyLink">
<span> </span>
</a>
<a wicket:id="subscribingLink" id="subscribingLink" class="subscribingLink" href="#"> </a>
+ <div wicket:id="simpleClipboardModalWindow"/>
</div>
</wicket:panel>
</body>
http://git-wip-us.apache.org/repos/asf/isis/blob/2b3e6fb0/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
index 3c4bb5e..4f24caf 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
@@ -20,7 +20,11 @@ import org.apache.wicket.Page;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.event.IEvent;
+import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.request.Url;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -39,9 +43,11 @@ public class ZeroClipboardPanel extends PanelAbstract<EntityModel> {
private static final String ID_SUBSCRIBING_LINK = "subscribingLink";
private static final String ID_COPY_LINK = "copyLink";
+ private static final String ID_SIMPLE_CLIPBOARD_MODAL_WINDOW = "simpleClipboardModalWindow";
private AbstractLink subscribingLink;
private AjaxLink<ObjectAdapter> copyLink;
+ private SimpleClipboardModalWindow simpleClipboardModalWindow;
public ZeroClipboardPanel(String id) {
super(id);
@@ -52,12 +58,65 @@ public class ZeroClipboardPanel extends PanelAbstract<EntityModel> {
super.onInitialize();
if(copyLink == null) {
- copyLink = new ZeroClipboardLink(ID_COPY_LINK, "#subscribingLink");
+ copyLink = createLink(ID_COPY_LINK);
addOrReplace(copyLink);
}
addSubscribingLink(null);
+ addSimpleClipboardModalWindow();
}
+ private AjaxLink<ObjectAdapter> createLink(String linkId) {
+
+ return newSimpleClipboardLink(linkId);
+ //return newZeroClipboardLink(linkId);
+ }
+
+ private ZeroClipboardLink newZeroClipboardLink(String linkId) {
+ return new ZeroClipboardLink(linkId, "#subscribingLink");
+ }
+
+ private AjaxLink<ObjectAdapter> newSimpleClipboardLink(String linkId) {
+ return new AjaxLink<ObjectAdapter>(linkId) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+
+ String contentId = simpleClipboardModalWindow.getContentId();
+ SimpleClipboardModalWindowPanel panel = new SimpleClipboardModalWindowPanel(contentId);
+ SimpleClipboardModalWindowForm form = new SimpleClipboardModalWindowForm("form");
+
+ final TextField<String> textField = new TextField<String>("textField", new LoadableDetachableModel<String>() {
+ private static final long serialVersionUID = 1L;
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected String load() {
+ if(subscribingLink instanceof BookmarkablePageLink) {
+ final BookmarkablePageLink<?> link = (BookmarkablePageLink<?>) subscribingLink;
+ final Class pageClass = link.getPageClass();
+ final PageParameters pageParameters = link.getPageParameters();
+ final CharSequence urlFor = link.urlFor(pageClass, pageParameters);
+ return getRequestCycle().getUrlRenderer().renderFullUrl(Url.parse(urlFor));
+ } else {
+ return "";
+ }
+ }
+ });
+ panel.add(form);
+ form.add(textField);
+
+ textField.setOutputMarkupId(true);
+
+ simpleClipboardModalWindow.setPanel(panel, target);
+ simpleClipboardModalWindow.show(target);
+
+ target.focusComponent(textField);
+ }
+ };
+ }
+
+
private void addSubscribingLink(UiHintContainer uiHintContainer) {
if(uiHintContainer == null && subscribingLink != null) {
// ignore, since has already been primed
@@ -68,6 +127,11 @@ public class ZeroClipboardPanel extends PanelAbstract<EntityModel> {
subscribingLink.setOutputMarkupId(true);
}
+ private void addSimpleClipboardModalWindow() {
+ simpleClipboardModalWindow = SimpleClipboardModalWindow.newModalWindow(ID_SIMPLE_CLIPBOARD_MODAL_WINDOW);
+ addOrReplace(simpleClipboardModalWindow);
+ }
+
private AbstractLink createSubscribingLink(UiHintContainer uiHintContainer) {
if(uiHintContainer == null || !(uiHintContainer instanceof EntityModel)) {
// return a no-op
[2/2] git commit: ISIS-680: remove the zclip (flash) stuff completely
Posted by da...@apache.org.
ISIS-680: remove the zclip (flash) stuff completely
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/47ed4b32
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/47ed4b32
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/47ed4b32
Branch: refs/heads/master
Commit: 47ed4b32ddc7bfc5d8e5597b652e4a6d68db744b
Parents: 2b3e6fb
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Feb 26 08:02:57 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Feb 26 08:02:57 2014 +0000
----------------------------------------------------------------------
.../wicket/viewer/IsisWicketApplication.java | 6 +-
.../icontitle/EntityIconAndTitlePanel.java | 21 -
.../components/widgets/zclip/ZeroClipboard.swf | Bin 1071 -> 0 bytes
.../widgets/zclip/ZeroClipboardLink.java | 110 ----
.../widgets/zclip/ZeroClipboardPanel.java | 6 -
.../ui/components/widgets/zclip/jquery.zclip.js | 507 -------------------
.../viewer/wicket/ui/pages/PageAbstract.java | 7 -
7 files changed, 1 insertion(+), 656 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/47ed4b32/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
index cdc2481..39c7250 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
@@ -81,7 +81,6 @@ import org.apache.isis.core.webapp.WebAppConstants;
import org.apache.isis.core.webapp.config.ResourceStreamSourceForWebInf;
import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.BookmarkedPagesModel;
import org.apache.isis.viewer.wicket.model.models.ImageResourceCache;
import org.apache.isis.viewer.wicket.model.models.PageType;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
@@ -93,8 +92,6 @@ import org.apache.isis.viewer.wicket.ui.components.entity.properties.EntityPrope
import org.apache.isis.viewer.wicket.ui.components.scalars.string.MultiLineStringPanel;
import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuItemPanel;
import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssSubMenuItemsPanel;
-import org.apache.isis.viewer.wicket.ui.components.widgets.zclip.ZeroClipboardLink;
-import org.apache.isis.viewer.wicket.ui.pages.BookmarkedPagesModelProvider;
import org.apache.isis.viewer.wicket.ui.pages.PageClassList;
import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistryAccessor;
@@ -265,9 +262,8 @@ public class IsisWicketApplication extends AuthenticatedWebApplication implement
mountPage("/entity/${objectOid}", PageType.ENTITY);
mountPage("/action/${objectOid}/${actionOwningSpec}/${actionId}/${actionType}", PageType.ACTION_PROMPT);
+ @SuppressWarnings("unused")
SharedResources sharedResources = getSharedResources();
- ZeroClipboardLink.addSharedResourceTo(sharedResources);
-
} catch(RuntimeException ex) {
List<MetaModelInvalidException> mmies = Lists.newArrayList(
http://git-wip-us.apache.org/repos/asf/isis/blob/47ed4b32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java
index bd66cda..afbee47 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/icontitle/EntityIconAndTitlePanel.java
@@ -19,49 +19,28 @@
package org.apache.isis.viewer.wicket.ui.components.entity.icontitle;
-import java.net.ResponseCache;
-import java.util.Set;
-
-import com.google.common.base.Strings;
import com.google.inject.Inject;
import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.markup.head.JavaScriptContentHeaderItem;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.Url;
-import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.ResourceReference;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.wicket.model.hints.UiHintsBroadcastEvent;
-import org.apache.isis.viewer.wicket.model.hints.UiHintsSetEvent;
import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
import org.apache.isis.viewer.wicket.model.models.ImageResourceCache;
import org.apache.isis.viewer.wicket.model.models.PageType;
import org.apache.isis.viewer.wicket.ui.components.entity.EntityActionLinkFactory;
-import org.apache.isis.viewer.wicket.ui.components.widgets.zclip.ZeroClipboardLink;
-import org.apache.isis.viewer.wicket.ui.errors.JGrowlUtil;
import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistryAccessor;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.util.Components;
import org.apache.isis.viewer.wicket.ui.util.Links;
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/47ed4b32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboard.swf
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboard.swf b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboard.swf
deleted file mode 100644
index 13bf8e3..0000000
Binary files a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboard.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/47ed4b32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardLink.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardLink.java
deleted file mode 100644
index 1af5d8f..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardLink.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.isis.viewer.wicket.ui.components.widgets.zclip;
-
-import com.google.common.io.Resources;
-
-import org.apache.wicket.SharedResources;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.core.util.resource.UrlResourceStream;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.Url;
-import org.apache.wicket.request.resource.ResourceStreamResource;
-import org.apache.wicket.request.resource.SharedResourceReference;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-public final class ZeroClipboardLink extends AjaxLink<ObjectAdapter> {
-
- /**
- * @see #addSharedResourceTo(SharedResources)
- */
- private static final String SHARED_RESOURCE_NAME = ZeroClipboardLink.class.getName();
- /**
- * Relative to this class.
- */
- private static final String FILE_NAME_SWF = "ZeroClipboard.swf";
-
- private final String linkJQuerySelector;
-
- private final CharSequence zeroClipboardSwfUrl;
- private final String baseUrl;
- private static final long serialVersionUID = 1L;
-
- public static void addSharedResourceTo(SharedResources sharedResources) {
- sharedResources.add(ZeroClipboardLink.SHARED_RESOURCE_NAME, ZeroClipboardLink.newSwfFileResource());
- }
-
- private static ResourceStreamResource newSwfFileResource() {
- return new ResourceStreamResource(
- new UrlResourceStream(
- Resources.getResource(ZeroClipboardLink.class, FILE_NAME_SWF)));
- }
-
- // //////////////////////////////////////
-
- public ZeroClipboardLink(String id, AbstractLink linkComponent) {
- this(id, "#"+linkComponent.getMarkupId());
- }
-
- public ZeroClipboardLink(String id, String linkJQuerySelector) {
- super(id);
- this.linkJQuerySelector = linkJQuerySelector;
- this.zeroClipboardSwfUrl = getRequestCycle().getUrlRenderer().renderFullUrl(Url.parse(urlFor(new SharedResourceReference(SHARED_RESOURCE_NAME), null)));
- this.baseUrl = getRequestCycle().getUrlRenderer().renderFullUrl(Url.parse("."));
- }
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- // (nothing to do)
- }
-
- @Override
- public void renderHead(IHeaderResponse response) {
- super.renderHead(response);
-
- final StringBuilder buf = new StringBuilder();
-
- buf.append(jQuerySelectorOf("#"+getMarkupId()) + ".zclip({");
- buf.append(" path:'" + zeroClipboardSwfUrl + "'");
- buf.append(" ,copy: function(){ return " + quote(baseUrl) + "+" + jQueryLinkSelector() + ".attr(\"href\"); }");
- buf.append("});");
- buf.append(jQuerySelectorOf("#"+getMarkupId()) + ".zclip('show')");
-
- String js=buf.toString();
-
- response.render(OnDomReadyHeaderItem.forScript(js));
- }
-
- private String jQueryLinkSelector() {
- return jQuerySelectorOf(linkJQuerySelector);
- }
-
- private static String jQuerySelectorOf(String selector) {
- return "$('" + selector + "')";
- }
-
- private static String quote(final String baseUrl) {
- return "\"" + baseUrl +"\"";
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/47ed4b32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
index 4f24caf..d83351b 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardPanel.java
@@ -66,13 +66,7 @@ public class ZeroClipboardPanel extends PanelAbstract<EntityModel> {
}
private AjaxLink<ObjectAdapter> createLink(String linkId) {
-
return newSimpleClipboardLink(linkId);
- //return newZeroClipboardLink(linkId);
- }
-
- private ZeroClipboardLink newZeroClipboardLink(String linkId) {
- return new ZeroClipboardLink(linkId, "#subscribingLink");
}
private AjaxLink<ObjectAdapter> newSimpleClipboardLink(String linkId) {
http://git-wip-us.apache.org/repos/asf/isis/blob/47ed4b32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/jquery.zclip.js
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/jquery.zclip.js b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/jquery.zclip.js
deleted file mode 100644
index c21c6b0..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/jquery.zclip.js
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * zClip :: jQuery ZeroClipboard v1.1.3
- * http://steamdev.com/zclip
- *
- * Copyright 2011, SteamDev
- * Released under the MIT license.
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Date: Wed Jun 01, 2011
- */
-
-
-(function (jQuery) {
-
- jQuery.fn.zclip = function (params) {
-
- if (typeof params == "object" && !params.length) {
-
- var settings = jQuery.extend({
-
- path: 'ZeroClipboard.swf',
- copy: null,
- beforeCopy: null,
- afterCopy: null,
- clickAfter: true,
- setHandCursor: true,
- setCSSEffects: true
-
- }, params);
-
-
- return this.each(function () {
-
- var o = jQuery(this);
-
- if (o.is(':visible') && (typeof settings.copy == 'string' || jQuery.isFunction(settings.copy))) {
-
- ZeroClipboard.setMoviePath(settings.path);
- var clip = new ZeroClipboard.Client();
-
- if(jQuery.isFunction(settings.copy)){
- o.bind('zClip_copy',settings.copy);
- }
- if(jQuery.isFunction(settings.beforeCopy)){
- o.bind('zClip_beforeCopy',settings.beforeCopy);
- }
- if(jQuery.isFunction(settings.afterCopy)){
- o.bind('zClip_afterCopy',settings.afterCopy);
- }
-
- clip.setHandCursor(settings.setHandCursor);
- clip.setCSSEffects(settings.setCSSEffects);
- clip.addEventListener('mouseOver', function (client) {
- o.trigger('mouseenter');
- });
- clip.addEventListener('mouseOut', function (client) {
- o.trigger('mouseleave');
- });
- clip.addEventListener('mouseDown', function (client) {
-
- o.trigger('mousedown');
-
- if(!jQuery.isFunction(settings.copy)){
- clip.setText(settings.copy);
- } else {
- clip.setText(o.triggerHandler('zClip_copy'));
- }
-
- if (jQuery.isFunction(settings.beforeCopy)) {
- o.trigger('zClip_beforeCopy');
- }
-
- });
-
- clip.addEventListener('complete', function (client, text) {
-
- if (jQuery.isFunction(settings.afterCopy)) {
-
- o.trigger('zClip_afterCopy');
-
- } else {
- if (text.length > 500) {
- text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)";
- }
-
- o.removeClass('hover');
- alert("Copied text to clipboard:\n\n " + text);
- }
-
- if (settings.clickAfter) {
- o.trigger('click');
- }
-
- });
-
-
- clip.glue(o[0], o.parent()[0]);
-
- jQuery(window).bind('load resize',function(){clip.reposition();});
-
-
- }
-
- });
-
- } else if (typeof params == "string") {
-
- return this.each(function () {
-
- var o = jQuery(this);
-
- params = params.toLowerCase();
- var zclipId = o.data('zclipId');
- var clipElm = jQuery('#' + zclipId + '.zclip');
- var clientId = clipElm.attr('id').replace(/^.*_/g, '') || null;
-
- if (params == "remove") {
-
- clipElm.remove();
- o.removeClass('active hover');
- o.unbind('zClip_copy');
- o.unbind('zClip_beforeCopy');
- o.unbind('zClip_afterCopy');
- ZeroClipboard.unregister(clientId);
-
- } else if (params == "hide") {
-
- clipElm.hide();
- o.removeClass('active hover');
-
- } else if (params == "show") {
-
- clipElm.show();
-
- }
-
- });
-
- }
-
- }
-
-
-
-})(jQuery);
-
-
-
-
-
-
-
-// ZeroClipboard
-// Simple Set Clipboard System
-// Author: Joseph Huckaby
-var ZeroClipboard = {
-
- version: "1.0.7",
- clients: {},
- // registered upload clients on page, indexed by id
- moviePath: 'ZeroClipboard.swf',
- // URL to movie
- nextId: 1,
- // ID of next movie
- jQuery: function (thingy) {
- // simple DOM lookup utility function
- if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
- if (!thingy.addClass) {
- // extend element with a few useful methods
- thingy.hide = function () {
- this.style.display = 'none';
- };
- thingy.show = function () {
- this.style.display = '';
- };
- thingy.addClass = function (name) {
- this.removeClass(name);
- this.className += ' ' + name;
- };
- thingy.removeClass = function (name) {
- var classes = this.className.split(/\s+/);
- var idx = -1;
- for (var k = 0; k < classes.length; k++) {
- if (classes[k] == name) {
- idx = k;
- k = classes.length;
- }
- }
- if (idx > -1) {
- classes.splice(idx, 1);
- this.className = classes.join(' ');
- }
- return this;
- };
- thingy.hasClass = function (name) {
- return !!this.className.match(new RegExp("\\s*" + name + "\\s*"));
- };
- }
- return thingy;
- },
-
- setMoviePath: function (path) {
- // set path to ZeroClipboard.swf
- this.moviePath = path;
- },
-
- dispatch: function (id, eventName, args) {
- // receive event from flash movie, send to client
- var client = this.clients[id];
- if (client) {
- client.receiveEvent(eventName, args);
- }
- },
-
- register: function (id, client) {
- // register new client to receive events
- this.clients[id] = client;
- },
-
- unregister: function (id) {
- if (typeof(id) === 'number' && this.clients.hasOwnProperty(id)) {
- delete this.clients[id];
- }
- },
-
- getDOMObjectPosition: function (obj, stopObj) {
- // get absolute coordinates for dom element
- var info = {
- left: 0,
- top: 0,
- width: obj.width ? obj.width : obj.offsetWidth,
- height: obj.height ? obj.height : obj.offsetHeight
- };
-
- if (obj && (obj != stopObj)) {
- info.left += obj.offsetLeft;
- info.top += obj.offsetTop;
- }
-
- return info;
- },
-
- Client: function (elem) {
- // constructor for new simple upload client
- this.handlers = {};
-
- // unique ID
- this.id = ZeroClipboard.nextId++;
- this.movieId = 'ZeroClipboardMovie_' + this.id;
-
- // register client with singleton to receive flash events
- ZeroClipboard.register(this.id, this);
-
- // create movie
- if (elem) this.glue(elem);
- }
-};
-
-ZeroClipboard.Client.prototype = {
-
- id: 0,
- // unique ID for us
- ready: false,
- // whether movie is ready to receive events or not
- movie: null,
- // reference to movie object
- clipText: '',
- // text to copy to clipboard
- handCursorEnabled: true,
- // whether to show hand cursor, or default pointer cursor
- cssEffects: true,
- // enable CSS mouse effects on dom container
- handlers: null,
- // user event handlers
- glue: function (elem, appendElem, stylesToAdd) {
- // glue to DOM element
- // elem can be ID or actual DOM element object
- this.domElement = ZeroClipboard.jQuery(elem);
-
- // float just above object, or zIndex 99 if dom element isn't set
- var zIndex = 99;
- if (this.domElement.style.zIndex) {
- zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
- }
-
- if (typeof(appendElem) == 'string') {
- appendElem = ZeroClipboard.jQuery(appendElem);
- } else if (typeof(appendElem) == 'undefined') {
- appendElem = document.getElementsByTagName('body')[0];
- }
-
- // find X/Y position of domElement
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
-
- // create floating DIV above element
- this.div = document.createElement('div');
- this.div.className = "zclip";
- this.div.id = "zclip-" + this.movieId;
- jQuery(this.domElement).data('zclipId', 'zclip-' + this.movieId);
- var style = this.div.style;
- style.position = 'absolute';
- style.left = '' + box.left + 'px';
- style.top = '' + box.top + 'px';
- style.width = '' + box.width + 'px';
- style.height = '' + box.height + 'px';
- style.zIndex = zIndex;
-
- if (typeof(stylesToAdd) == 'object') {
- for (addedStyle in stylesToAdd) {
- style[addedStyle] = stylesToAdd[addedStyle];
- }
- }
-
- // style.backgroundColor = '#f00'; // debug
- appendElem.appendChild(this.div);
-
- this.div.innerHTML = this.getHTML(box.width, box.height);
- },
-
- getHTML: function (width, height) {
- // return HTML for movie
- var html = '';
- var flashvars = 'id=' + this.id + '&width=' + width + '&height=' + height;
-
- if (navigator.userAgent.match(/MSIE/)) {
- // IE gets an OBJECT tag
- var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
- html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + protocol + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '" id="' + this.movieId + '" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + ZeroClipboard.moviePath + '" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="' + flashvars + '"/><param name="wmode" value="transparent"/></object>';
- } else {
- // all other browsers get an EMBED tag
- html += '<embed id="' + this.movieId + '" src="' + ZeroClipboard.moviePath + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="' + this.movieId + '" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + flashvars + '" wmode="transparent" />';
- }
- return html;
- },
-
- hide: function () {
- // temporarily hide floater offscreen
- if (this.div) {
- this.div.style.left = '-2000px';
- }
- },
-
- show: function () {
- // show ourselves after a call to hide()
- this.reposition();
- },
-
- destroy: function () {
- // destroy control and floater
- if (this.domElement && this.div) {
- this.hide();
- this.div.innerHTML = '';
-
- var body = document.getElementsByTagName('body')[0];
- try {
- body.removeChild(this.div);
- } catch (e) {;
- }
-
- this.domElement = null;
- this.div = null;
- }
- },
-
- reposition: function (elem) {
- // reposition our floating div, optionally to new container
- // warning: container CANNOT change size, only position
- if (elem) {
- this.domElement = ZeroClipboard.jQuery(elem);
- if (!this.domElement) this.hide();
- }
-
- if (this.domElement && this.div) {
- var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
- var style = this.div.style;
- style.left = '' + box.left + 'px';
- style.top = '' + box.top + 'px';
- }
- },
-
- setText: function (newText) {
- // set text to be copied to clipboard
- this.clipText = newText;
- if (this.ready) {
- this.movie.setText(newText);
- }
- },
-
- addEventListener: function (eventName, func) {
- // add user event listener for event
- // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
- if (!this.handlers[eventName]) {
- this.handlers[eventName] = [];
- }
- this.handlers[eventName].push(func);
- },
-
- setHandCursor: function (enabled) {
- // enable hand cursor (true), or default arrow cursor (false)
- this.handCursorEnabled = enabled;
- if (this.ready) {
- this.movie.setHandCursor(enabled);
- }
- },
-
- setCSSEffects: function (enabled) {
- // enable or disable CSS effects on DOM container
- this.cssEffects = !! enabled;
- },
-
- receiveEvent: function (eventName, args) {
- // receive event from flash
- eventName = eventName.toString().toLowerCase().replace(/^on/, '');
-
- // special behavior for certain events
- switch (eventName) {
- case 'load':
- // movie claims it is ready, but in IE this isn't always the case...
- // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
- this.movie = document.getElementById(this.movieId);
- if (!this.movie) {
- var self = this;
- setTimeout(function () {
- self.receiveEvent('load', null);
- }, 1);
- return;
- }
-
- // firefox on pc needs a "kick" in order to set these in certain cases
- if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
- var self = this;
- setTimeout(function () {
- self.receiveEvent('load', null);
- }, 100);
- this.ready = true;
- return;
- }
-
- this.ready = true;
- try {
- this.movie.setText(this.clipText);
- } catch (e) {}
- try {
- this.movie.setHandCursor(this.handCursorEnabled);
- } catch (e) {}
- break;
-
- case 'mouseover':
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass('hover');
- if (this.recoverActive) {
- this.domElement.addClass('active');
- }
-
-
- }
-
-
- break;
-
- case 'mouseout':
- if (this.domElement && this.cssEffects) {
- this.recoverActive = false;
- if (this.domElement.hasClass('active')) {
- this.domElement.removeClass('active');
- this.recoverActive = true;
- }
- this.domElement.removeClass('hover');
-
- }
- break;
-
- case 'mousedown':
- if (this.domElement && this.cssEffects) {
- this.domElement.addClass('active');
- }
- break;
-
- case 'mouseup':
- if (this.domElement && this.cssEffects) {
- this.domElement.removeClass('active');
- this.recoverActive = false;
- }
- break;
- } // switch eventName
- if (this.handlers[eventName]) {
- for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
- var func = this.handlers[eventName][idx];
-
- if (typeof(func) == 'function') {
- // actual function reference
- func(this, args);
- } else if ((typeof(func) == 'object') && (func.length == 2)) {
- // PHP style object + method, i.e. [myObject, 'myMethod']
- func[0][func[1]](this, args);
- } else if (typeof(func) == 'string') {
- // name of function
- window[func](this, args);
- }
- } // foreach event handler defined
- } // user defined handler for event
- }
-
-};
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/47ed4b32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
index 2612200..767c7b2 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
@@ -71,7 +71,6 @@ import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistryAccessor;
import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
import org.apache.isis.viewer.wicket.ui.components.widgets.breadcrumbs.BreadcrumbPanel;
-import org.apache.isis.viewer.wicket.ui.components.widgets.zclip.ZeroClipboardLink;
import org.apache.isis.viewer.wicket.ui.components.widgets.zclip.ZeroClipboardPanel;
import org.apache.isis.viewer.wicket.ui.errors.ExceptionModel;
import org.apache.isis.viewer.wicket.ui.errors.JGrowlUtil;
@@ -113,11 +112,6 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
* @see https://github.com/brandonaaron/livequery
*/
private static final JavaScriptResourceReference JQUERY_LIVEQUERY_JS = new JavaScriptResourceReference(PageAbstract.class, "jquery.livequery.js");
- /**
- * @see https://github.com/patricklodder/jquery-zclip
- * @see http://steamdev.com/zclip/
- */
- private static final JavaScriptResourceReference JQUERY_ZCLIP_JS = new JavaScriptResourceReference(ZeroClipboardLink.class, "jquery.zclip.js");
private static final JavaScriptResourceReference JQUERY_ISIS_WICKET_VIEWER_JS = new JavaScriptResourceReference(PageAbstract.class, "jquery.isis.wicket.viewer.js");
//private static final JavaScriptResourceReference BOOTSTRAP_JS = new JavaScriptResourceReference(PageAbstract.class, "bootstrap/js/bootstrap.min.js");
@@ -228,7 +222,6 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())));
response.render(JavaScriptReferenceHeaderItem.forReference(JQUERY_JGROWL_JS));
response.render(JavaScriptReferenceHeaderItem.forReference(JQUERY_LIVEQUERY_JS));
- response.render(JavaScriptReferenceHeaderItem.forReference(JQUERY_ZCLIP_JS));
response.render(JavaScriptReferenceHeaderItem.forReference(JQUERY_ISIS_WICKET_VIEWER_JS));
final String feedbackMsg = JGrowlUtil.asJGrowlCalls(getMessageBroker());