You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by dr...@apache.org on 2007/09/26 20:01:42 UTC
svn commit: r579738 - in
/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core:
./ xhtml/ xhtml/jsLibs/
Author: drobinson
Date: Wed Sep 26 11:01:41 2007
New Revision: 579738
URL: http://svn.apache.org/viewvc?rev=579738&view=rev
Log:
TRINIDAD-736
Added DialogStyleScriptlet to handle output of dialog styles for use by DialogRequest and SimpleInputDateRenderer. Will also be used by Color Picker once that moves over.
Added:
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/DialogStyleScriptlet.java
Modified:
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java?rev=579738&r1=579737&r2=579738&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/DialogRequest.java Wed Sep 26 11:01:41 2007
@@ -32,6 +32,7 @@
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.DialogStyleScriptlet;
/**
*
@@ -90,19 +91,9 @@
if (_usePopup)
{
- // Output the style classes to the styleClassMap
- out.writeText("TrPage.getInstance().addStyleClassMap( {'", null);
- out.writeText(SkinSelectors.AF_DIALOG_CONTAINER_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_CONTAINER_STYLE_CLASS), null);
- out.writeText("','" + SkinSelectors.AF_DIALOG_CONTENT_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_CONTENT_STYLE_CLASS), null);
- out.writeText("','" + SkinSelectors.AF_DIALOG_TITLEBAR_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_TITLEBAR_STYLE_CLASS), null);
- out.writeText("','" + SkinSelectors.AF_DIALOG_TITLE_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_TITLE_STYLE_CLASS), null);
- out.writeText("','" + SkinSelectors.AF_DIALOG_CLOSE_ICON_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_CLOSE_ICON_STYLE_CLASS), null);
- out.writeText("'} ); ", null);
+ // Use the common scriplet to output the javascript
+ // that sets the skin entries for the lightweight dialogs.
+ DialogStyleScriptlet.outputStyleMapForDialog(context, arc);
// Finally output the call to launch the dialog
out.writeText("TrPopupDialog._launchDialog(\"", null);
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java?rev=579738&r1=579737&r2=579738&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SimpleInputDateRenderer.java Wed Sep 26 11:01:41 2007
@@ -48,6 +48,7 @@
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
import org.apache.myfaces.trinidadinternal.renderkit.core.pages.GenericEntry;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.ConfigurationScriptlet;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.DialogStyleScriptlet;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs.Scriptlet;
@@ -214,6 +215,14 @@
arc,
_DATE_TIME_ZONE_OFFSET_KEY);
+ // Add the dialog styles so the picker window is skinned correctly
+ if (CoreRenderKit.usePopupForDialog(context, RequestContext.getCurrentInstance()))
+ {
+ XhtmlUtils.addLib(context,
+ arc,
+ DialogStyleScriptlet.sharedInstance().getScriptletKey());
+ }
+
super.renderIcon(context, arc, component, bean);
}
Added: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/DialogStyleScriptlet.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/DialogStyleScriptlet.java?rev=579738&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/DialogStyleScriptlet.java (added)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/DialogStyleScriptlet.java Wed Sep 26 11:01:41 2007
@@ -0,0 +1,88 @@
+/*
+ * 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.myfaces.trinidadinternal.renderkit.core.xhtml.jsLibs;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.trinidad.context.RenderingContext;
+
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
+
+/**
+ * Scriptlet which defines the styles needed for lightweight dialogs
+ */
+public class DialogStyleScriptlet extends Scriptlet
+{
+ public DialogStyleScriptlet()
+ {
+ }
+
+ @Override
+ public Object getScriptletKey()
+ {
+ return DIALOG_STYLES_KEY;
+ }
+
+ static public Scriptlet sharedInstance()
+ {
+ if (_sInstance == null)
+ {
+ _sInstance = new DialogStyleScriptlet();
+ _sInstance.registerSelf();
+ }
+ return _sInstance;
+ }
+
+ @Override
+ protected void outputScriptletContent(
+ FacesContext context,
+ RenderingContext arc) throws IOException
+ {
+ DialogStyleScriptlet.outputStyleMapForDialog(context, arc);
+ }
+
+ public static void outputStyleMapForDialog(
+ FacesContext context,
+ RenderingContext arc) throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+
+ // Output the style classes to the styleClassMap
+ writer.writeText("TrPage.getInstance().addStyleClassMap( {'", null);
+ writer.writeText(SkinSelectors.AF_DIALOG_CONTAINER_STYLE_CLASS + "':'", null);
+ writer.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_CONTAINER_STYLE_CLASS), null);
+ writer.writeText("','" + SkinSelectors.AF_DIALOG_CONTENT_STYLE_CLASS + "':'", null);
+ writer.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_CONTENT_STYLE_CLASS), null);
+ writer.writeText("','" + SkinSelectors.AF_DIALOG_TITLEBAR_STYLE_CLASS + "':'", null);
+ writer.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_TITLEBAR_STYLE_CLASS), null);
+ writer.writeText("','" + SkinSelectors.AF_DIALOG_TITLE_STYLE_CLASS + "':'", null);
+ writer.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_TITLE_STYLE_CLASS), null);
+ writer.writeText("','" + SkinSelectors.AF_DIALOG_CLOSE_ICON_STYLE_CLASS + "':'", null);
+ writer.writeText(arc.getStyleClass(SkinSelectors.AF_DIALOG_CLOSE_ICON_STYLE_CLASS), null);
+ writer.writeText("'} ); ", null);
+ }
+
+ public static final String DIALOG_STYLES_KEY = "DialogStyles";
+ private static DialogStyleScriptlet _sInstance = null;
+
+}
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java?rev=579738&r1=579737&r2=579738&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java Wed Sep 26 11:01:41 2007
@@ -78,6 +78,7 @@
JspDirScriptlet.sharedInstance().registerSelf();
ConfigurationScriptlet.sharedInstance().registerSelf();
GlobalVariablesScriptlet.sharedInstance().registerSelf();
+ DialogStyleScriptlet.sharedInstance().registerSelf();
}