Author: pete
Date: Sat Sep  4 07:31:20 2010
New Revision: 992554

URL: http://svn.apache.org/viewvc?rev=992554&view=rev
Log:
added missing resources for AbstractTree

Added:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree-images.png
   (with props)
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree.css
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-closed.gif
   (with props)
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-open.gif
   (with props)
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/item.gif
   (with props)
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/tree.js

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree-images.png
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree-images.png?rev=992554&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree-images.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree.css
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree.css?rev=992554&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree.css
 (added)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/base-tree.css
 Sat Sep  4 07:31:20 2010
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+
+table.wicket-tree-content {
+       border-collapse: collapse;
+       empty-cells: show;
+}
+
+table.wicket-tree-content,
+table.wicket-tree-content td,
+table.wicket-tree-content tr,
+table.wicket-tree-content th {
+       padding: 0;
+       margin: 0;
+}
+
+table.wicket-tree-content td.spacer {
+       width: 18px;
+       height: 100%;
+}
+
+table.wicket-tree-content td.spacer span,
+table.wicket-tree-content td.line span {
+       display: block;
+       width: 18px;
+       height: 18px;
+}
+
+table.wicket-tree-content td.line {
+       width: 18px;
+       height: 100%;
+       background: url("base-tree-images.png") repeat-y -36px center;
+}
+
+table.wicket-tree-content td.half-line {
+       width: 18px;
+       height: 100%;
+       background: url("base-tree-images.png") no-repeat -72px center;
+}
+
+table.wicket-tree-content a.junction-open,
+table.wicket-tree-content a.junction-closed,
+table.wicket-tree-content span.junction-corner {
+       width: 18px;
+       height: 18px;
+       display: block;
+       background: url("base-tree-images.png") no-repeat;
+       margin: 0;
+       padding: 0;
+       border-width: 0;
+}
+
+table.wicket-tree-content a.junction-open {
+       background-position: -18px center;
+}
+
+table.wicket-tree-content a.junction-closed {
+       background-position: 0 center;
+}
+
+table.wicket-tree-content span.junction-corner {
+       background-position: -54px center;
+}
+
+table.wicket-tree-content table.icon-panel {
+       border-collapse: collapse;
+       empty-cells: show;
+}
+
+table.wicket-tree-content table.icon-panel, 
+table.wicket-tree-content table.icon-panel tr,
+table.wicket-tree-content table.icon-panel td {
+       margin: 0;
+       padding: 0;
+}
+
+table.wicket-tree-content table.icon-panel img {
+       padding: 0;
+       margin: -1px 0 0 2px;
+       display: block;
+       border-width: 0;
+}
+
+table.wicket-tree-content.selected {
+       background-color: #E0E8FF;
+       font-weight: bold;      
+}
+
+table.wicket-tree-content.selected .content {
+       font-weight: bold;      
+}
+
+table.wicket-tree-content table.icon-panel a {
+       text-decoration: none;
+       color: #3311aa;
+}
+
+table.wicket-tree-content table.icon-panel a:hover {
+       text-decoration: underline;
+       color: #3311aa;
+}
+
+table.wicket-tree-content table.icon-panel img.icon {
+       cursor: pointer;
+}
+
+table.icon-panel {
+       width: 100%;
+}
+
+table.icon-panel td.content {
+       width: 100%;
+}
+
+table.icon-panel td.content a {
+       padding-right: 0.4em;
+}

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-closed.gif
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-closed.gif?rev=992554&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-closed.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-open.gif
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-open.gif?rev=992554&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/folder-open.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/item.gif
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/item.gif?rev=992554&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/item.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/tree.js
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/tree.js?rev=992554&view=auto
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/tree.js
 (added)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/tree/res/tree.js
 Sat Sep  4 07:31:20 2010
