You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2007/04/14 16:31:04 UTC
svn commit: r528831 - in /incubator/xap/trunk/codebase/src/xap/bridges/ext:
ViewletBridge.js ViewletPane.js
Author: mturyn
Date: Sat Apr 14 09:31:03 2007
New Revision: 528831
URL: http://svn.apache.org/viewvc?view=rev&rev=528831
Log:
Enhanced effectsPane, includes titlebar and close/show widgets
From: Rob Gagne
Added:
incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletBridge.js
incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletPane.js
Added: incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletBridge.js?view=auto&rev=528831
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletBridge.js (added)
+++ incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletBridge.js Sat Apr 14 09:31:03 2007
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ *
+ */
+
+ /**
+ * @fileoverview
+ * @author Rob Gagne
+ *
+ * A bridge class that provides animations effects
+ */
+
+/*
+ * this library requires Scriptaculous to be loaded
+ *
+ */
+
+Xap.provide("xap.bridges.ext.ViewletBridge");
+
+Xap.require("xap.bridges.dojo.DojoWidgetBridge");
+Xap.require("xap.bridges.ext.ViewletPane");
+Xap.require("dojo.style");
+
+xap.bridges.ext.ViewletBridge.loaded = false;
+
+xap.bridges.ext.ViewletBridge= function() {
+ this._duration = 1;
+ xap.bridges.dojo.DojoWidgetBridge.call(this);
+}
+
+Xap.setupClassAsSubclassOf(
+ "xap.bridges.ext.ViewletBridge",
+ "xap.bridges.dojo.DojoWidgetBridge"
+);
+
+xap.bridges.ext.ViewletBridge.prototype.getPeerString = function(){
+ /*
+ This widget requires the following libraries to be loaded:
+ prototype.js
+ scriptaculous.js?load=effects
+ */
+ return "ViewletPane" ;
+}
+
+/**
+ * Attribute definitions
+ */
+
+xap.bridges.ext.ViewletBridge.prototype.getNewAllowedAttributes = function(){
+ return ["toggle", "effect", "duration", "title"];
+}
+
+/** XML attribute set method for "toggle" */
+xap.bridges.ext.ViewletBridge.prototype.setToggleAttribute = function(value){
+ var node = this.getPeer().domNode;
+ if ( !node ) return;
+ node.style.visibility = 'visible';
+ new Effect.toggle (node, value, {duration: this._duration});
+ /* supports
+ Effect.toggle(element, ['appear' | 'slide' | 'blind'], [options] );
+ */
+}
+
+xap.bridges.ext.ViewletBridge.prototype.setEffectAttribute = function(value){
+ var node = this.getPeer().domNode;
+ var dur = this._duration;
+ if ( !node ) return;
+ node.style.visibility = 'visible';
+
+ if ( value == 'blinddown' ) new Effect.BlindDown (node, {duration: dur, queue: 'end'});
+ if ( value == 'appear' ) new Effect.Appear (node, {duration: dur, queue: 'end'});
+ if ( value == 'blindup' ) new Effect.BlindUp (node, {duration: dur, queue: 'end'});
+ if ( value == 'fade' ) new Effect.Fade (node, {duration: dur, queue: 'end'});
+ if ( value == 'highlight' ) new Effect.Highlight (node, {duration: dur, queue: 'end'} );
+
+}
+
+/** XML attribute set method for "duration" */
+xap.bridges.ext.ViewletBridge.prototype.setDurationAttribute = function(value){
+ this._duration = value;
+}
+
+/** XML attribute set method for "title" */
+xap.bridges.ext.ViewletBridge.prototype.setTitleAttribute = function(value){
+ var node = this.getPeer().domNode;
+ if ( node && node.parentNode )
+ node.parentNode.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.innerHTML = value;
+}
+
+xap.bridges.ext.ViewletBridge.prototype.addChild = function(childHandler, index) {
+ var childPeer = this.getDojoWidgetPeer(childHandler);
+ if (childPeer) {
+ this.getPeer().addChild(childPeer, null, 'insertAtIndex', null, index);
+ }
+}
+
\ No newline at end of file
Added: incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletPane.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletPane.js?view=auto&rev=528831
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletPane.js (added)
+++ incubator/xap/trunk/codebase/src/xap/bridges/ext/ViewletPane.js Sat Apr 14 09:31:03 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ */
+
+
+Xap.provide("xap.bridges.ext.ViewletPane");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.dom");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.event");
+
+dojo.widget.manager.registerWidgetPackage("xap.bridges.ext");
+dojo.widget.tags.addParseTreeHandler("dojo:ViewletPane");
+
+xap.bridges.ext.ViewletPane = function(){
+ dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.bridges.ext.ViewletPane, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.bridges.ext.ViewletPane, {
+ templateString:
+ '<div>'
+ + '<div id="header">'
+ + '<div id="expand" onclick="Effect.BlindUp (this.parentNode.nextSibling, {duration: .5, queue: \'end\'}); '
+ + 'this.style.display=\'none\'; this.nextSibling.style.display=\'inline\';"> </div>'
+ + '<div id="shrink" style="display: none;" onclick="Effect.BlindDown (this.parentNode.nextSibling, {duration: .5, queue: \'end\'}); '
+ + 'this.style.display=\'none\'; this.previousSibling.style.display=\'inline\';"> </div>'
+ + '<div id="close" onclick="Effect.Fade (this.parentNode.parentNode, {duration: .5, queue: \'end\'});">'
+ + ' </div>'
+ + '<span>Title Bar</span>'
+ + '</div>'
+ + '<div dojoAttachPoint="containerNode" id="container" style="position: relative; overflow: hidden;"/></div>'
+ + '</div>',
+ templateCssPath: null ,
+ widgetType: "ViewletPane",
+ isContainer: true,
+
+ addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
+ xap.bridges.ext.ViewletPane.superclass.addChild.call(this,child, overrideContainerNode, pos, ref, insertIndex);
+ }
+}
+);
+
+