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/08/27 22:46:08 UTC
svn commit: r570239 - in
/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main:
java/org/apache/myfaces/trinidadinternal/renderkit/core/
java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/
javascript/META-INF/adf/jsLibs/ resources/META-INF...
Author: drobinson
Date: Mon Aug 27 13:46:07 2007
New Revision: 570239
URL: http://svn.apache.org/viewvc?rev=570239&view=rev
Log:
TRINIDAD-654 & TRINIDAD-651
Fixed close-icon on l/w dialogs.
Also added new skin selectors for skinning dialogs seperately from panelPopup.
Added:
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/images/close.gif (with props)
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/SkinSelectors.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss
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=570239&r1=570238&r2=570239&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 Mon Aug 27 13:46:07 2007
@@ -92,14 +92,16 @@
{
// Output the style classes to the styleClassMap
out.writeText("TrPage.getInstance().addStyleClassMap( {'", null);
- out.writeText(SkinSelectors.AF_PANEL_POPUP_CONTAINER_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_PANEL_POPUP_CONTAINER_STYLE_CLASS), null);
- out.writeText("','" + SkinSelectors.AF_PANEL_POPUP_CONTENT_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_PANEL_POPUP_CONTENT_STYLE_CLASS), null);
- out.writeText("','" + SkinSelectors.AF_PANEL_POPUP_TITLE_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_PANEL_POPUP_TITLE_STYLE_CLASS), null);
- out.writeText("','" + SkinSelectors.AF_PANEL_POPUP_TITLEBAR_STYLE_CLASS + "':'", null);
- out.writeText(arc.getStyleClass(SkinSelectors.AF_PANEL_POPUP_TITLEBAR_STYLE_CLASS), 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);
// Finally output the call to launch the dialog
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java?rev=570239&r1=570238&r2=570239&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java Mon Aug 27 13:46:07 2007
@@ -220,6 +220,24 @@
// //
// //
+ // ========================= Lightweight Dialog=========================== //
+ // //
+ // //
+ private static final String AF_DIALOG_ROOT_STYLE_CLASS = "af|dialog";
+
+ public static final String AF_DIALOG_CONTAINER_STYLE_CLASS =
+ AF_DIALOG_ROOT_STYLE_CLASS + "::container";
+ public static final String AF_DIALOG_CONTENT_STYLE_CLASS =
+ AF_DIALOG_ROOT_STYLE_CLASS + "::content";
+ public static final String AF_DIALOG_TITLEBAR_STYLE_CLASS =
+ AF_DIALOG_ROOT_STYLE_CLASS + "::title-bar";
+ public static final String AF_DIALOG_TITLE_STYLE_CLASS =
+ AF_DIALOG_ROOT_STYLE_CLASS + "::title-text";
+ public static final String AF_DIALOG_CLOSE_ICON_STYLE_CLASS =
+ AF_DIALOG_ROOT_STYLE_CLASS + "::close-icon";
+
+ // //
+ // //
// =========================== tr:breadCrumbs ============================ //
// //
// //
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?rev=570239&r1=570238&r2=570239&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Mon Aug 27 13:46:07 2007
@@ -441,6 +441,54 @@
};
+/**
+ * Adds an event handler to an element.
+ * @param obj The element against which the event handler should be registered
+ * @param exType The event handler type such as 'change', 'blur', 'click' etc.
+ * @param fn The function to call when the event occurs
+ */
+function _addEvent(obj, evType, fn)
+{
+ if (obj.addEventListener)
+ {
+ obj.addEventListener(evType, fn, false);
+ return true;
+ }
+ else if (obj.attachEvent)
+ {
+ var r = obj.attachEvent("on"+evType, fn);
+ return r;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+/**
+ * Removes an event handler from an element.
+ * @param obj The element against which the event handler is regsitered
+ * @param exType The event handler type such as 'change', 'blur', 'click' etc.
+ * @param fn The event handler function to remove from the element
+ */
+function _removeEvent(obj, evType, fn)
+{
+ // TODO: abstract onto Agent object
+ if (obj.removeEventListener)
+ {
+ obj.removeEventListener(evType, fn, false);
+ return true;
+ }
+ else if (obj.detachEvent)
+ {
+ var r = obj.detachEvent("on"+evType, fn);
+ return r;
+ }
+ else
+ {
+ return false;
+ }
+}
/**
* Gets the preferred width of the content
@@ -1288,9 +1336,9 @@
// If we got this far, we know there's something to display so
// make the inline message and icon visible.
if (msgElem)
- msgElem.style.display = "inline";
+ msgElem.style.display = "";
if (iconElem)
- iconElem.style.display = "inline";
+ iconElem.style.display = "";
}
return noFailures;
@@ -1302,23 +1350,26 @@
* input field.
* <p>
* The simplest usage of this method is from the onblur attribute of the
- * input component. e.g. onblur="_validateInput(this);"
+ * input component. e.g. onblur="_validateInput(event);"
* <p>
- * @param input The input element to validate.
+ * @param event, The event object provided by the event handler.
* @return boolean, false if validation failed, otherwise true.
*/
// TODO: make this a public function only after hanging it on
// a namespaced object, *and* making it not specific to inline
// validation
-function _validateInput(input)
+function _validateInput(event)
{
- if (!input)
+ if (!event)
return true;
- var id = _getID(input);
- if (!id)
+
+ // Get the element associated with the event
+ var inputElem = event.target || event.srcElement;
+
+ if (!inputElem || !inputElem.id)
return true;
- var form = _getForm(input);
+ var form = _getForm(inputElem);
if (!form)
return true;
@@ -1326,7 +1377,17 @@
if (!validators)
return true;
+ var id = inputElem.id;
+
var descriptor = validators[id];
+
+ // If we couldn't find the descriptor by id, then try by name
+ // as it might be a radio button
+ if (!descriptor && inputElem.name)
+ {
+ id = inputElem.name;
+ descriptor = validators[id];
+ }
if (!descriptor)
return true;
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js?rev=570239&r1=570238&r2=570239&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PanelPopup.js Mon Aug 27 13:46:07 2007
@@ -346,14 +346,20 @@
//create mask for modal popups
TrPanelPopup._mask = document.createElement('div');
TrPanelPopup._mask.name = "TrPanelPopup._BlockingModalDiv";
- TrPanelPopup._mask.style.cssText = "display:none;position: absolute; z-index: 5000;top: 0px;left: 0px;cursor: not-allowed; background-color: transparent;";
+ var cssText = "display:none;position: absolute; z-index: 5000;top: 0px;left: 0px;cursor: not-allowed;";
+ if (_agent.isIE && _agent.version == 7)
+ //workaround for bug in IE7 : see http://blog.thinkature.com/index.php/2006/12/29/odd-mouse-handling-with-transparent-objects-under-internet-explorer-7/
+ cssText = cssText + "background-color: white; filter: alpha(opacity=0);";
+ else
+ cssText = cssText + "background-color: transparent";
+ TrPanelPopup._mask.style.cssText = cssText;
TrPanelPopup._mask.innerHTML = " ";
//consume all events
- TrPanelPopup._addEvent(TrPanelPopup._mask, "click", TrPanelPopup._consumeMaskEvent);
+ _addEvent(TrPanelPopup._mask, "click", TrPanelPopup._consumeMaskEvent);
//handle window resize events
- TrPanelPopup._addEvent(window, "resize", TrPanelPopup._setMaskSize);
+ _addEvent(window, "resize", TrPanelPopup._setMaskSize);
//set initial mask size
TrPanelPopup._setMaskSize();
@@ -372,8 +378,8 @@
**/
TrPanelPopup._hideMask = function()
{
- TrPanelPopup._removeEvent(TrPanelPopup._mask, "click", TrPanelPopup._consumeMaskEvent);
- TrPanelPopup._removeEvent(window, "resize", TrPanelPopup._setMaskSize);
+ _removeEvent(TrPanelPopup._mask, "click", TrPanelPopup._consumeMaskEvent);
+ _removeEvent(window, "resize", TrPanelPopup._setMaskSize);
TrPanelPopup._mask.style.display = "none";
}
@@ -441,45 +447,6 @@
return false;
}
-//useful event registration function
-TrPanelPopup._addEvent = function(obj, evType, fn)
-{
- // TODO: abstract onto Agent object
- if (obj.addEventListener)
- {
- obj.addEventListener(evType, fn, false);
- return true;
- }
- else if (obj.attachEvent)
- {
- var r = obj.attachEvent("on"+evType, fn);
- return r;
- }
- else
- {
- return false;
- }
-}
-
-//useful event deregistration function
-TrPanelPopup._removeEvent = function(obj, evType, fn)
-{
- // TODO: abstract onto Agent object
- if (obj.removeEventListener)
- {
- obj.removeEventListener(evType, fn, false);
- return true;
- }
- else if (obj.detachEvent)
- {
- var r = obj.detachEvent("on"+evType, fn);
- return r;
- }
- else
- {
- return false;
- }
-}
/*
* Sizes/resizes the modal mask if the window size changes
@@ -561,7 +528,7 @@
//create single reusable iframe if not already inited
TrPanelPopup._maskIframe = document.createElement('iframe');
TrPanelPopup._maskIframe.name = "TrPanelPopup._ieOnlyZIndexIframe";
- TrPanelPopup._maskIframe.style.cssText = "display: none; left: 0px; position: absolute; top: 0px; z-index: 199;";
+ TrPanelPopup._maskIframe.style.cssText = "display: none; left: 0px; position: absolute; top: 0px; z-index: 4999;";
TrPanelPopup._maskIframe.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
// FIXME: should this be set to avoid SSL warnings?
//TrPanelPopup._maskIframe.src = "javascript:false;"
@@ -590,8 +557,8 @@
TrHoverPopup.prototype.showPopup = function(event)
{
// Setup event listener for mouse leaving trigger or content elements
- TrPanelPopup._addEvent(this.getTrigger(), "mouseout", this._hoverCallbackFunction);
- TrPanelPopup._addEvent(this.getContent(), "mouseout", this._hoverCallbackFunction);
+ _addEvent(this.getTrigger(), "mouseout", this._hoverCallbackFunction);
+ _addEvent(this.getContent(), "mouseout", this._hoverCallbackFunction);
this.show(event);
}
@@ -618,8 +585,8 @@
if (!currElement)
{
// Cancel event listeners
- TrPanelPopup._removeEvent(this.getTrigger(), "mouseout", this._hoverCallbackFunction);
- TrPanelPopup._removeEvent(this.getContent(), "mouseout", this._hoverCallbackFunction);
+ _removeEvent(this.getTrigger(), "mouseout", this._hoverCallbackFunction);
+ _removeEvent(this.getContent(), "mouseout", this._hoverCallbackFunction);
this.hide(event);
}
@@ -654,7 +621,7 @@
{
if (!this.isModal())
// Setup event listener for clicking off the popup
- TrPanelPopup._addEvent(document, "click", this._clickCallbackFunction);
+ _addEvent(document, "click", this._clickCallbackFunction);
this.show(event);
}
@@ -677,7 +644,7 @@
if (!currElement)
{
// Cancel event listeners
- TrPanelPopup._removeEvent(document, "click", this._clickCallbackFunction);
+ _removeEvent(document, "click", this._clickCallbackFunction);
//if click was on something other than the popupContainer
this.hide(event);
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js?rev=570239&r1=570238&r2=570239&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/PopupDialog.js Mon Aug 27 13:46:07 2007
@@ -18,39 +18,61 @@
*/
function TrPopupDialog()
{
+ var page = TrPage.getInstance();
+
var div = document.createElement("div");
- div.style.cssText = "visibility:hidden; position: absolute; z-index: 201;";
+ div.style.cssText = "visibility:hidden; position: absolute;";
+ div.className = page.getStyleClass("af|dialog::container");
//setup the title bar
var titlebar = document.createElement("div");
+ titlebar.className = page.getStyleClass("af|dialog::title-bar");
div.appendChild(titlebar);
- this._titleDiv = titlebar;
+
+ //setup the title bar
+ var titleText = document.createElement("div");
+ titleText.style.cssText = "float:left;";
+ titleText.className = page.getStyleClass("af|dialog::title-text");
+ titlebar.appendChild(titleText);
+
+ //setup the title bar
+ var closerDiv = document.createElement("div");
+ closerDiv.style.cssText = "float:right;";
+ closerDiv.className = page.getStyleClass("af|dialog::close-icon");
+ _addEvent(closerDiv, "click", TrPopupDialog._returnFromDialog);
+ titlebar.appendChild(closerDiv);
+
+ //setup the title bar
+ var sepDiv = document.createElement("div");
+ sepDiv.style.cssText = "clear:both;";
+ titlebar.appendChild(sepDiv);
//setup the content iframe
var iframe = document.createElement("iframe");
iframe.name = "_blank";
iframe.frameBorder = "0";
+ iframe.className = page.getStyleClass("af|dialog::content");
+ div.appendChild(iframe);
- //hold the iframe so we can set the 'src' as needed.
+ // Hold the iframe so we can set the 'src' as needed, and also the height
this._iframe = iframe;
+
+ // Hold on to the outer div so we can set the width
+ this._outerDiv = div;
+
+ // Hold on to the text div so we can update the title
+ this._titleTextDiv = titleText;
- div.appendChild(iframe);
document.body.appendChild(div);
- TrPanelPopup.call(this)
+ TrPanelPopup.call(this);
this.setModal(true);
this.setCentered(true);
this.setContent(div);
- // flag to indicate if dialog should resize to content
+ // flag to indicate if dialog size should be locked
this._fixedSize = false;
- var page = TrPage.getInstance();
- div.className = page.getStyleClass("af|panelPopup::container");
- iframe.className = page.getStyleClass("af|panelPopup::content");
- titlebar.className = page.getStyleClass("af|panelPopup::title-text") +
- ' ' +
- page.getStyleClass("af|panelPopup::title-bar");
}
// TrPopupDialog inherits from TrPanelPopup
@@ -63,13 +85,11 @@
{
if (title)
{
- this._titleDiv.innerHTML = title;
- this._titleDiv.style.display = "block";
+ this._titleTextDiv.innerHTML = title;
}
else
{
- this._titleDiv.innerHTML = "";
- this._titleDiv.style.display = "none";
+ this._titleTextDiv.innerHTML = "";
}
}
@@ -97,8 +117,12 @@
**/
TrPopupDialog.prototype._resizeIFrame = function(width, height)
{
- this._iframe.height = height;
- this._iframe.width = width;
+ // Set the height of the iframe
+ this._iframe.height = height + "px";
+ // Set the width of the iframe to 100% so it is sized by it's parent outerDiv
+ this._iframe.width = "100%";
+ // But set the width of the outerDiv, so the title bar is also the right size
+ this._outerDiv.style.width = width + "px";
this._calcPosition(false);
}
Added: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/images/close.gif
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/images/close.gif?rev=570239&view=auto
==============================================================================
Binary file - no diff available.
Propchange: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/images/close.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss?rev=570239&r1=570238&r2=570239&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss Mon Aug 27 13:46:07 2007
@@ -657,6 +657,46 @@
<style name="AFRequiredLabel">
</style>
+ <!--
+ Lighweight Dialog Styles
+ -->
+
+ <style selector="af|dialog::container">
+ <includeStyle name="AFVeryDarkBorder"/>
+ <property name="border">1px solid</property>
+ <property name="background-color">white</property>
+ </style>
+
+ <style selector="af|dialog::title-bar">
+ <includeStyle name="AFDarkAccentBackground"/>
+ <includeStyle name="AFVeryDarkBorder"/>
+ <property name="border-bottom">1px solid</property>
+ <property name="padding">2px 2px 2px 2px</property>
+ </style>
+
+ <style selector="af|dialog::title-text">
+ <includeStyle name="AFDefaultFont"/>
+ <includeStyle name="AFMediumFont"/>
+ <property name="white-space">nowrap</property>
+ <property name="overflow">hidden</property>
+ </style>
+
+ <style selector="af|dialog::close-icon">
+ <includeStyle name="AFDefaultFont"/>
+ <includeStyle name="AFMediumFont"/>
+ <property name="margin-left">5px</property>
+ <property name="background-image">url('/adf/images/close.gif')</property>
+ <property name="background-position">center</property>
+ <property name="background-repeat">no-repeat</property>
+ <property name="height">13px</property>
+ <property name="width">13px</property>
+ </style>
+
+ <style selector="af|dialog::content">
+ <includeStyle name="AFLightAccentBackground"/>
+ <property name="border">0px</property>
+ </style>
+
<!-- Per component selectors -->
<style selector="af|inputColor:required::label">
<includeStyle name="AFRequiredLabel"/>