You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/04/27 13:18:10 UTC
svn commit: r651921 [1/2] - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/context/
core/src/main/java/org/apache/myfaces/tobago/renderkit/
core/src/main/java/org/apache/my...
Author: bommel
Date: Sun Apr 27 04:17:59 2008
New Revision: 651921
URL: http://svn.apache.org/viewvc?rev=651921&view=rev
Log:
(TOBAGO-655) Create a prepareRender Phase
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/PageFacesContextWrapper.java (with props)
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTagDeclaration.java (with props)
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTagDeclaration.java (with props)
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ScriptRenderer.java (with props)
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/StyleRenderer.java (with props)
Removed:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Window.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectMany.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectOne.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractRendererBaseWrapper.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutRenderer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRenderer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBaseWrapper.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FormTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseJsonWriterImpl.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AbstractTobagoTagLibrary.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/InputNumberSliderRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeListboxRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeRenderer.java
myfaces/tobago/trunk/theme/speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtil.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTag.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/CreateComponentAnnotationVisitor.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIFileInput.java Sun Apr 27 04:17:59 2008
@@ -18,12 +18,9 @@
*/
import org.apache.commons.fileupload.FileItem;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ENCTYPE;
import org.apache.myfaces.tobago.util.MessageFactory;
-import org.apache.myfaces.tobago.util.ComponentUtil;
import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
/*
@@ -31,16 +28,6 @@
* Time: 19:02:13
*/
public abstract class AbstractUIFileInput extends javax.faces.component.UIInput {
-
- public void setParent(UIComponent uiComponent) {
- super.setParent(uiComponent);
- AbstractUIPage form = ComponentUtil.findPage(getFacesContext(), uiComponent);
- if (form != null) {
- form.getAttributes().put(ATTR_ENCTYPE, "multipart/form-data");
- } else {
- getFacesContext().getExternalContext().getRequestMap().put(AbstractUIPage.ENCTYPE_KEY, "multipart/form-data");
- }
- }
public void validate(FacesContext facesContext) {
if (isRequired()) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java Sun Apr 27 04:17:59 2008
@@ -18,8 +18,6 @@
*/
import org.apache.commons.collections.KeyValue;
-import org.apache.commons.collections.list.SetUniqueList;
-import org.apache.commons.collections.set.ListOrderedSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
@@ -43,7 +41,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import java.util.StringTokenizer;
public abstract class AbstractUIPage extends AbstractUIForm implements InvokeOnComponent {
@@ -51,9 +48,6 @@
private static final Log LOG = LogFactory.getLog(AbstractUIPage.class);
public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Page";
- public static final String ENCTYPE_KEY = AbstractUIPage.class.getName() + ".enctype";
-
- public static final String DEFAULT_STYLE = "style/style.css";
private static final int DEFAULT_WIDTH = 1024;
@@ -67,47 +61,6 @@
private List<KeyValue> postfields;
- private SetUniqueList scriptFiles;
-
- private Set<String> scriptBlocks;
-
- private Set<String> styleFiles;
-
- private Set<String> styleBlocks;
-
- private Set<String> onloadScripts;
-
- private Set<String> onunloadScripts;
-
- private Set<String> onexitScripts;
-
- private Set<String> onsubmitScripts;
-
- private Set<AbstractUIPopup> popups;
-
-
- @SuppressWarnings("unchecked")
- public AbstractUIPage() {
- scriptFiles = SetUniqueList.decorate(new ArrayList());
- scriptBlocks = new ListOrderedSet();
- styleFiles = new ListOrderedSet();
- styleFiles.add(DEFAULT_STYLE);
- styleBlocks = new ListOrderedSet();
- onloadScripts = new ListOrderedSet();
- onunloadScripts = new ListOrderedSet();
- onexitScripts = new ListOrderedSet();
- onsubmitScripts = new ListOrderedSet();
- popups = new ListOrderedSet();
- }
-
- @Override
- public void encodeBegin(FacesContext facesContext) throws IOException {
- // TODO change this should be renamed to DimensionUtils.prepare!!!
- UILayout.getLayout(this).layoutBegin(facesContext, this);
- super.encodeBegin(facesContext);
- }
-
-
@Override
public void encodeChildren(FacesContext context) throws IOException {
}
@@ -127,8 +80,6 @@
decode(facesContext);
- clearScriptsAndPopups();
-
markSubmittedForm(facesContext);
// invoke processDecodes() on children
@@ -195,15 +146,6 @@
}
}
- private void clearScriptsAndPopups() {
- // clear script Set's
- getOnloadScripts().clear();
- getOnunloadScripts().clear();
- getOnexitScripts().clear();
- getScriptBlocks().clear();
- getPopups().clear();
- }
-
private void checkTobagoRequest(FacesContext facesContext) {
// multipart/form-data must use TobagoMultipartFormdataRequest
String contentType = (String) facesContext.getExternalContext()
@@ -302,44 +244,6 @@
public void setDefaultActionId(String defaultActionId) {
this.defaultActionId = defaultActionId;
}
-
- @SuppressWarnings("unchecked")
- public List<String> getScriptFiles() {
- return scriptFiles;
- }
-
- public Set<String> getScriptBlocks() {
- return scriptBlocks;
- }
-
- public Set<String> getStyleFiles() {
- return styleFiles;
- }
-
- public Set<String> getStyleBlocks() {
- return styleBlocks;
- }
-
- public Set<String> getOnloadScripts() {
- return onloadScripts;
- }
-
- public Set<String> getOnunloadScripts() {
- return onunloadScripts;
- }
-
- public Set<String> getOnexitScripts() {
- return onexitScripts;
- }
-
- public Set<String> getOnsubmitScripts() {
- return onsubmitScripts;
- }
-
- public Set<AbstractUIPopup> getPopups() {
- return popups;
- }
-
protected Integer getWidthInternal() {
Integer requestWidth =
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java Sun Apr 27 04:17:59 2008
@@ -42,7 +42,6 @@
public void setActivated(boolean activated) {
this.activated = activated;
- addToPage();
}
public void processDecodes(FacesContext facesContext) {
@@ -57,7 +56,6 @@
facesContext.renderResponse();
throw e;
}
- addToPage();
}
}
@@ -116,13 +114,6 @@
}
}
-
- public void setParent(UIComponent uiComponent) {
- super.setParent(uiComponent);
- // XXX find a better way
- addToPage();
- }
-
public Object saveState(FacesContext context) {
Object[] saveState = new Object[2];
saveState[0] = super.saveState(context);
@@ -134,14 +125,6 @@
Object[] values = (Object[]) savedState;
super.restoreState(context, values[0]);
activated = (Boolean) values[1];
- }
-
-
- private void addToPage() {
- AbstractUIPage page = ComponentUtil.findPage(getFacesContext(), this);
- if (page != null) {
- page.getPopups().add(this);
- }
}
public void encodeEnd(FacesContext context) throws IOException {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectMany.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectMany.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectMany.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectMany.java Sun Apr 27 04:17:59 2008
@@ -17,27 +17,11 @@
* limitations under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-
/*
* User: weber
* Date: May 31, 2005
* Time: 7:47:11 PM
*/
public abstract class AbstractUISelectMany extends javax.faces.component.UISelectMany implements SupportsMarkup {
-
- @SuppressWarnings("UnusedDeclaration")
- private static final Log LOG = LogFactory.getLog(AbstractUISelectMany.class);
-
-
- public void encodeBegin(FacesContext facesContext) throws IOException {
- // TODO change this should be renamed to DimensionUtils.prepare!!!
- UILayout.getLayout(this).layoutBegin(facesContext, this);
- super.encodeBegin(facesContext);
- }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectOne.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectOne.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectOne.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISelectOne.java Sun Apr 27 04:17:59 2008
@@ -21,7 +21,6 @@
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
-import java.io.IOException;
/*
* User: weber
@@ -31,12 +30,6 @@
public abstract class AbstractUISelectOne extends javax.faces.component.UISelectOne implements SupportsMarkup {
public static final String MESSAGE_VALUE_REQUIRED = "tobago.SelectOne.MESSAGE_VALUE_REQUIRED";
-
- public void encodeBegin(FacesContext facesContext) throws IOException {
- // TODO change this should be renamed to DimensionUtils.prepare!!!
- UILayout.getLayout(this).layoutBegin(facesContext, this);
- super.encodeBegin(facesContext);
- }
public void validate(FacesContext facesContext) {
if (isRequired()) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Sun Apr 27 04:17:59 2008
@@ -21,7 +21,6 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CALENDAR_DATE_INPUT_ID;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
@@ -44,7 +43,6 @@
import javax.faces.component.UIGraphic;
import javax.faces.context.FacesContext;
import javax.faces.event.FacesEvent;
-import java.util.Map;
/*
* Date: 30.05.2006
@@ -159,10 +157,6 @@
popup.setRendered(false);
- Map<String, Object> attributes = popup.getAttributes();
- attributes.put(ATTR_POPUP_RESET, Boolean.TRUE);
- //int popupHeight = ThemeConfig.getValue(facesContext, link, "CalendarPopupHeight");
- //attributes.put(ATTR_HEIGHT, String.valueOf(popupHeight));
final UIComponent box = CreateComponentUtils.createComponent(
facesContext, UIBox.COMPONENT_TYPE, RENDERER_TYPE_BOX);
popup.getChildren().add(box);
@@ -175,7 +169,6 @@
box.getFacets().put(FACET_LAYOUT, layout);
layout.setId("layout");
layout.getAttributes().put(ATTR_ROWS, "*;fixed;fixed");
-// layout.getAttributes().put(TobagoConstants.ATTR_BORDER, "1");
final UIComponent calendar = CreateComponentUtils.createComponent(
facesContext, javax.faces.component.UIOutput.COMPONENT_TYPE,
@@ -230,8 +223,7 @@
RENDERER_TYPE_BUTTON);
buttonPanel.getChildren().add(okButton);
okButton.setId("ok" + DatePickerController.CLOSE_POPUP);
- attributes = okButton.getAttributes();
- attributes.put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
+ okButton.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
facesContext, "tobago", "datePickerOk"));
final UICommand cancelButton =
@@ -239,8 +231,8 @@
org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
RENDERER_TYPE_BUTTON);
buttonPanel.getChildren().add(cancelButton);
- attributes = cancelButton.getAttributes();
- attributes.put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
+
+ cancelButton.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
facesContext, "tobago", "datePickerCancel"));
cancelButton.setId(DatePickerController.CLOSE_POPUP);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIInputBase.java Sun Apr 27 04:17:59 2008
@@ -37,12 +37,6 @@
}
}
- public void encodeBegin(FacesContext facesContext) throws IOException {
- // TODO change this should be renamed to DimensionUtils.prepare!!!
- UILayout.getLayout(this).layoutBegin(facesContext, this);
- super.encodeBegin(facesContext);
- }
-
public int encodeAjax(FacesContext facesContext) throws IOException {
return AjaxUtils.encodeAjaxComponent(facesContext, this);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java Sun Apr 27 04:17:59 2008
@@ -35,14 +35,12 @@
private static final Log LOG = LogFactory.getLog(UILayout.class);
public void layoutBegin(FacesContext facesContext, UIComponent component) {
- // prepare component to render
- prepareDimension(facesContext, component);
+
}
public static void prepareDimension(FacesContext facesContext, UIComponent component) {
-// LOG.info("prepareDimension for " + component.getClientId(facesContext) + " is " + component.getRendererType());
setInnerWidth(facesContext, component);
setInnerHeight(facesContext, component);
}
@@ -65,11 +63,9 @@
}
}
-
public void encodeChildrenOfComponent(FacesContext facesContext, UIComponent component) throws IOException {
((LayoutRenderer) getRenderer(facesContext)).encodeChildrenOfComponent(facesContext, component);
}
-
public static UILayout getLayout(UIComponent component) {
UILayout layout = (UILayout) component.getFacet(FACET_LAYOUT);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java Sun Apr 27 04:17:59 2008
@@ -35,12 +35,6 @@
public class UIPanelBase extends javax.faces.component.UIPanel
implements AjaxComponent, InvokeOnComponent {
- public void encodeBegin(FacesContext facesContext) throws IOException {
- // TODO change this should be renamed to DimensionUtils.prepare!!!
- UILayout.getLayout(this).layoutBegin(facesContext, this);
- super.encodeBegin(facesContext);
- }
-
public void encodeChildren(FacesContext facesContext) throws IOException {
if (isRendered()) {
UILayout.getLayout(this).encodeChildrenOfComponent(facesContext, this);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java Sun Apr 27 04:17:59 2008
@@ -67,8 +67,6 @@
public void encodeBegin(FacesContext facesContext)
throws IOException {
- // TODO change this should be renamed to DimensionUtils.prepare!!!
- UILayout.getLayout(this).layoutBegin(facesContext, this);
// debugStates(facesContext);
fixSelectionType();
super.encodeBegin(facesContext);
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/PageFacesContextWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/PageFacesContextWrapper.java?rev=651921&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/PageFacesContextWrapper.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/PageFacesContextWrapper.java Sun Apr 27 04:17:59 2008
@@ -0,0 +1,123 @@
+package org.apache.myfaces.tobago.context;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.collections.list.SetUniqueList;
+import org.apache.commons.collections.set.ListOrderedSet;
+import org.apache.myfaces.tobago.component.AbstractUIPopup;
+
+import javax.faces.context.FacesContext;
+import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class PageFacesContextWrapper extends FacesContextWrapper {
+
+ public static final String DEFAULT_STYLE = "style/style.css";
+
+ private SetUniqueList scriptFiles;
+
+ private Set<String> scriptBlocks;
+
+ private Set<String> styleFiles;
+
+ private Set<String> styleBlocks;
+
+ private Set<String> onloadScripts;
+
+ private Set<String> onunloadScripts;
+
+ private Set<String> onexitScripts;
+
+ private Set<String> onsubmitScripts;
+
+ private Set<AbstractUIPopup> popups;
+
+ private String enctype;
+
+
+ public PageFacesContextWrapper(FacesContext context) {
+ super(context);
+ scriptFiles = SetUniqueList.decorate(new ArrayList());
+ scriptBlocks = new ListOrderedSet();
+ styleFiles = new ListOrderedSet();
+ styleFiles.add(DEFAULT_STYLE);
+ styleBlocks = new ListOrderedSet();
+ onloadScripts = new ListOrderedSet();
+ onunloadScripts = new ListOrderedSet();
+ onexitScripts = new ListOrderedSet();
+ onsubmitScripts = new ListOrderedSet();
+ popups = new ListOrderedSet();
+ }
+
+ public String getEnctype() {
+ return enctype;
+ }
+
+ public void setEnctype(String enctype) {
+ this.enctype = enctype;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<String> getScriptFiles() {
+ return scriptFiles;
+ }
+
+ public Set<String> getScriptBlocks() {
+ return scriptBlocks;
+ }
+
+ public Set<String> getStyleFiles() {
+ return styleFiles;
+ }
+
+ public Set<String> getStyleBlocks() {
+ return styleBlocks;
+ }
+
+ public Set<String> getOnloadScripts() {
+ return onloadScripts;
+ }
+
+ public Set<String> getOnunloadScripts() {
+ return onunloadScripts;
+ }
+
+ public Set<String> getOnexitScripts() {
+ return onexitScripts;
+ }
+
+ public Set<String> getOnsubmitScripts() {
+ return onsubmitScripts;
+ }
+
+ public Set<AbstractUIPopup> getPopups() {
+ return popups;
+ }
+
+ private void clearScriptsAndPopups() {
+ // clear script Set's
+ getOnloadScripts().clear();
+ getOnunloadScripts().clear();
+ getOnexitScripts().clear();
+ getScriptBlocks().clear();
+ getPopups().clear();
+ }
+
+}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/PageFacesContextWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/PageFacesContextWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java Sun Apr 27 04:17:59 2008
@@ -25,7 +25,7 @@
public abstract class AbstractLayoutRendererWrapper
extends AbstractLayoutableRendererBaseWrapper implements LayoutRenderer {
- public void prepareRender(FacesContext facesContext, UIComponent component) {
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
((LayoutRenderer) getRenderer(facesContext)).prepareRender(facesContext, component);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java Sun Apr 27 04:17:59 2008
@@ -26,6 +26,10 @@
public abstract class AbstractLayoutableRendererBaseWrapper extends AbstractRendererBaseWrapper
implements LayoutableRenderer {
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ getLayoutableRenderer(facesContext).prepareRender(facesContext, component);
+ }
+
public int getHeaderHeight(FacesContext facesContext, UIComponent component) {
return getLayoutableRenderer(facesContext).getHeaderHeight(facesContext, component);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractRendererBaseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractRendererBaseWrapper.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractRendererBaseWrapper.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractRendererBaseWrapper.java Sun Apr 27 04:17:59 2008
@@ -31,6 +31,19 @@
public abstract class AbstractRendererBaseWrapper extends RendererBase {
private static final Log LOG = LogFactory.getLog(AbstractRendererBaseWrapper.class);
+ @Override
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ getRenderer(facesContext).prepareRender(facesContext, component);
+ }
+ @Override
+ public boolean getPrepareRendersChildren() {
+ return getRenderer(FacesContext.getCurrentInstance()).getPrepareRendersChildren();
+ }
+ @Override
+ public void prepareRendersChildren(FacesContext context, UIComponent component) {
+ getRenderer(context).prepareRendersChildren(context, component);
+ }
+
public boolean getRendersChildren() {
return getRenderer(FacesContext.getCurrentInstance()).getRendersChildren();
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutRenderer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutRenderer.java Sun Apr 27 04:17:59 2008
@@ -22,7 +22,7 @@
import java.io.IOException;
public interface LayoutRenderer extends LayoutInformationProvider {
- void prepareRender(FacesContext facesContext, UIComponent component);
+ void prepareRender(FacesContext facesContext, UIComponent component) throws IOException;
void encodeChildrenOfComponent(FacesContext facesContext, UIComponent component) throws IOException;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRenderer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRenderer.java Sun Apr 27 04:17:59 2008
@@ -44,4 +44,6 @@
void layoutBegin(FacesContext context, UIComponent component) throws IOException;
void layoutEnd(FacesContext context, UIComponent component) throws IOException;
+
+ void prepareRender(FacesContext facesContext, UIComponent component) throws IOException;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java Sun Apr 27 04:17:59 2008
@@ -22,9 +22,14 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_MENUBAR;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_HEIGHT;
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.component.Cell;
import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
+import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -32,6 +37,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
public abstract class LayoutableRendererBase
extends RendererBase implements LayoutableRenderer {
@@ -142,11 +148,123 @@
}
}
-
-
public void layoutBegin(FacesContext context, UIComponent component) throws IOException {
}
public void layoutEnd(FacesContext context, UIComponent component) throws IOException {
+ }
+
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+
+ prepareDimension(facesContext, component);
+ final String rendererType = component.getRendererType();
+ if (rendererType != null) {
+ final String rendererName = getRendererName(rendererType);
+ StyleClasses classes = StyleClasses.ensureStyleClasses(component);
+ classes.updateClassAttributeAndMarkup(component, rendererName);
+ } else {
+ LOG.error("No renderType for " + component);
+ }
+ layoutSpace(facesContext, component, true);
+ layoutSpace(facesContext, component, false);
+ }
+
+ void prepareDimension(FacesContext facesContext, UIComponent component) {
+// LOG.info("prepareDimension for " + component.getClientId(facesContext) + " is " + component.getRendererType());
+ setInnerWidth(facesContext, component);
+ setInnerHeight(facesContext, component);
+ }
+
+ void setInnerWidth(FacesContext facesContext, UIComponent component) {
+ Integer layoutWidth = LayoutUtil.getLayoutWidth(component);
+ if (layoutWidth != null) {
+ int space = layoutWidth.intValue();
+ int innerSpace = LayoutUtil.getInnerSpace(facesContext, component, space, true);
+ component.getAttributes().put(ATTR_INNER_WIDTH, Integer.valueOf(innerSpace));
+ }
+ }
+
+ void setInnerHeight(FacesContext facesContext, UIComponent component) {
+ Integer layoutHeight = LayoutUtil.getLayoutHeight(component);
+ if (layoutHeight != null) {
+ int space = layoutHeight.intValue();
+ int innerSpace = LayoutUtil.getInnerSpace(facesContext, component, space, false);
+ component.getAttributes().put(ATTR_INNER_HEIGHT, Integer.valueOf(innerSpace));
+ }
+ }
+
+ private void layoutSpace(FacesContext facesContext, UIComponent component, boolean width) {
+
+ // prepare html 'style' attribute
+ Integer layoutSpace;
+ String layoutAttribute;
+ String styleAttribute;
+ if (width) {
+ layoutSpace = LayoutUtil.getLayoutWidth(component);
+ layoutAttribute = org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
+ styleAttribute = HtmlAttributes.WIDTH;
+ } else {
+ layoutSpace = LayoutUtil.getLayoutHeight(component);
+ layoutAttribute = org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_HEIGHT;
+ styleAttribute = HtmlAttributes.HEIGHT;
+ }
+ int space = -1;
+ if (layoutSpace != null) {
+ space = layoutSpace.intValue();
+ }
+ if (space == -1
+ && (!org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT.equals(component.getRendererType()))) {
+ UIComponent parent = component.getParent();
+ space = LayoutUtil.getInnerSpace(facesContext, parent, width);
+ if (space > 0 && !ComponentUtil.isFacetOf(component, parent)) {
+ component.getAttributes().put(layoutAttribute, Integer.valueOf(space));
+ if (width) {
+ component.getAttributes().remove(org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH);
+ } else {
+ component.getAttributes().remove(org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_HEIGHT);
+ }
+ }
+ }
+ if (space > 0) {
+ if (layoutSpace != null
+ || !ComponentUtil.getBooleanAttribute(component, org.apache.myfaces.tobago.TobagoConstants.ATTR_INLINE)) {
+ int styleSpace = space;
+ if (width) {
+ styleSpace -= getComponentExtraWidth(facesContext, component);
+ } else {
+ styleSpace -= getComponentExtraHeight(facesContext, component);
+ }
+
+ replaceStyleAttribute(component, styleAttribute, styleSpace);
+
+ }
+ UIComponent layout = component.getFacet(org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT);
+ if (layout != null) {
+ int layoutSpace2 = LayoutUtil.getInnerSpace(facesContext, component,
+ width);
+ if (layoutSpace2 > 0) {
+ layout.getAttributes().put(layoutAttribute, Integer.valueOf(layoutSpace2));
+ }
+ }
+ }
+ }
+
+ private void replaceStyleAttribute(UIComponent component, String styleAttribute, int value) {
+ HtmlStyleMap style = ensureStyleAttributeMap(component);
+ style.put(styleAttribute, value);
+ }
+
+ private HtmlStyleMap ensureStyleAttributeMap(UIComponent component) {
+ return ensureStyleAttributeMap(component, org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE);
+ }
+
+ private HtmlStyleMap ensureStyleAttributeMap(UIComponent component, String attribute) {
+ final Map attributes = component.getAttributes();
+ HtmlStyleMap style = (HtmlStyleMap) attributes.get(attribute);
+ if (style == null) {
+ style = new HtmlStyleMap();
+ attributes.put(attribute, style);
+ }
+ return style;
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java Sun Apr 27 04:17:59 2008
@@ -31,6 +31,7 @@
import javax.faces.el.ValueBinding;
import javax.faces.render.Renderer;
import java.util.Locale;
+import java.io.IOException;
/**
* Date: Apr 21, 2007
@@ -48,6 +49,18 @@
LOG.warn("decode() should be overwritten! Renderer: "
+ this.getClass().getName());
}
+ }
+
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+
+ }
+
+ public boolean getPrepareRendersChildren() {
+ return false;
+ }
+
+ public void prepareRendersChildren(FacesContext context, UIComponent component) {
+
}
public String getRendererName(String rendererType) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBaseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBaseWrapper.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBaseWrapper.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBaseWrapper.java Sun Apr 27 04:17:59 2008
@@ -35,6 +35,9 @@
this.renderer = renderer;
}
+ public void prepareRender(FacesContext facesContext, UIComponent component) {
+ }
+
public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
throws ConverterException {
return renderer.getConvertedValue(context, component, submittedValue);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FormTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FormTagDeclaration.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FormTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FormTagDeclaration.java Sun Apr 27 04:17:59 2008
@@ -32,6 +32,7 @@
uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIForm",
interfaces = "org.apache.myfaces.tobago.component.Form",
rendererType = "Form",
+ isTransparentForLayout = true,
allowedChildComponenents = "ALL")
public interface FormTagDeclaration extends HasBinding, HasId {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTag.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTag.java Sun Apr 27 04:17:59 2008
@@ -17,13 +17,9 @@
* limitations under the License.
*/
-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.TagGeneration;
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.component.AbstractUIPage;
-import org.apache.myfaces.tobago.internal.taglib.TagUtils;
import javax.faces.context.FacesContext;
import javax.servlet.jsp.JspException;
@@ -36,10 +32,10 @@
/**
* This tag add client side script to the rendered page.
*/
-@Tag(name = "script", bodyContent = BodyContent.JSP)
+//@Tag(name = "script", bodyContent = BodyContent.JSP)
// @Tag(name="script", bodyContent=BodyContent.TAGDEPENDENT)
// @BodyContentDescription(contentType="javascript")
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.ScriptTag")
+//@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.ScriptTag")
public abstract class ScriptTag extends BodyTagSupport {
private static final long serialVersionUID = 3253751129824779272L;
@@ -77,24 +73,24 @@
}
if (isFileSet()) {
- page.getScriptFiles().add(getFileValue());
+ // page.getScriptFiles().add(getFileValue());
}
if (isOnloadSet()) {
- page.getOnloadScripts().add(getOnloadValue());
+ // page.getOnloadScripts().add(getOnloadValue());
}
if (isOnunloadSet()) {
- page.getOnunloadScripts().add(TagUtils.getValueFromEl(getOnunloadValue()));
+ // page.getOnunloadScripts().add(TagUtils.getValueFromEl(getOnunloadValue()));
}
if (isOnexitSet()) {
- page.getOnexitScripts().add(TagUtils.getValueFromEl(getOnexitValue()));
+ // page.getOnexitScripts().add(TagUtils.getValueFromEl(getOnexitValue()));
}
if (isOnsubmitSet()) {
- page.getOnsubmitScripts().add(getOnsubmitValue());
+ // page.getOnsubmitScripts().add(getOnsubmitValue());
}
if (bodyContent != null) {
String script = bodyContent.getString();
bodyContent.clearBody();
- page.getScriptBlocks().add(TagUtils.getValueFromEl(script));
+ // page.getScriptBlocks().add(TagUtils.getValueFromEl(script));
}
return EVAL_PAGE;
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTagDeclaration.java?rev=651921&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTagDeclaration.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTagDeclaration.java Sun Apr 27 04:17:59 2008
@@ -0,0 +1,62 @@
+package org.apache.myfaces.tobago.taglib.component;
+
+/*
+ * 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.
+ */
+
+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.taglib.decl.HasIdBindingAndRendered;
+
+/**
+ * This tag add client side script to the rendered page.
+ */
+@Tag(name = "script")
+@UIComponentTag(
+ uiComponent = "org.apache.myfaces.tobago.component.UIScript",
+ componentType = "org.apache.myfaces.tobago.Script",
+ componentFamily = "org.apache.myfaces.tobago.Script",
+ rendererType = "Script",
+ isTransparentForLayout = true,
+ allowedChildComponenents = "NONE")
+public interface ScriptTagDeclaration extends HasIdBindingAndRendered {
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setFile(String file);
+
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setOnload(String onload);
+
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setOnunload(String onunload);
+
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setOnexit(String onsubmit);
+
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setOnsubmit(String onsubmit);
+
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setScript(String script);
+
+}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ScriptTagDeclaration.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTag.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTag.java Sun Apr 27 04:17:59 2008
@@ -17,15 +17,10 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.apt.annotation.BodyContent;
-import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
-import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.component.AbstractUIPage;
import org.apache.myfaces.tobago.taglib.decl.HasId;
-import org.apache.myfaces.tobago.internal.taglib.TagUtils;
import javax.faces.context.FacesContext;
import javax.servlet.jsp.JspException;
@@ -35,9 +30,9 @@
* Add a style tag.
* Collected bodyContent is rendered as content into a style tag.
*/
-@Tag(name = "style", bodyContent = BodyContent.TAGDEPENDENT)
-@BodyContentDescription(contentType = "css")
-@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.StyleTag")
+//@Tag(name = "style", bodyContent = BodyContent.TAGDEPENDENT)
+//@BodyContentDescription(contentType = "css")
+//@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.StyleTag")
public abstract class StyleTag extends BodyTagSupport implements HasId {
private static final long serialVersionUID = -2201525304632479403L;
@@ -61,13 +56,13 @@
}
if (isStyleSet()) {
- page.getStyleFiles().add(TagUtils.getValueFromEl(getStyleValue()));
+ //page.getStyleFiles().add(TagUtils.getValueFromEl(getStyleValue()));
}
if (bodyContent != null) {
String classes = bodyContent.getString();
bodyContent.clearBody();
- page.getStyleBlocks().add(TagUtils.getValueFromEl(classes));
+ //page.getStyleBlocks().add(TagUtils.getValueFromEl(classes));
}
return EVAL_PAGE;
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTagDeclaration.java?rev=651921&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTagDeclaration.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTagDeclaration.java Sun Apr 27 04:17:59 2008
@@ -0,0 +1,57 @@
+package org.apache.myfaces.tobago.taglib.component;
+
+/*
+ * 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.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
+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.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+
+/**
+ * Add a style tag.
+ * Collected bodyContent is rendered as content into a style tag.
+ */
+@Tag(name = "style", bodyContent = BodyContent.TAGDEPENDENT)
+@BodyContentDescription(contentType = "css")
+@UIComponentTag(
+ uiComponent = "org.apache.myfaces.tobago.component.UIStyle",
+ componentType = "org.apache.myfaces.tobago.Style",
+ componentFamily = "org.apache.myfaces.tobago.Style",
+ rendererType = "Style",
+ isTransparentForLayout = true,
+ allowedChildComponenents = "NONE")
+public interface StyleTagDeclaration extends HasIdBindingAndRendered {
+
+ /**
+ * Name of the stylesheet file to add to page.
+ */
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setFile(String file);
+
+ /**
+ * stylesheet to add to page.
+ */
+ @TagAttribute()
+ @UIComponentTagAttribute()
+ void setStyle(String style);
+
+}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/StyleTagDeclaration.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java Sun Apr 27 04:17:59 2008
@@ -41,6 +41,7 @@
import org.apache.myfaces.tobago.event.PopupActionListener;
import org.apache.myfaces.tobago.renderkit.LayoutableRenderer;
import org.apache.myfaces.tobago.renderkit.LayoutRenderer;
+import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.component.AbstractUIPopup;
import org.apache.myfaces.tobago.component.AbstractUIPage;
@@ -500,6 +501,31 @@
}
return renderer;
}
+
+ public static RendererBase getRendererBase(FacesContext facesContext, UIComponent component) {
+ return getRendererBase(facesContext, component.getFamily(), component.getRendererType());
+ }
+
+ public static RendererBase getRendererBase(FacesContext facesContext, String family, String rendererType) {
+ if (rendererType == null) {
+ return null;
+ }
+
+ Map requestMap = facesContext.getExternalContext().getRequestMap();
+ RendererBase renderer = (RendererBase) requestMap.get(RENDER_KEY_PREFIX + rendererType);
+
+ if (renderer == null) {
+ Renderer myRenderer = getRendererInternal(facesContext, family, rendererType);
+ if (myRenderer instanceof LayoutableRenderer) {
+ requestMap.put(RENDER_KEY_PREFIX + rendererType, myRenderer);
+ renderer = (RendererBase) myRenderer;
+ } else {
+ return null;
+ }
+ }
+ return renderer;
+ }
+
private static Renderer getRendererInternal(FacesContext facesContext, String family, String rendererType) {
RenderKitFactory rkFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseJsonWriterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseJsonWriterImpl.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseJsonWriterImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseJsonWriterImpl.java Sun Apr 27 04:17:59 2008
@@ -24,9 +24,25 @@
public class TobagoResponseJsonWriterImpl extends TobagoResponseWriterImpl {
private Writer javascriptWriter;
+ private boolean javascriptMode;
public TobagoResponseJsonWriterImpl(Writer writer, String contentType, String characterEncoding) {
super(writer, contentType, characterEncoding);
this.javascriptWriter = new FastStringWriter();
+ }
+
+ public void endJavascript() throws IOException {
+ super.endJavascript();
+ javascriptMode = true;
+ }
+
+ public void startJavascript() throws IOException {
+ super.startJavascript();
+ javascriptMode = false;
+ }
+
+ @Override
+ public void write(String string) throws IOException {
+ writeInternal(javascriptMode?javascriptWriter:getWriter(), string);
}
public void writeJavascript(String script) throws IOException {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java Sun Apr 27 04:17:59 2008
@@ -156,12 +156,20 @@
public abstract void writeStyleAttribute() throws IOException;
public void writeJavascript(String script) throws IOException {
- startElement(HtmlConstants.SCRIPT, null);
- writeAttribute(HtmlAttributes.TYPE, "text/javascript", false);
- write("\n<!--\n");
+ startJavascript();
write(script);
+ endJavascript();
+ }
+
+ public void endJavascript() throws IOException {
write("\n// -->\n");
endElement(HtmlConstants.SCRIPT);
+ }
+
+ public void startJavascript() throws IOException {
+ startElement(HtmlConstants.SCRIPT, null);
+ writeAttribute(HtmlAttributes.TYPE, "text/javascript", false);
+ write("\n<!--\n");
}
/**
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java Sun Apr 27 04:17:59 2008
@@ -124,6 +124,10 @@
}
}
+ protected Writer getWriter() {
+ return writer;
+ }
+
public void write(final char[] cbuf, final int off, final int len)
throws IOException {
writer.write(cbuf, off, len);
@@ -325,7 +329,7 @@
writeAttributeInternal(writer, name, value, escape);
}
- protected final void writeAttributeInternal(Writer write, String name, String value, boolean escape)
+ protected final void writeAttributeInternal(Writer writer, String name, String value, boolean escape)
throws IOException {
if (!startStillOpen) {
String trace = getCallingClassStackTraceElementString();
Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AbstractTobagoTagLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AbstractTobagoTagLibrary.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AbstractTobagoTagLibrary.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AbstractTobagoTagLibrary.java Sun Apr 27 04:17:59 2008
@@ -35,8 +35,6 @@
addTagHandler("popupReference", PopupReferenceHandler.class);
addTagHandler("loadBundle", LoadBundleHandler.class);
addTagHandler("converter", ConverterHandler.class);
- addTagHandler("script", ScriptHandler.class);
- addTagHandler("style", StyleHandler.class);
addValidator("validateFileItem", FileItemValidator.VALIDATOR_ID);
addValidator("validateSubmittedValueLength", SubmittedValueLengthValidator.VALIDATOR_ID);
}
Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/ScriptHandler.java Sun Apr 27 04:17:59 2008
@@ -56,18 +56,18 @@
throws IOException, FacesException, ELException {
if (parent instanceof UIPage) {
- UIPage page = (UIPage) parent;
+ //UIPage page = (UIPage) parent;
if (file != null) {
- page.getScriptFiles().add(file.getValue(faceletContext));
+ //page.getScriptFiles().add(file.getValue(faceletContext));
}
if (onload != null) {
- page.getOnloadScripts().add(onload.getValue(faceletContext));
+ //page.getOnloadScripts().add(onload.getValue(faceletContext));
}
if (onunload != null) {
- page.getOnunloadScripts().add(onunload.getValue(faceletContext));
+ //page.getOnunloadScripts().add(onunload.getValue(faceletContext));
}
if (onexit != null) {
- page.getOnexitScripts().add(onexit.getValue(faceletContext));
+ //page.getOnexitScripts().add(onexit.getValue(faceletContext));
}
StringBuffer buffer = new StringBuffer();
Iterator iter = findNextByType(TextHandler.class);
@@ -78,7 +78,7 @@
String content = buffer.toString().trim();
if (content.length() > 0) {
- page.getScriptBlocks().add(content);
+ //page.getScriptBlocks().add(content);
}
} else {
throw new TagException(tag, "Parent is not of type UIPage, type is: " + parent);
Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java Sun Apr 27 04:17:59 2008
@@ -50,9 +50,9 @@
throws IOException, FacesException, ELException {
if (parent instanceof AbstractUIPage) {
- AbstractUIPage page = (AbstractUIPage) parent;
+ //AbstractUIPage page = (AbstractUIPage) parent;
if (style != null) {
- page.getStyleFiles().add(style.getValue(faceletContext));
+ //page.getStyleFiles().add(style.getValue(faceletContext));
}
StringBuffer buffer = new StringBuffer();
Iterator iter = findNextByType(TextHandler.class);
@@ -63,7 +63,7 @@
String content = buffer.toString().trim();
if (content.length() > 0) {
- page.getStyleBlocks().add(content);
+ //page.getStyleBlocks().add(content);
}
} else {
throw new TagException(tag, "Parent is not of type UIPage, type is: " + parent);
Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/InputNumberSliderRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/InputNumberSliderRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/InputNumberSliderRenderer.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/InputNumberSliderRenderer.java Sun Apr 27 04:17:59 2008
@@ -25,6 +25,7 @@
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.context.ResourceManager;
import org.apache.myfaces.tobago.context.ResourceManagerFactory;
+import org.apache.myfaces.tobago.context.PageFacesContextWrapper;
import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -44,9 +45,15 @@
private static final String SLIDER_WIDTH_PERCENT = "sliderWidthPercent";
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ super.prepareRender(facesContext, component);
+ if (facesContext instanceof PageFacesContextWrapper) {
+ final String[] scripts = new String[]{"script/scriptaculous.js"};
+ ((PageFacesContextWrapper) facesContext).getScriptFiles().add(scripts[0]);
+ }
+ }
+
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
- final String[] scripts = new String[]{"script/scriptaculous.js"};
- HtmlRendererUtil.addScripts(component, scripts);
String id = component.getClientId(facesContext);
String currentValue = getCurrentValue(facesContext, component);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java Sun Apr 27 04:17:59 2008
@@ -26,9 +26,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CALENDAR_DATE_INPUT_ID;
-import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.component.AbstractUIPage;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
+import org.apache.myfaces.tobago.context.PageFacesContextWrapper;
import org.apache.myfaces.tobago.model.CalendarModel;
import org.apache.myfaces.tobago.model.DateModel;
import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
@@ -42,6 +41,7 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
@@ -49,23 +49,23 @@
public class CalendarRenderer extends LayoutableRendererBase {
-
private static final Log LOG = LogFactory.getLog(CalendarRenderer.class);
-
private static final String[] SCRIPTS = {
"script/calendar.js",
"script/dateConverter.js"
};
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ super.prepareRender(facesContext, component);
+ if (facesContext instanceof PageFacesContextWrapper) {
+ ((PageFacesContextWrapper) facesContext).getScriptFiles().addAll(Arrays.asList(SCRIPTS));
+ }
+ }
public void encodeEnd(FacesContext facesContext,
UIComponent component) throws IOException {
UIOutput output = (UIOutput) component;
- AbstractUIPage page = ComponentUtil.findPage(facesContext, output);
- for (String script : SCRIPTS) {
- page.getScriptFiles().add(script);
- }
String id = output.getClientId(facesContext);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Sun Apr 27 04:17:59 2008
@@ -22,19 +22,18 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
import org.apache.myfaces.tobago.component.UIDatePicker;
import org.apache.myfaces.tobago.component.UIPopup;
import org.apache.myfaces.tobago.component.UIDateInput;
-import org.apache.myfaces.tobago.component.AbstractUIPage;
import org.apache.myfaces.tobago.component.UITimeInput;
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.util.DateFormatUtils;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.TobagoConstants;
+import org.apache.myfaces.tobago.context.PageFacesContextWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -55,6 +54,19 @@
public class DatePickerRenderer extends LinkRenderer {
private static final Log LOG = LogFactory.getLog(DatePickerRenderer.class);
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ component.getAttributes().put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
+ if (facesContext instanceof PageFacesContextWrapper) {
+ UIPopup popup = (UIPopup) component.getFacets().get(FACET_PICKER_POPUP);
+ if (popup != null) {
+ popup.getAttributes().put(ATTR_WIDTH, ThemeConfig.getValue(facesContext, component, "CalendarPopupWidth"));
+ popup.getAttributes().put(ATTR_HEIGHT, ThemeConfig.getValue(facesContext, component, "CalendarPopupHeight"));
+ ((PageFacesContextWrapper) facesContext).getPopups().add(popup);
+ }
+ }
+ super.prepareRender(facesContext, component);
+ }
+
public void encodeBegin(FacesContext facesContext,
UIComponent component) throws IOException {
UIDatePicker link = (UIDatePicker) component;
@@ -77,7 +89,7 @@
}
Map<String, Object> attributes = link.getAttributes();
link.setActionListener(datePickerController);
- attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
+
UIComponent hidden = (UIComponent) link.getChildren().get(0);
UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
@@ -86,12 +98,6 @@
+ hidden.getClientId(facesContext) + "', '"
+ popup.getClientId(facesContext) +"')");
- attributes = popup.getAttributes();
-
- attributes.put(ATTR_WIDTH, ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth"));
- int popupHeight = ThemeConfig.getValue(facesContext, link, "CalendarPopupHeight");
- attributes.put(ATTR_POPUP_RESET, Boolean.TRUE);
- attributes.put(ATTR_HEIGHT, popupHeight);
Converter converter = getConverter(facesContext, dateInput);
String converterPattern = "yyyy-MM-dd"; // from calendar.js initCalendarParse
if (converter instanceof DateTimeConverter) {
@@ -105,20 +111,14 @@
attributes = okButton.getAttributes();
attributes.put(ATTR_ACTION_ONCLICK, "var textBox = writeIntoField2(this);Tobago.closePopup(this);textBox.focus();");
attributes.put(TobagoConstants.ATTR_POPUP_CLOSE, "afterSubmit");
- // okButton.setActionListener(datePickerController);
UICommand cancelButton = (UICommand) popup.findComponent(DatePickerController.CLOSE_POPUP);
attributes = cancelButton.getAttributes();
attributes.put(ATTR_ACTION_ONCLICK, "var textBox = writeIntoField2(this);Tobago.closePopup(this);textBox.focus();");
attributes.put(TobagoConstants.ATTR_POPUP_CLOSE, "immediate");
- //cancelButton.setActionListener(datePickerController);
applyConverterPattern(facesContext, popup, converterPattern);
-
- if (popup != null) {
- AbstractUIPage page = ComponentUtil.findPage(facesContext, link);
- page.getPopups().add(popup);
- }
+
if (!ComponentUtil.containsPopupActionListener(link)) {
link.addActionListener(new PopupActionListener(popup.getId()));
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java Sun Apr 27 04:17:59 2008
@@ -24,39 +24,41 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.config.TobagoConfig;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.util.DateFormatUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
+import org.apache.myfaces.tobago.context.PageFacesContextWrapper;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
import java.io.IOException;
-import java.util.List;
+import java.util.Arrays;
public class DateRenderer extends InRenderer {
private static final Log LOG = LogFactory.getLog(DateRenderer.class);
- public void encodeEnd(FacesContext facesContext,
- UIComponent component) throws IOException {
- final String[] scripts = {
- "script/dateConverter.js",
- "script/calendar.js"};
-
- final List<String> scriptFiles
- = ComponentUtil.findPage(facesContext, component).getScriptFiles();
- for (String script : scripts) {
- scriptFiles.add(script);
+ private static final String[] SCRIPTS = {
+ "script/dateConverter.js",
+ "script/calendar.js"
+ };
+
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ super.prepareRender(facesContext, component);
+ if (facesContext instanceof PageFacesContextWrapper) {
+ ((PageFacesContextWrapper) facesContext).getScriptFiles().addAll(Arrays.asList(SCRIPTS));
}
+ }
+
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
if (TobagoConfig.getInstance(facesContext).isAjaxEnabled()) {
- HtmlRendererUtil.writeScriptLoader(facesContext, scripts, null);
+ HtmlRendererUtil.writeScriptLoader(facesContext, SCRIPTS, null);
}
super.encodeEnd(facesContext, component);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DefaultLayoutRenderer.java Sun Apr 27 04:17:59 2008
@@ -21,7 +21,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.renderkit.AbstractLayoutRenderer;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
-import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -35,10 +34,6 @@
public class DefaultLayoutRenderer extends AbstractLayoutRenderer {
private static final Log LOG = LogFactory.getLog(DefaultLayoutRenderer.class);
-
- public void prepareRender(FacesContext facesContext, UIComponent component) {
- HtmlRendererUtil.prepareRender(facesContext, component);
- }
public void encodeChildrenOfComponent(FacesContext facesContext, UIComponent component)
throws IOException {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java Sun Apr 27 04:17:59 2008
@@ -30,6 +30,7 @@
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.component.UIFileInput;
import org.apache.myfaces.tobago.context.ClientProperties;
+import org.apache.myfaces.tobago.context.PageFacesContextWrapper;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -47,6 +48,13 @@
public class FileRenderer extends InputRendererBase {
private static final Log LOG = LogFactory.getLog(FileRenderer.class);
+
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ super.prepareRender(facesContext, component);
+ if (facesContext instanceof PageFacesContextWrapper) {
+ ((PageFacesContextWrapper) facesContext).setEnctype("multipart/form-data");
+ }
+ }
public boolean getRendersChildren() {
return true;
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java Sun Apr 27 04:17:59 2008
@@ -242,15 +242,27 @@
return false;
}
+ public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+ super.prepareRender(facesContext, component);
+ layoutEnd(facesContext, component);
+ layoutMargins((UIGridLayout) component);
+
+ }
+
+ void prepareDimension(FacesContext facesContext, UIComponent component) {
+
+ }
+
public void encodeChildrenOfComponent(FacesContext facesContext, UIComponent component)
throws IOException {
// encode table with component's children
UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
- HtmlRendererUtil.prepareRender(facesContext, layout);
+ //prepareRender(facesContext, layout);
+ //HtmlRendererUtil.prepareRender(facesContext, layout);
- layoutEnd(facesContext, layout);
- layoutMargins(layout);
+ //layoutEnd(facesContext, layout);
+ //layoutMargins(layout);
final Map attributes = layout.getAttributes();
List columnWidths = (List) attributes.get(ATTR_WIDTH_LIST);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java?rev=651921&r1=651920&r2=651921&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java Sun Apr 27 04:17:59 2008
@@ -106,7 +106,7 @@
writer.writeClassAttribute();
writer.endElement(HtmlConstants.IMG);
- HtmlRendererUtil.renderDojoDndSource(component, writer, clientId);
+ HtmlRendererUtil.renderDojoDndSource(facesContext, component);
}
private String createSrc(String src, String ext) {