@@ -0,0 +1,179 @@
+/*
+ * 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.
+ */
+
+if (typeof(Wicket) == "undefined")
+       Wicket = { };
+
+Wicket.Tree = { };
+
+Wicket.Tree.askForReload = function()
+{
+   if (confirm("There was a problem updating the tree. It might be caused be 
the old page being cached by the browser. \n" +
+   "It is recommended to reload the page. Do you want to reload it?"))
+   {
+      window.location.reload();
+   }
+};
+
+Wicket.Tree.removeNodes = function(prefix, nodeList)
+{
+   var problem = false;
+   for (var i = 0; i < nodeList.length; i++)
+   {
+      var e = document.getElementById(prefix + nodeList[i]);
+      if (e != null)
+      {
+         e.parentNode.removeChild(e);
+      }
+      else
+      {
+         // while developing alert a warning
+         problem = true;
+         Wicket.Log.error("Can't find node with id " + prefix + nodeList[i] +
+         ". This shouldn't happen - possible bug in tree?");
+      }
+   }
+   if (problem == true)
+   {
+      Wicket.Tree.askForReload();
+   }
+};
+
+Wicket.Tree.createElement = function(elementId, afterId)
+{
+   var existing = Wicket.$(elementId);
+   if (typeof(existing) != "undefined" && existing != null)
+   {
+      Wicket.Tree.askForReload();
+   }
+
+   var after = document.getElementById(afterId);
+   var newNode = document.createElement(after.tagName);
+   newNode.setAttribute("id", elementId);
+
+   var p = after.parentNode;
+
+   for (var i = 0; i < p.childNodes.length; ++i)
+   {
+      if (after == p.childNodes[i])
+         break;
+   }
+   if (i == p.childNodes.length - 1)
+   {
+      p.appendChild(newNode);
+   }
+   else
+   {
+      p.insertBefore(newNode, p.childNodes[i + 1]);
+   }
+};
+
+Wicket.TreeTable = { };
+
+/* Javascript that resizes the tree table header so that it matches size of 
the content.
+   This is needed when the scrollbar next to content is show, so that the 
columns are 
+   properly aligned */
+Wicket.TreeTable.update = function(elementId)
+{
+
+   var element = document.getElementById(elementId);
+
+   if (element != null && typeof(element) != "undefined")
+   {
+
+      try
+      {
+
+         /// find the div containing the inner header div
+         var headerParent = element.getElementsByTagName("div")[1];
+
+         // find the inner header div
+         var header = headerParent.getElementsByTagName("div")[0];
+
+         // body div should be next div after header parent
+         var body = headerParent.nextSibling;
+
+         // interate until div is found
+         while (body.tagName != "DIV")
+         {
+            body = body.nextSibling;
+         }
+
+         // last check to find out if we are updating the right component
+         if (body.className == "wicket-tree-table-body")
+         {
+
+            // get the right padding from header - we need to substract it 
from new width
+            var padding;
+            if (document.defaultView && document.defaultView.getComputedStyle)
+            {
+               padding = document.defaultView.getComputedStyle(headerParent, 
'').getPropertyValue("padding-right");
+            } else if (headerParent.currentStyle)
+            {
+               padding = headerParent.currentStyle.paddingRight;
+            }
+            else
+            {
+               padding = 6;
+            }
+
+            padding = parseInt(padding, 10);
+
+            // set the new width
+            var w = (body.getElementsByTagName("div")[0].clientWidth - 
padding) + "px";
+
+            if (w == (-padding) + "px")
+            { // this can happen if the first row is hidden (e.g. rootless 
mode)
+               // try to get the width from second row
+               w = (body.getElementsByTagName("div")[1].clientWidth - padding) 
+ "px";
+
+            }
+
+            if (w != "0px")
+            {
+               header.style.width = w;
+            }
+
+         }
+      }
+      catch (ignore)
+      {
+      }
+   }
+};
+
+Wicket.TreeTable.attached = new Object();
+
+Wicket.TreeTable.attachUpdate = function(treeTableId)
+{
+   // get the object that contains ids of elements on which the update method 
was already attached
+   var attached = Wicket.TreeTable.attached;
+
+   // force updating the element
+   Wicket.TreeTable.update(treeTableId);
+
+   // if the update has not been attached to this tree table yet...
+   if (typeof(attached[treeTableId]) == "undefined")
+   {
+      // ... attach it
+      attached[treeTableId] = window.setInterval(function()
+      {
+         Wicket.TreeTable.update(treeTableId);
+      }, 100);
+   }
+};
+


Reply via email to