You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2013/10/29 16:20:23 UTC
svn commit: r1536748 - in /myfaces/tobago/trunk:
tobago-example/tobago-example-sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/
tobago-example/tobago-example-sandbox/src/main/resources/
tobago-example/tobago-example-sandbox/src/main/web...
Author: weber
Date: Tue Oct 29 15:20:22 2013
New Revision: 1536748
URL: http://svn.apache.org/r1536748
Log:
TOBAGO-1332 - SplitLayout
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/webapp/sandbox.xhtml
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISplitLayout.java
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/taglib/sandbox/SplitLayoutTagDeclaration.java
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/SplitLayoutRenderer.java
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/script/
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/script/tobago.js
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/resources/log4j.xml
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/property/tobago-theme-config.properties
myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/style/tobago.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/pom.xml
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java?rev=1536748&r1=1536747&r2=1536748&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java Tue Oct 29 15:20:22 2013
@@ -32,6 +32,9 @@ public class Controller {
private int sliderValue;
private String[] shuffleValue;
+ private String splitLayout1 = "1*;1*";
+ private String splitLayout2 = "1*;1*";
+
public String action1() {
LOG.info("action 1");
return null;
@@ -75,4 +78,20 @@ public class Controller {
public String submit() {
return null;
}
+
+ public String getSplitLayout1() {
+ return splitLayout1;
+ }
+
+ public void setSplitLayout1(String splitLayout1) {
+ this.splitLayout1 = splitLayout1;
+ }
+
+ public String getSplitLayout2() {
+ return splitLayout2;
+ }
+
+ public void setSplitLayout2(String splitLayout2) {
+ this.splitLayout2 = splitLayout2;
+ }
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/resources/log4j.xml?rev=1536748&r1=1536747&r2=1536748&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/resources/log4j.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/resources/log4j.xml Tue Oct 29 15:20:22 2013
@@ -39,6 +39,10 @@
</layout>
</appender>
+ <!--<category name="org.apache.myfaces.tobago.internal.context.ResourceLocator">-->
+ <!--<priority value="info"/>-->
+ <!--</category>-->
+
<root>
<priority value="info" />
<appender-ref ref="console" />
Added: myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/webapp/sandbox.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/webapp/sandbox.xhtml?rev=1536748&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/webapp/sandbox.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-sandbox/src/main/webapp/sandbox.xhtml Tue Oct 29 15:20:22 2013
@@ -0,0 +1,55 @@
+<?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.
+-->
+
+<f:view
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tcs="http://myfaces.apache.org/tobago/sandbox">
+ <tc:page label="tobago sandbox" id="page">
+ <f:facet name="layout">
+ <tc:gridLayout columns="250px;1*"/>
+ </f:facet>
+
+ <tc:panel id="nav">
+ <tc:out value="nav" />
+ </tc:panel>
+
+ <tc:panel id="content">
+ <f:facet name="layout">
+ <tcs:splitLayout layout="#{controller.splitLayout1}" orientation="VERTICAL"/>
+ </f:facet>
+
+ <tc:box label="Box im oberen Split-Bereich ">
+ <tc:out id="oben" value="box content oben" />
+ </tc:box>
+ <tc:box label="Box im unteren Split-Bereich ">
+ <f:facet name="layout">
+ <tcs:splitLayout layout="#{controller.splitLayout2}" orientation="HORIZONTAL"/>
+ </f:facet>
+ <tc:box label="Box im unteren linken Split-Bereich ">
+ <tc:out id="untenL" value="content unten Links" />
+ </tc:box>
+ <tc:box label="Box im unteren rechten Split-Bereich ">
+ <tc:out id="untenR" value="content unten Rechts" />
+ </tc:box>
+ </tc:box>
+ </tc:panel>
+
+ </tc:page>
+</f:view>
Modified: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml?rev=1536748&r1=1536747&r2=1536748&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml Tue Oct 29 15:20:22 2013
@@ -221,6 +221,11 @@
</dependency>
<dependency>
<groupId>org.apache.myfaces.tobago</groupId>
+ <artifactId>tobago-theme-scarborough</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.tobago</groupId>
<artifactId>tobago-core</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
Added: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISplitLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISplitLayout.java?rev=1536748&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISplitLayout.java (added)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISplitLayout.java Tue Oct 29 15:20:22 2013
@@ -0,0 +1,144 @@
+package org.apache.myfaces.tobago.internal.component;
+
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.Orientation;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+public abstract class AbstractUISplitLayout extends AbstractUIGridLayout {
+
+ public static final String VERTICAL = Orientation.VERTICAL.name();
+ public static final String HORIZONTAL = Orientation.HORIZONTAL.name();
+
+ public String submittedLayout;
+
+// @Override
+// public LayoutContainer getLayoutContainer() {
+// return new SplitLayoutContainer(this);
+// }
+
+ public void updateLayout(int position) {
+ LayoutContainer container = (LayoutContainer) getParent();
+ int oldPosition;
+
+ int currentMeasure1;
+ int currentMeasure2;
+ if (HORIZONTAL.equals(getOrientation())) {
+ oldPosition = container.getComponents().get(1).getLeft().getPixel() - 5;
+ currentMeasure1 = container.getComponents().get(0).getCurrentWidth().getPixel();
+ currentMeasure2 = container.getComponents().get(1).getCurrentWidth().getPixel();
+ } else {
+ oldPosition = container.getComponents().get(1).getTop().getPixel() - 5;
+ currentMeasure1 = container.getComponents().get(0).getCurrentHeight().getPixel();
+ currentMeasure2 = container.getComponents().get(1).getCurrentHeight().getPixel();
+ }
+
+ int offset = position - oldPosition;
+ int newMeasure1 = currentMeasure1 + offset;
+ int newMeasure2 = currentMeasure2 - offset;
+
+ int ggt = gcd(newMeasure1, newMeasure2);
+ submittedLayout = new StringBuilder()
+ .append(Integer.toString(newMeasure1 / ggt)).append("*;")
+ .append(Integer.toString(newMeasure2 / ggt)).append("*")
+ .toString();
+ }
+
+ // TODO: MathUtils
+ public static int gcd(int a, int b) {
+ if (a < 0) {
+ a = -a;
+ }
+ if (b < 0) {
+ b = -b;
+ }
+ int t;
+ while (b != 0) {
+ t = a % b;
+ a = b;
+ b = t;
+ }
+ return a;
+ }
+
+ @Override
+ public void processUpdates(FacesContext facesContext) {
+ updateModel(facesContext);
+ super.processUpdates(facesContext);
+ }
+
+ private void updateModel(FacesContext facesContext) {
+ if (submittedLayout != null) {
+ final ValueExpression expression = getValueExpression("layout");
+ if (expression != null) {
+ final ELContext elContext = facesContext.getELContext();
+ expression.setValue(elContext, submittedLayout);
+ submittedLayout = null;
+ }
+ }
+ }
+
+ public Measure getSpacing(Orientation orientation) {
+ return orientation == Orientation.HORIZONTAL ? getColumnSpacing() : getRowSpacing();
+ }
+
+@Override
+ public void setColumns(String columns) {
+ }
+
+ @Override
+ public String getColumns() {
+ return VERTICAL.equals(getOrientation()) ? "1*" : getLayout2();
+ }
+
+// private String getLayout2() {
+// return getLayout().replace(";", ";5px;");
+// }
+
+ @Override
+ public void setRows(String rows) {
+ }
+
+ @Override
+ public String getRows() {
+ return HORIZONTAL.equals(getOrientation()) ? "1*" : getLayout2();
+ }
+
+ private String getLayout2() {
+ return submittedLayout != null ? submittedLayout : getLayout();
+ }
+
+ @Override
+ public boolean isRowOverflow() {
+ return false;
+ }
+
+ @Override
+ public boolean isColumnOverflow() {
+ return false;
+ }
+
+ public abstract String getLayout();
+
+ public abstract String getOrientation();
+
+ @Deprecated
+ public abstract Measure getCellspacing();
+
+ public abstract Measure getRowSpacing();
+
+ public abstract Measure getColumnSpacing();
+
+ public abstract Measure getMarginLeft();
+
+ public abstract Measure getMarginTop();
+
+ public abstract Measure getMarginRight();
+
+ public abstract Measure getMarginBottom();
+
+ public abstract boolean isRigid();
+}
Added: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/taglib/sandbox/SplitLayoutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/taglib/sandbox/SplitLayoutTagDeclaration.java?rev=1536748&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/taglib/sandbox/SplitLayoutTagDeclaration.java (added)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/internal/taglib/sandbox/SplitLayoutTagDeclaration.java Tue Oct 29 15:20:22 2013
@@ -0,0 +1,44 @@
+package org.apache.myfaces.tobago.internal.taglib.sandbox;
+
+import org.apache.myfaces.tobago.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.internal.component.AbstractUIGridLayout;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasBinding;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasBorder;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasCurrentMarkup;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasId;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasMargin;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasMargins;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasSpacing;
+import org.apache.myfaces.tobago.layout.Orientation;
+
+@Tag(name = "splitLayout", bodyContent = BodyContent.EMPTY)
+@UIComponentTag(
+ uiComponent = "org.apache.myfaces.tobago.component.UISplitLayout",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUISplitLayout",
+ uiComponentFacesClass = "javax.faces.component.UIComponentBase",
+ componentFamily = AbstractUIGridLayout.COMPONENT_FAMILY,
+ rendererType = "SplitLayout",
+ allowedChildComponenents = "NONE", isLayout = true)
+public interface SplitLayoutTagDeclaration extends HasId, HasBorder, HasSpacing, HasMargin,
+ HasMargins, HasBinding, HasMarkup, HasCurrentMarkup {
+
+ @TagAttribute
+ @UIComponentTagAttribute(defaultValue = "1*;1*")
+ void setLayout(String rows);
+
+ @TagAttribute
+ @UIComponentTagAttribute(allowedValues = {"HORIZONTAL", "VERTICAL"})
+ void setOrientation(String orientation);
+
+ /**
+ * This attribute advises the layout manager, to not use space that comes from non rendered components.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "boolean")
+ void setRigid(String rigid);
+}
Added: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/SplitLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/SplitLayoutRenderer.java?rev=1536748&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/SplitLayoutRenderer.java (added)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/SplitLayoutRenderer.java Tue Oct 29 15:20:22 2013
@@ -0,0 +1,105 @@
+package org.apache.myfaces.tobago.renderkit.html.sandbox.standard.tag;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import sun.util.calendar.LocalGregorianCalendar;
+
+import org.apache.myfaces.tobago.internal.component.AbstractUISplitLayout;
+import org.apache.myfaces.tobago.layout.Display;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.css.Position;
+import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
+import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
+import org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag.GridLayoutRenderer;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
+import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+public class SplitLayoutRenderer extends GridLayoutRenderer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SplitLayoutRenderer.class);
+
+ @Override
+ public void decode(FacesContext facesContext, UIComponent component) {
+ String clientId = component.getClientId();
+ Map<String,String> parameterMap = facesContext.getExternalContext().getRequestParameterMap();
+ String position = parameterMap.get(clientId + "_spLP");
+ ((AbstractUISplitLayout) component).updateLayout(Integer.parseInt(position));
+ }
+
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ LayoutContainer container = (LayoutContainer) ((AbstractUISplitLayout) component).getParent();
+ if (!((LayoutContainer) container).isLayoutChildren()) {
+ return;
+ } else {
+ List<LayoutComponent> components = container.getComponents();
+ if (components.size() != 2) {
+ LOG.warn("Illegal component count in splitLayout: {}", components.size());
+ }
+ RenderUtils.encode(facesContext, (UIComponent) components.get(0));
+ RenderUtils.encode(facesContext, (UIComponent) components.get(1));
+ encodeHandle(facesContext, (AbstractUISplitLayout) component);
+ }
+ }
+
+ protected void encodeHandle(FacesContext facesContext, AbstractUISplitLayout layout) throws IOException {
+ String id = layout.getClientId(facesContext);
+
+ TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ writer.startElement(HtmlElements.SPAN, layout);
+ writer.writeIdAttribute(id + "_spLH");
+ writer.writeAttribute("data-tobago-split-layout", layout.getOrientation().toLowerCase(), true);
+ Style style = calculateHandleStyle(layout);
+ writer.writeStyleAttribute(style);
+ writer.writeClassAttribute(Classes.create(layout, layout.getOrientation().toLowerCase()));
+
+ int position;
+ if (AbstractUISplitLayout.HORIZONTAL.equals(layout.getOrientation())) {
+ position = style.getLeft().getPixel();
+ } else {
+ position = style.getTop().getPixel();
+ }
+ writer.startElement(HtmlElements.INPUT, null);
+ writer.writeIdAttribute(id + "_spLP");
+ writer.writeNameAttribute(id + "_spLP");
+ writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
+ writer.writeAttribute(HtmlAttributes.VALUE, Integer.toString(position), false);
+ writer.endElement(HtmlElements.INPUT);
+
+
+ writer.endElement(HtmlElements.SPAN);
+
+ }
+
+ private Style calculateHandleStyle(AbstractUISplitLayout layout) {
+ LayoutContainer container = (LayoutContainer) ((AbstractUISplitLayout) layout).getParent();
+ LayoutComponent secondComponent = container.getComponents().get(1);
+ Style style = new Style();
+ if (AbstractUISplitLayout.HORIZONTAL.equals(layout.getOrientation())) {
+ style.setWidth(Measure.valueOf(5));
+ style.setHeight(container.getCurrentHeight());
+ style.setLeft(Measure.valueOf(secondComponent.getLeft().subtract(5)));
+ style.setTop(Measure.valueOf(0));
+ } else {
+ style.setWidth(container.getCurrentWidth());
+ style.setHeight(Measure.valueOf(5));
+ style.setLeft(Measure.valueOf(0));
+ style.setTop(Measure.valueOf(Measure.valueOf(secondComponent.getTop().subtract(5))));
+ }
+ style.setDisplay(Display.BLOCK);
+ style.setPosition(Position.ABSOLUTE);
+ return style;
+ }
+}
Modified: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/property/tobago-theme-config.properties?rev=1536748&r1=1536747&r2=1536748&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/property/tobago-theme-config.properties Tue Oct 29 15:20:22 2013
@@ -19,3 +19,7 @@
# agent: standard
NumberSlider.sliderWidthPercent=66
+
+SplitLayout.cellSpacing=0
+SplitLayout.rowSpacing=5
+SplitLayout.columnSpacing=5
Added: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/script/tobago.js?rev=1536748&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/script/tobago.js (added)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/script/tobago.js Tue Oct 29 15:20:22 2013
@@ -0,0 +1,43 @@
+Tobago.SplitLayout = {
+ init: function(elements) {
+ Tobago.Utils.selectWidthJQuery(elements, "[data-tobago-split-layout]").each(Tobago.SplitLayout.initLayout);
+ },
+
+ initLayout: function() {
+ var handle = jQuery(this);
+ var options = {
+ containment: "parent",
+ distance: 10,
+ stop: Tobago.SplitLayout.stopDragging
+ };
+ if (handle.data("tobago-split-layout") == "horizontal") {
+ options.axis = "x"
+ } else {
+ options.axis = "y"
+ }
+ handle.draggable(options)
+ },
+
+ stopDragging: function(event, ui) {
+ var hidden = ui.helper.children("input");
+ if (ui.helper.data("tobago-split-layout") == "horizontal") {
+ hidden.val(ui.position.left)
+ } else {
+ hidden.val(ui.position.top)
+ }
+ var panel = Tobago.SplitLayout.findParentElementWithId(ui.helper);
+ var clientId = panel.id;
+ Tobago.reloadComponent(panel, clientId, clientId);
+ },
+
+ findParentElementWithId: function(element) {
+ var parent = element.parent();
+ while (parent.get(0).id === undefined || parent.get(0).id.length == 0) {
+ parent = parent.parent();
+ }
+ return parent.get(0);
+ }
+};
+
+Tobago.registerListener(Tobago.SplitLayout.init, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.SplitLayout.init, Tobago.Phase.DOCUMENT_READY);
\ No newline at end of file
Modified: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/style/tobago.css?rev=1536748&r1=1536747&r2=1536748&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/src/main/resources/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/style/tobago.css Tue Oct 29 15:20:22 2013
@@ -47,3 +47,17 @@
height: 3px;
background-color: #660000;
}
+
+.tobago-splitLayout-vertical:hover {
+ cursor: n-resize;
+ border: dotted #000000 thin;
+ /*background-color: blue;*/
+ z-index: 10000;
+}
+
+.tobago-splitLayout-horizontal:hover {
+ cursor: e-resize;
+ border: dotted #000000 thin;
+ /*background-color: blue;*/
+ z-index: 10000;
+}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/pom.xml?rev=1536748&r1=1536747&r2=1536748&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/pom.xml Tue Oct 29 15:20:22 2013
@@ -141,6 +141,11 @@
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</dependency>