You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2007/02/11 22:08:43 UTC

svn commit: r506152 - /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.java

Author: awiner
Date: Sun Feb 11 14:08:43 2007
New Revision: 506152

URL: http://svn.apache.org/viewvc?view=rev&rev=506152
Log:
Missed adding this file in prior checkin

Added:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.java

Added: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.java?view=auto&rev=506152
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelTipRenderer.java Sun Feb 11 14:08:43 2007
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.component.core.layout.CorePanelTip;
+
+/**
+ * Renders the page or section level tip UI element.
+ * <p>
+ * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/laf/base/desktop/TipRenderer.java#0 $) $Date: 10-nov-2005.18:56:21 $
+ * @author The Oracle ADF Faces Team
+ */
+public class PanelTipRenderer extends XhtmlRenderer
+{
+  public PanelTipRenderer()
+  {
+    super(CorePanelTip.TYPE);
+  }
+
+
+  @Override
+  public boolean getRendersChildren()
+  {
+    return true;
+  }
+
+  protected String getDefaultStyleClass(FacesBean bean)
+  {
+    return "af|panelTip";
+  }
+
+  @Override
+  protected void encodeAll(
+    FacesContext        context,
+    RenderingContext    rc,
+    UIComponent         component,
+    FacesBean           bean) throws IOException
+  {
+    ResponseWriter rw = context.getResponseWriter();
+    rw.startElement("div", component);
+    renderId(context, component);
+    renderAllAttributes(context, rc, bean);
+    
+     // tip label
+    rw.startElement("span", null);
+    renderStyleClass(context, rc, SkinSelectors.AF_PANEL_TIP_LABEL_STYLE_CLASS);
+
+    String tipText = rc.getTranslatedString("af_panelTip.TIP");
+    if (rc.isRightToLeft())
+    {
+      rw.writeText(XhtmlConstants.NBSP_STRING, null);
+      rw.writeText(tipText, null);
+    }
+    else
+    {
+      rw.writeText(tipText, null);
+      rw.writeText(XhtmlConstants.NBSP_STRING, null);
+    }
+
+    rw.endElement("span");
+  
+    // content
+    rw.startElement("span", null);
+    renderStyleClass(context, rc,  SkinSelectors.AF_PANEL_TIP_CONTENT_STYLE_CLASS);
+    rw.endElement("span");
+
+    encodeAllChildren(context, component);
+
+    rw.endElement("div");
+  }
+}