labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r880810 - in /labs/magma/trunk/website-layouts-yui-tabs: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/magma/ src/main/java/org/apache/magma/website/ src/main/java/org/apache/magma/we...
Date Mon, 16 Nov 2009 15:46:16 GMT
Author: simoneg
Date: Mon Nov 16 15:46:15 2009
New Revision: 880810

URL: http://svn.apache.org/viewvc?rev=880810&view=rev
Log:
YUI based tabs implementation

Added:
    labs/magma/trunk/website-layouts-yui-tabs/pom.xml
    labs/magma/trunk/website-layouts-yui-tabs/src/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/java/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/website/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/website/layouts/
    labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/website/layouts/YUITabs.java
    labs/magma/trunk/website-layouts-yui-tabs/src/main/resources/
    labs/magma/trunk/website-layouts-yui-tabs/src/test/
    labs/magma/trunk/website-layouts-yui-tabs/src/test/java/
    labs/magma/trunk/website-layouts-yui-tabs/src/test/resources/

Added: labs/magma/trunk/website-layouts-yui-tabs/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-layouts-yui-tabs/pom.xml?rev=880810&view=auto
==============================================================================
--- labs/magma/trunk/website-layouts-yui-tabs/pom.xml (added)
+++ labs/magma/trunk/website-layouts-yui-tabs/pom.xml Mon Nov 16 15:46:15 2009
@@ -0,0 +1,24 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>magma-parent</artifactId>
+    <groupId>org.apache.magma</groupId>
+    <version>3</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.magma</groupId>
+  <artifactId>website-layouts-yui-tabs</artifactId>
+  <name>Layouts YUI Tabs</name>
+  <version>0.0.3-SNAPSHOT</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.magma</groupId>
+      <artifactId>website-layouts</artifactId>
+      <version>0.0.3-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.magma</groupId>
+      <artifactId>website-yui</artifactId>
+      <version>0.0.2-SNAPSHOT</version>
+    </dependency>    
+  </dependencies>
+</project>
\ No newline at end of file

Added: labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/website/layouts/YUITabs.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/website/layouts/YUITabs.java?rev=880810&view=auto
==============================================================================
--- labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/website/layouts/YUITabs.java
(added)
+++ labs/magma/trunk/website-layouts-yui-tabs/src/main/java/org/apache/magma/website/layouts/YUITabs.java
Mon Nov 16 15:46:15 2009
@@ -0,0 +1,84 @@
+/*
+ * 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.magma.website.layouts;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.List;
+
+import org.apache.magma.website.Head;
+
+import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
+
+public class YUITabs extends Tabs {
+	
+	private String uniqueId = Long.toHexString(System.currentTimeMillis()) + this.hashCode();
+
+	@Override
+	public void head(Head head) {
+		head.addYUIScript("yahoo-dom-event/yahoo-dom-event.js");
+		head.addYUIScript("element/element-beta-min.js");
+		head.addYUIScript("connection/connection-min.js");
+		head.addYUIScript("tabview/tabview-min.js");
+		head.addYUICss("tabview/assets/skins/sam/tabview.css");
+		head.addRawScript(uniqueId + "-yui-tab", "new YAHOO.widget.TabView('" + uniqueId + "',
{activeIndex:" + getOpened() + "});");
+		super.head(head);
+	}
+	
+	@Override
+	protected void openContainer(Writer writer) throws IOException {
+		writer.write("<div id=\"" + uniqueId +"\" class=\"yui-navset\"> " +
+					 "<ul class=\"yui-nav\">");
+		List<String> names = super.getPanelNames();
+		for (int i = 0; i < names.size(); i++) {
+			writer.write("<li");
+			if (getOpened() == i) {
+				writer.write(" class=\"selected\"");
+			}
+			writer.write("><a href=\"#tab" + i + "\"><em>" + names.get(i) + "</em></a></li>");
+		}
+		writer.write("</ul>");
+		writer.write("<div class=\"yui-content\">");
+	}
+	
+	@Override
+	protected void openPanel(Writer stream, String name) throws IOException {
+		stream.write("<div");
+		try {
+			if (!getPanelNames().get(getOpened()).equals(name)) {
+				stream.write(" class=\"yui-hidden\"");
+			}
+		} catch (Exception e) {
+			// No problem if an exception happens here
+		}
+		stream.write(">");
+	}
+	
+	@Override
+	protected void closePanel(Writer stream, String name) throws IOException {
+		stream.write("</div>");
+	}
+	
+	@Override
+	protected void closeContainer(Writer stream) throws IOException {
+		stream.write("</div>");
+		stream.write("</div>");
+	}
+	
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message