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 2013/12/20 16:42:20 UTC
[3/4] ISIS-638: ui hints and clipboard behaviour
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java
new file mode 100644
index 0000000..d43033f
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/containers/UiHintPathSignificantWebMarkupContainer.java
@@ -0,0 +1,34 @@
+/**
+ * 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.containers;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+
+public class UiHintPathSignificantWebMarkupContainer extends WebMarkupContainer implements UiHintPathSignificant {
+ private static final long serialVersionUID = 1L;
+
+ public UiHintPathSignificantWebMarkupContainer(String id, IModel<?> model) {
+ super(id, model);
+ }
+
+ public UiHintPathSignificantWebMarkupContainer(String id) {
+ super(id);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
index bfe71c1..785f473 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
@@ -34,6 +34,7 @@ import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider;
import org.apache.isis.viewer.wicket.ui.ComponentType;
import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
@@ -109,6 +110,27 @@ public abstract class FormComponentPanelAbstract<T> extends FormComponentPanel<T
Components.permanentlyHide(container, ids);
}
+
+ // ///////////////////////////////////////////////////////////////////
+ // Hint support
+ // ///////////////////////////////////////////////////////////////////
+
+ public UiHintContainer getHintContainer() {
+ return hintContainerOf(this);
+ }
+
+ private UiHintContainer hintContainerOf(Component component) {
+ if(component == null) {
+ return null;
+ }
+ IModel<?> model = component.getDefaultModel();
+ if(model instanceof UiHintContainer) {
+ return (UiHintContainer) model;
+ }
+ // otherwise, go up the UI component hierarchy
+ return hintContainerOf(getParent());
+ }
+
// ///////////////////////////////////////////////////////////////////
// Convenience
// ///////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/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
new file mode 100644
index 0000000..13bf8e3
Binary files /dev/null and b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboard.swf differ
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/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
new file mode 100644
index 0000000..962458d
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/ZeroClipboardLink.java
@@ -0,0 +1,112 @@
+/**
+ * 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("var url = " + quote(baseUrl) + "+" + jQueryLinkSelector() + ".attr(\"href\");");
+
+ buf.append(jQuerySelectorOf("#"+getMarkupId()) + ".zclip({");
+ buf.append(" path:'" + zeroClipboardSwfUrl + "'");
+ //buf.append(" ,copy: url");
+ 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/bb2d31e1/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
new file mode 100644
index 0000000..c21c6b0
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/zclip/jquery.zclip.js
@@ -0,0 +1,507 @@
+/*
+ * 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/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
index ae7e283..204a5ac 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
@@ -103,6 +103,7 @@ colors
}
.headerContainer {
background: url("images/bg_header_brown.png") left top repeat;
+ height: 100px;
}
.headerContainer .links>span:first-child {
@@ -122,12 +123,44 @@ colors
}
#secondaryMenu {
- width: 25%;
+ width: 25%;
+}
+
+#tertiaryMenu {
+ width: 8%;
+}
+#tertiaryMenu .imgLinks {
+ line-height: 30px;
+ font-size: 3em;
+ margin-right:20px;
+}
+
+#tertiaryMenu .imgLinks a {
+ background-image: url("copy-26.png");
+ background-position: right;
+ background-repeat: no-repeat;
+ cursor: pointer;
+}
+
+#tertiaryMenu a.copyLink:hover,
+#tertiaryMenu a.copyLink.hover {
+ cursor: pointer;
+}
+
+#tertiaryMenu a.copyLink:active,
+#tertiaryMenu a.copyLink.active {
+ cursor: pointer;
+}
+
+
+#secondaryMenu,
+#tertiaryMenu {
display: inline-block;
float: right;
text-align: right;
margin-right: 5px;
}
+
#header h1 {
margin: 10px 10px 10px 0px;
font-size: xx-large;
@@ -222,6 +255,8 @@ colors
padding-left: 10px;
height:40px;
margin-left: 10px;
+ width: 73%;
+ float: left;
}
#applicationActions .menuh {
@@ -230,112 +265,112 @@ colors
z-index:501;
}
- #applicationActions .menuh ul.cssMenuItems {
- line-height:30px;
- }
-
- #applicationActions .cssMenuPanel .menuh a:link,
- #applicationActions .cssMenuPanel .menuh a:visited,
- #applicationActions .cssMenuPanel .menuh a:active,
- #applicationActions .cssMenuPanel .menuh p {
- background-color: transparent;
- color: #FFFFFF;
- text-decoration: none;
- text-transform:uppercase;
- font-size:0.9em;
- font-weight:bold;
- }
-
- #applicationActions .cssMenuPanel .menuh a.prototype span {
- color: #CCCC00;
- font-style: italic;
- }
-
-
- #applicationActions .cssMenuPanel .menuh li a:link,
- #applicationActions .cssMenuPanel .menuh li a:visited,
- #applicationActions .cssMenuPanel .menuh li a:active,
- #applicationActions .cssMenuPanel .menuh li p {
- border-radius:4px 4px 0px 0px;
- -moz-border-radius:4px 4px 0px 0px;
- -webkit-border-radius:4px 4px 0px 0px;
- }
-
- #applicationActions .cssMenuPanel .menuh li li a:link,
- #applicationActions .cssMenuPanel .menuh li li a:visited,
- #applicationActions .cssMenuPanel .menuh li li a:active,
- #applicationActions .cssMenuPanel .menuh li li p {
- border-radius:0px;
- -moz-border-radius:0px;
- -webkit-border-radius:0px;
- background-color: #20B5C2;
- }
-
- #applicationActions .cssMenuPanel .menuh li li:last-child a:link,
- #applicationActions .cssMenuPanel .menuh li li:last-child a:visited,
- #applicationActions .cssMenuPanel .menuh li li:last-child a:active,
- #applicationActions .cssMenuPanel .menuh li li:last-child p {
- border-radius:0px 0px 4px 4px;
- -webkit-border-radius:0px 0px 4px 4px;
- -moz-border-radius:0px 0px 4px 4px;
- background-color: #20B5C2;
- }
-
- #applicationActions .cssMenuPanel .menuh li li:first-child a:link,
- #applicationActions .cssMenuPanel .menuh li li:first-child a:visited,
- #applicationActions .cssMenuPanel .menuh li li:first-child a:active,
- #applicationActions .cssMenuPanel .menuh li li:first-child p {
- border-radius:0px 4px 0px 0px;
- -webkit-border-radius:0px 4px 0px 0px;
- -moz-border-radius:0px 4px 0px 0px;
- background-color: #20B5C2;
- }
-
- #applicationActions .cssMenuPanel .menuh li li:first-child:last-child a:link,
- #applicationActions .cssMenuPanel .menuh li li:first-child:last-child a:visited,
- #applicationActions .cssMenuPanel .menuh li li:first-child:last-child a:active,
- #applicationActions .cssMenuPanel .menuh li li:first-child:last-child p {
- border-radius:0px 4px 4px 4px;
- -webkit-border-radius:0px 4px 4px 4px;
- -moz-border-radius:0px 4px 4px 4px;
- background-color: #20B5C2;
- }
-
-
- #applicationActions .menuh a,
- #applicationActions .menuh p {
- border: 0px solid #00477F;
- padding: 0px 1em 0px 1em;
- background-image:none !important;
- }
+#applicationActions .menuh ul.cssMenuItems {
+ line-height:30px;
+}
+
+#applicationActions .cssMenuPanel .menuh a:link,
+#applicationActions .cssMenuPanel .menuh a:visited,
+#applicationActions .cssMenuPanel .menuh a:active,
+#applicationActions .cssMenuPanel .menuh p {
+ background-color: transparent;
+ color: #FFFFFF;
+ text-decoration: none;
+ text-transform:uppercase;
+ font-size:0.9em;
+ font-weight:bold;
+}
+
+ #applicationActions .cssMenuPanel .menuh a.prototype span {
+ color: #CCCC00;
+ font-style: italic;
+}
+
+
+#applicationActions .cssMenuPanel .menuh li a:link,
+#applicationActions .cssMenuPanel .menuh li a:visited,
+#applicationActions .cssMenuPanel .menuh li a:active,
+#applicationActions .cssMenuPanel .menuh li p {
+ border-radius:4px 4px 0px 0px;
+ -moz-border-radius:4px 4px 0px 0px;
+ -webkit-border-radius:4px 4px 0px 0px;
+}
+
+#applicationActions .cssMenuPanel .menuh li li a:link,
+#applicationActions .cssMenuPanel .menuh li li a:visited,
+#applicationActions .cssMenuPanel .menuh li li a:active,
+#applicationActions .cssMenuPanel .menuh li li p {
+ border-radius:0px;
+ -moz-border-radius:0px;
+ -webkit-border-radius:0px;
+ background-color: #20B5C2;
+}
+
+#applicationActions .cssMenuPanel .menuh li li:last-child a:link,
+#applicationActions .cssMenuPanel .menuh li li:last-child a:visited,
+#applicationActions .cssMenuPanel .menuh li li:last-child a:active,
+#applicationActions .cssMenuPanel .menuh li li:last-child p {
+ border-radius:0px 0px 4px 4px;
+ -webkit-border-radius:0px 0px 4px 4px;
+ -moz-border-radius:0px 0px 4px 4px;
+ background-color: #20B5C2;
+}
+
+#applicationActions .cssMenuPanel .menuh li li:first-child a:link,
+#applicationActions .cssMenuPanel .menuh li li:first-child a:visited,
+#applicationActions .cssMenuPanel .menuh li li:first-child a:active,
+#applicationActions .cssMenuPanel .menuh li li:first-child p {
+ border-radius:0px 4px 0px 0px;
+ -webkit-border-radius:0px 4px 0px 0px;
+ -moz-border-radius:0px 4px 0px 0px;
+ background-color: #20B5C2;
+}
+
+#applicationActions .cssMenuPanel .menuh li li:first-child:last-child a:link,
+#applicationActions .cssMenuPanel .menuh li li:first-child:last-child a:visited,
+#applicationActions .cssMenuPanel .menuh li li:first-child:last-child a:active,
+#applicationActions .cssMenuPanel .menuh li li:first-child:last-child p {
+ border-radius:0px 4px 4px 4px;
+ -webkit-border-radius:0px 4px 4px 4px;
+ -moz-border-radius:0px 4px 4px 4px;
+ background-color: #20B5C2;
+}
- #applicationActions .cssMenuPanel .menuh li:hover a,
- #applicationActions .cssMenuPanel .menuh li:hover p {
- color: #FFFFFF;
- background-color: #20B5C2;
- }
-
- #applicationActions .cssMenuPanel .menuh a:hover,
- #applicationActions .cssMenuPanel .menuh p:hover {
- color: #FFFFFF;
- background-color: #20B5C2;
- }
-
- #applicationActions .cssMenuPanel .menuh li li a:hover,
- #applicationActions .cssMenuPanel .menuh li li p:hover {
- color: #FFFFFF;
- background-color: #40C0CB !important;
- }
-
- #applicationActions ul.cssSubMenuItemsPanel {
- min-width:220px;
- }
-
- #applicationActions ul.cssSubMenuItemsPanel li.cssSubMenuItem p.disabled {
- color: lightgray;
- /*background-color: #F0EFEA;*/
-
- }
+
+#applicationActions .menuh a,
+#applicationActions .menuh p {
+ border: 0px solid #00477F;
+ padding: 0px 1em 0px 1em;
+ background-image:none !important;
+}
+
+#applicationActions .cssMenuPanel .menuh li:hover a,
+#applicationActions .cssMenuPanel .menuh li:hover p {
+ color: #FFFFFF;
+ background-color: #20B5C2;
+}
+
+#applicationActions .cssMenuPanel .menuh a:hover,
+#applicationActions .cssMenuPanel .menuh p:hover {
+ color: #FFFFFF;
+ background-color: #20B5C2;
+}
+
+#applicationActions .cssMenuPanel .menuh li li a:hover,
+#applicationActions .cssMenuPanel .menuh li li p:hover {
+ color: #FFFFFF;
+ background-color: #40C0CB !important;
+}
+
+#applicationActions ul.cssSubMenuItemsPanel {
+ min-width:220px;
+}
+
+ #applicationActions ul.cssSubMenuItemsPanel li.cssSubMenuItem p.disabled {
+ color: lightgray;
+ /*background-color: #F0EFEA;*/
+
+ }
/**************** ELEMENTS **************/
@@ -917,3 +952,17 @@ div.wicket-mask-dark {
}
+
+/*
+.copyLink {
+ font-family: arial, helvetica, sans-serif;
+
+ background-color: transparent;
+ color: #FFFFFF;
+ text-decoration: none;
+ text-transform: uppercase;
+ font-size: 0.9em;
+ font-weight: bold;
+ float:right;
+}
+*/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
index dd6d977..5056d66 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
@@ -53,9 +53,16 @@
<div class="clear"/>
- <div wicket:id="applicationActions" id="applicationActions"></div>
-
- </div>
+ <div wicket:id="applicationActions" id="applicationActions"/>
+ <div id="tertiaryMenu">
+ <div class="imgLinks">
+ <a wicket:id="copyLink" href="#">
+ <span> </span>
+ </a>
+ </div>
+ </div>
+
+ </div>
<div id="body">
<wicket:child/>
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/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 3d7f4b0..578aa50 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
@@ -28,24 +28,23 @@ import com.google.inject.Inject;
import com.google.inject.name.Named;
import org.apache.wicket.Application;
-import org.apache.wicket.Component;
import org.apache.wicket.RestartResponseAtInterceptPageException;
-import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.event.Broadcast;
import org.apache.wicket.markup.head.CssReferenceHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.head.JavaScriptReferenceHeaderItem;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.markup.head.OnLoadHeaderItem;
import org.apache.wicket.markup.head.PriorityHeaderItem;
-import org.apache.wicket.markup.head.filter.FilteredHeaderItem;
import org.apache.wicket.markup.head.filter.HeaderResponseContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.ExternalLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;
+import org.apache.wicket.request.IRequestParameters;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.JavaScriptResourceReference;
import org.slf4j.Logger;
@@ -55,12 +54,13 @@ import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
import org.apache.isis.applib.services.exceprecog.ExceptionRecognizerComposite;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames;
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
+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.models.ActionPrompt;
import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
import org.apache.isis.viewer.wicket.model.models.ApplicationActionsModel;
@@ -71,6 +71,7 @@ import org.apache.isis.viewer.wicket.ui.ComponentType;
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.zclip.ZeroClipboardLink;
import org.apache.isis.viewer.wicket.ui.errors.ExceptionModel;
import org.apache.isis.viewer.wicket.ui.errors.JGrowlUtil;
import org.apache.isis.viewer.wicket.ui.pages.about.AboutPage;
@@ -99,12 +100,19 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
public static final String ID_MENU_LINK = "menuLink";
public static final String ID_LOGOUT_LINK = "logoutLink";
public static final String ID_ABOUT_LINK = "aboutLink";
+ private static final String ID_COPY_LINK = "copyLink";
+
private static final JavaScriptResourceReference JQUERY_JGROWL_JS = new JavaScriptResourceReference(PageAbstract.class, "jquery.jgrowl.js");
/**
* @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");
@@ -153,6 +161,7 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
addUserName();
addLogoutLink();
addAboutLink();
+ addCopyLink();
add(new Label(ID_PAGE_TITLE, title != null? title: applicationName));
@@ -199,6 +208,7 @@ 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());
@@ -251,6 +261,11 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
});
}
+ private void addCopyLink() {
+ AjaxLink<ObjectAdapter> zClipCopyLink = new ZeroClipboardLink(ID_COPY_LINK, ".entityHeaderPanel a.entityUrlSource");
+ addOrReplace(zClipCopyLink);
+ }
+
/**
* As provided in the {@link #PageAbstract(ComponentType) constructor}.
@@ -340,6 +355,23 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
// ///////////////////////////////////////////////////////////////////
+ // UI Hint
+ // ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Propogate any received events down to all child components.
+ */
+ public void onEvent(org.apache.wicket.event.IEvent<?> event) {
+ Object payload = event.getPayload();
+ if(payload instanceof UiHintsSetEvent) {
+ UiHintsSetEvent setEv = (UiHintsSetEvent)payload;
+ UiHintsBroadcastEvent broadcastEv = new UiHintsBroadcastEvent(setEv.getTarget());
+ send(this, Broadcast.BREADTH, broadcastEv);
+ }
+ }
+
+
+ // ///////////////////////////////////////////////////////////////////
// Convenience
// ///////////////////////////////////////////////////////////////////
@@ -372,4 +404,6 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
return IsisContext.getMessageBroker();
}
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/copy-26.png
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/copy-26.png b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/copy-26.png
new file mode 100644
index 0000000..e9473c8
Binary files /dev/null and b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/copy-26.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
index d34b217..b942a31 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
@@ -37,6 +37,7 @@ import org.apache.isis.core.metamodel.facets.actions.homepage.HomePageFacet;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.feature.Contributed;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
import org.apache.isis.viewer.wicket.model.models.ActionModel;
import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
@@ -87,7 +88,12 @@ public class EntityPage extends PageAbstract {
private EntityPage(PageParameters pageParameters, EntityModel entityModel, String titleString) {
super(pageParameters, ApplicationActions.INCLUDE, titleString, ComponentType.ENTITY);
this.model = entityModel;
- addChildComponents(model);
+ //try {
+ // UiHintContainer.CURRENT.set(entityModel);
+ addChildComponents(model);
+ //} finally {
+ // UiHintContainer.CURRENT.set(null);
+ //}
final ObjectAndAction objectAndAction =lookupHomePageAction();
final ActionModel actionModel = ActionModel.create(objectAndAction.objectAdapter, objectAndAction.action);
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
index cd7e2b9..8604da7 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.isis.wicket.viewer.js
@@ -68,6 +68,16 @@ $(document).ready(function() {
});
});
+
+
+// $('a#zclip-copy').zclip({
+// path:'/wicket/wicket/resource/org.apache.isis.viewer.wicket.ui.pages.PageAbstract/ZeroClipboard.swf',
+// copy:$('a#zclip-source').attr("href")
+// });
+//
+// $('a#zclip-copy').zclip('show');
+
+
});
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
index 32cfdee..adc0443 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
@@ -38,6 +38,7 @@ import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
import org.apache.isis.viewer.wicket.ui.ComponentType;
@@ -79,6 +80,7 @@ public abstract class PanelAbstract<T extends IModel<?>> extends Panel implement
this.componentType = ComponentType.lookup(id);
}
+
/**
* Will be null if created using {@link #PanelAbstract(String, IModel)}.
*/
@@ -138,6 +140,14 @@ public abstract class PanelAbstract<T extends IModel<?>> extends Panel implement
PanelUtil.renderHead(response, this.getClass());
}
+
+ // ///////////////////////////////////////////////////////////////////
+ // Hint support
+ // ///////////////////////////////////////////////////////////////////
+
+ public UiHintContainer getUiHintContainer() {
+ return UiHintContainer.Util.hintContainerOf(this);
+ }
// ///////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
index 36c1148..f8003b5 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
@@ -32,6 +32,7 @@ import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
+import org.apache.wicket.event.Broadcast;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
@@ -42,6 +43,9 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.isis.core.commons.lang.StringExtensions;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+import org.apache.isis.viewer.wicket.model.hints.UiHintsSetEvent;
import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
import org.apache.isis.viewer.wicket.model.links.LinksProvider;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
@@ -53,7 +57,7 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
import org.apache.isis.viewer.wicket.ui.util.Components;
import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends PanelAbstract<T> {
+public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends PanelAbstract<T> implements UiHintPathSignificant {
private static final long serialVersionUID = 1L;
@@ -70,6 +74,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
private static final String ID_VIEW_TITLE = "viewTitle";
private final ComponentType componentType;
+ private final String underlyingIdPrefix;
private ComponentFactory selectedComponentFactory;
protected Component selectedComponent;
@@ -81,13 +86,21 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
*/
protected WebMarkupContainer additionalLinks;
+
public LinksSelectorPanelAbstract(final String id, final String underlyingIdPrefix, final T model, final ComponentFactory factory) {
super(id, model);
-
- componentType = factory.getComponentType();
-
- addAdditionalLinks(model);
- addUnderlyingViews(underlyingIdPrefix, model, factory);
+ this.underlyingIdPrefix = underlyingIdPrefix;
+ this.componentType = factory.getComponentType();
+ }
+
+ /**
+ * Build UI only after added to parent.
+ */
+ public void onInitialize() {
+ super.onInitialize();
+ ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
+ addAdditionalLinks(getModel());
+ addUnderlyingViews(underlyingIdPrefix, getModel(), componentFactory);
}
protected void addAdditionalLinks(final T model) {
@@ -111,11 +124,11 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
markupContainer.addOrReplace(additionalLinks);
}
-
+
private void addUnderlyingViews(final String underlyingIdPrefix, final T model, final ComponentFactory factory) {
final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
- final int selected = determineInitialFactory(componentFactories, model);
+ final int selected = determineView(componentFactories, model);
final LinksSelectorPanelAbstract<T> selectorPanel = LinksSelectorPanelAbstract.this;
@@ -170,6 +183,12 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
+ LinksSelectorPanelAbstract<T> linksSelectorPanel = LinksSelectorPanelAbstract.this;
+ UiHintContainer hintContainer = linksSelectorPanel.getUiHintContainer();
+ if(hintContainer != null) {
+ hintContainer.setHint(LinksSelectorPanelAbstract.this, "view", ""+underlyingViewNum);
+ send(getPage(), Broadcast.EXACT, new UiHintsSetEvent(target));
+ }
final T dummyModel = dummyOf(model);
for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
@@ -181,6 +200,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
applyCssVisibility(component, isSelected);
component.setDefaultModel(isSelected? model: dummyModel);
}
+
selectorPanel.selectedComponentFactory = componentFactory;
selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
selectorPanel.onSelect(target);
@@ -216,6 +236,8 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
}
}
+
+
/**
* Overrideable hook.
*/
@@ -237,6 +259,23 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
component.add(modifier);
}
+ protected int determineView(final List<ComponentFactory> componentFactories, final IModel<?> model) {
+ UiHintContainer hintContainer = getUiHintContainer();
+ if(hintContainer != null) {
+ String hintValue = hintContainer.getHint(this, "view");
+ if(hintValue != null) {
+ return Integer.parseInt(hintValue);
+ }
+ }
+
+ int initialFactory = determineInitialFactory(componentFactories, model);
+ if(hintContainer != null) {
+ hintContainer.setHint(this, "view", ""+initialFactory);
+ }
+ return initialFactory;
+ }
+
+
protected abstract int determineInitialFactory(final List<ComponentFactory> componentFactories, final IModel<?> model);
private List<ComponentFactory> findOtherComponentFactories(final T model, final ComponentFactory ignoreFactory) {
@@ -254,10 +293,12 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
return otherFactories;
}
+
@Override
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);
PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java
index d8eeed5..5225c70 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Links.java
@@ -19,12 +19,15 @@
package org.apache.isis.viewer.wicket.ui.util;
import org.apache.wicket.Page;
+import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.form.SubmitLink;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames;
+
public final class Links {
public static <T extends Page> AbstractLink newSubmitLink(final String linkId, final PageParameters pageParameters, final Class<T> pageClass) {
@@ -52,7 +55,30 @@ public final class Links {
public static <T extends Page> AbstractLink newBookmarkablePageLink(
final String linkId, final PageParameters pageParameters, final Class<T> pageClass) {
+
return new BookmarkablePageLink<T>(linkId, pageClass, pageParameters);
}
+ public static <T extends Page> AbstractLink newBookmarkablePageLinkWithHints(
+ final String linkId, final PageParameters pageParameters, final Class<T> pageClass) {
+
+ final String hints = PageParameterNames.HINTS.getStringFrom(pageParameters);
+ if(hints != null) {
+ PageParameterNames.HINTS.removeFrom(pageParameters);
+ return new BookmarkablePageLink<T>(linkId, pageClass, pageParameters) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected CharSequence appendAnchor(ComponentTag tag, CharSequence url) {
+ if(url != null) {
+ url = url + "#" + hints;
+ }
+ return url;
+ }
+ };
+ } else {
+ return newBookmarkablePageLink(linkId, pageParameters, pageClass);
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index d1477f7..eb881ab 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -77,11 +77,15 @@
* Twitter Bootstrap, licensed under ASL v2 [2]
* JGrowl (JQuery plugin), licensed under MIT license [3]
* LiveQuery (JQuery plugin), licensed under MIT license [4]
+* ZClip (JQuery plugin), licensed under MIT license [5]
+* ZeroClipboard library, licensed under MIT license [6]
[1] http://jquery.org/license/
[2] http://getbootstrap.com/2.3.2/
[3] https://github.com/stanlemon/jGrowl/blob/master/jquery.jgrowl.js
-[4] https://github.com/brandonaaron/livequery#license</license.additional-notes>
+[4] https://github.com/brandonaaron/livequery#license
+[5] http://www.steamdev.com/zclip/
+[6] https://github.com/zeroclipboard/ZeroClipboard</license.additional-notes>
</properties>
<scm>
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItems.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItems.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItems.java
index 73863e1..a81430c 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItems.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItems.java
@@ -228,7 +228,7 @@ public class ToDoItems {
container.persist(toDoItem);
container.flush();
- container.informUser("new todo item created!");
+
return toDoItem;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
index 8015da3..1c07e08 100644
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
@@ -111,6 +111,10 @@
<filter-name>ResourceCachingFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.swf</url-pattern>
+ </filter-mapping>
<servlet>
<servlet-name>Resource</servlet-name>
@@ -140,6 +144,10 @@
<servlet-name>Resource</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.swf</url-pattern>
+ </servlet-mapping>
http://git-wip-us.apache.org/repos/asf/isis/blob/bb2d31e1/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml b/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
index 6edf0c8..c718385 100644
--- a/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
+++ b/example/application/simple_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/web.xml
@@ -111,6 +111,10 @@
<filter-name>ResourceCachingFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
+ <filter-mapping>
+ <filter-name>ResourceCachingFilter</filter-name>
+ <url-pattern>*.swf</url-pattern>
+ </filter-mapping>
<servlet>
<servlet-name>Resource</servlet-name>
@@ -140,6 +144,10 @@
<servlet-name>Resource</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Resource</servlet-name>
+ <url-pattern>*.swf</url-pattern>
+ </servlet-mapping>