myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmarinsc...@apache.org
Subject cvs commit: incubator-myfaces/webapps/examples/web popup.jsp
Date Wed, 17 Nov 2004 11:25:43 GMT
mmarinschek    2004/11/17 03:25:43

  Modified:    src/components/org/apache/myfaces/custom/popup
                        HtmlPopup.java HtmlPopup.xml HtmlPopupRenderer.java
               tlds     myfaces_ext.tld
               webapps/examples/web/css basic.css
               webapps/examples/web/inc page_header.jsp
               webapps/examples/web popup.jsp
  Log:
  reviewed version of popup
  
  Revision  Changes    Path
  1.2       +46 -2     incubator-myfaces/src/components/org/apache/myfaces/custom/popup/HtmlPopup.java
  
  Index: HtmlPopup.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/popup/HtmlPopup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlPopup.java	16 Nov 2004 16:25:52 -0000	1.1
  +++ HtmlPopup.java	17 Nov 2004 11:25:42 -0000	1.2
  @@ -17,6 +17,8 @@
   
   import javax.faces.component.UIComponentBase;
   import javax.faces.component.UIComponent;
  +import javax.faces.el.ValueBinding;
  +import javax.faces.context.FacesContext;
   
   /**
    * @author Martin Marinschek (latest modification by $Author$)
  @@ -51,6 +53,8 @@
       public static final String COMPONENT_FAMILY = "javax.faces.Panel";
       private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Popup";
   
  +    private String _style = null;
  +    private String _styleClass = null;
   
       public HtmlPopup()
       {
  @@ -62,7 +66,47 @@
           return COMPONENT_FAMILY;
       }
   
  +    public void setStyle(String style)
  +    {
  +        _style = style;
  +    }
   
  +    public String getStyle()
  +    {
  +        if (_style != null) return _style;
  +        ValueBinding vb = getValueBinding("style");
  +        return vb != null ? (String)vb.getValue(getFacesContext()) : null;
  +    }
   
  +    public void setStyleClass(String styleClass)
  +    {
  +        _styleClass = styleClass;
  +    }
  +
  +    public String getStyleClass()
  +    {
  +        if (_styleClass != null) return _styleClass;
  +        ValueBinding vb = getValueBinding("styleClass");
  +        return vb != null ? (String)vb.getValue(getFacesContext()) : null;
  +    }
  +
  +
  +
  +    public Object saveState(FacesContext context)
  +    {
  +        Object values[] = new Object[3];
  +        values[0] = super.saveState(context);
  +        values[1] = _style;
  +        values[2] = _styleClass;
  +        return ((Object) (values));
  +    }
  +
  +    public void restoreState(FacesContext context, Object state)
  +    {
  +        Object values[] = (Object[])state;
  +        super.restoreState(context, values[0]);
  +        _style = (String)values[1];
  +        _styleClass = (String)values[2];
  +    }
       //------------------ GENERATED CODE END ---------------------------------------
   }
  
  
  
  1.2       +8 -0      incubator-myfaces/src/components/org/apache/myfaces/custom/popup/HtmlPopup.xml
  
  Index: HtmlPopup.xml
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/popup/HtmlPopup.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlPopup.xml	16 Nov 2004 16:25:52 -0000	1.1
  +++ HtmlPopup.xml	17 Nov 2004 11:25:42 -0000	1.2
  @@ -8,4 +8,12 @@
       <component-type>org.apache.myfaces.HtmlPopup</component-type>
       <component-family>javax.faces.Panel</component-family>
       <renderer-type>org.apache.myfaces.Popup</renderer-type>
  +    <field>
  +        <name>style</name>
  +        <type>String</type>
  +    </field>
  +    <field>
  +        <name>styleClass</name>
  +        <type>String</type>
  +    </field>
   </component>
  
  
  
  1.2       +13 -5     incubator-myfaces/src/components/org/apache/myfaces/custom/popup/HtmlPopupRenderer.java
  
  Index: HtmlPopupRenderer.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/popup/HtmlPopupRenderer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlPopupRenderer.java	16 Nov 2004 16:25:52 -0000	1.1
  +++ HtmlPopupRenderer.java	17 Nov 2004 11:25:42 -0000	1.2
  @@ -31,6 +31,9 @@
    * @author Martin Marinschek (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.2  2004/11/17 11:25:42  mmarinschek
  + * reviewed version of popup
  + *
    * Revision 1.1  2004/11/16 16:25:52  mmarinschek
    * new popup - component; not yet finished
    *
  @@ -68,7 +71,7 @@
           String popupId = writePopupScript(
                   facesContext, popup.getClientId(facesContext));
   
  -        writeMouseOverAndOutAttribs(popupId, popupFacet.getChildren());
  +        //writeMouseOverAndOutAttribs(popupId, popupFacet.getChildren());
   
           writeMouseOverAttribs(popupId, uiComponent.getChildren());
   
  @@ -76,9 +79,14 @@
   
           ResponseWriter writer = facesContext.getResponseWriter();
   
  -        writer.startElement(HTML.DIV_ELEM, uiComponent);
  -        writer.writeAttribute(HTML.STYLE_ATTR,"position:absolute;display:none;background:#CCCCCC;",null);
  +        writer.startElement(HTML.DIV_ELEM, popup);
  +        writer.writeAttribute(HTML.STYLE_ATTR,(popup.getStyle()!=null?(popup.getStyle()+
  +                (popup.getStyle().trim().endsWith(";")?"":";")):"")+
  +                "position:absolute;display:none;",null);
  +        writer.writeAttribute(HTML.CLASS_ATTR,popup.getStyleClass(),null);
           writer.writeAttribute(HTML.ID_ATTR, popup.getClientId(facesContext),null);
  +        writer.writeAttribute(HTML.ONMOUSEOVER_ATTR, new String(popupId+".redisplay();"),null);
  +        writer.writeAttribute(HTML.ONMOUSEOUT_ATTR, new String(popupId+".hide();"),null);
           RendererUtils.renderChildren(facesContext, popupFacet);
           writer.endElement(HTML.DIV_ELEM);
       }
  
  
  
  1.124     +22 -0     incubator-myfaces/tlds/myfaces_ext.tld
  
  Index: myfaces_ext.tld
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/tlds/myfaces_ext.tld,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- myfaces_ext.tld	16 Nov 2004 16:25:53 -0000	1.123
  +++ myfaces_ext.tld	17 Nov 2004 11:25:43 -0000	1.124
  @@ -1385,6 +1385,28 @@
           <description>
               Renders a popup which displays on a mouse event.
           </description>
  +        <attribute>
  +            <name>styleClass</name>
  +            <required>false</required>
  +            <rtexprvalue>false</rtexprvalue>
  +            <description>
  +                styleClass for popup.
  +                Attention! do not try to overwrite position:absolute;
  +                and display:none;
  +                Provide a padding for Mozilla-based Browsers
  +            </description>
  +        </attribute>
  +        <attribute>
  +            <name>style</name>
  +            <required>false</required>
  +            <rtexprvalue>false</rtexprvalue>
  +            <description>
  +                style for popup.
  +                Attention! do not try to overwrite position:absolute;
  +                and display:none;
  +                Provide a padding for Mozilla-based Browsers
  +            </description>
  +        </attribute>
           &ui_panel_attributes;
           &html_universal_attributes;
           &html_event_handler_attributes;
  
  
  
  1.25      +31 -0     incubator-myfaces/webapps/examples/web/css/basic.css
  
  Index: basic.css
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/css/basic.css,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- basic.css	9 Aug 2004 11:47:10 -0000	1.24
  +++ basic.css	17 Nov 2004 11:25:43 -0000	1.25
  @@ -271,6 +271,37 @@
   }
   
   
  +/*
  +   ------------------------------------------------------------
  +   End Calendar component
  +   ------------------------------------------------------------
  +*/
  +
  +/*
  +   ------------------------------------------------------------
  +   Popup component
  +   ------------------------------------------------------------
  +*/
  +
  +.popup {
  +    background-color: rgb(255,255,225);
  +    color: #000000;
  +    border: 1px solid #CCCCCC;
  +    font-size:smaller;
  +    padding: 5px;
  +}
  +
  +.popup table {
  +    font-size:smaller;
  +}
  +
  +
  +/*
  +   ------------------------------------------------------------
  +   End popup component
  +   ------------------------------------------------------------
  +*/
  +
   
   .countryFormTable {
   	font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
  
  
  
  1.38      +1 -1      incubator-myfaces/webapps/examples/web/inc/page_header.jsp
  
  Index: page_header.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/inc/page_header.jsp,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- page_header.jsp	16 Nov 2004 16:25:53 -0000	1.37
  +++ page_header.jsp	17 Nov 2004 11:25:43 -0000	1.38
  @@ -32,7 +32,7 @@
                   <x:navigationMenuItem id="nav_2_4_4" itemLabel="#{example_messages['nav_FileUpload']}"
action="go_fileupload" icon="images/myfaces.gif" />
                   <x:navigationMenuItem id="nav_2_4_5" itemLabel="#{example_messages['nav_TabbedPane']}"
action="go_tabbedPane" icon="images/myfaces.gif" />
                   <x:navigationMenuItem id="nav_2_4_6" itemLabel="#{example_messages['nav_Calendar']}"
action="go_calendar" icon="images/myfaces.gif" split="true" />
  -                <x:navigationMenuItem id="nav_2_4_6" itemLabel="#{example_messages['nav_Popup']}"
action="go_popup" icon="images/myfaces.gif" split="true" />                
  +                <x:navigationMenuItem id="nav_2_4_6_1" itemLabel="#{example_messages['nav_Popup']}"
action="go_popup" icon="images/myfaces.gif" split="true" />
                   <x:navigationMenuItem id="nav_2_4_7" itemLabel="#{example_messages['nav_dataList']}"
action="go_dataList" icon="images/myfaces.gif" />
                   <x:navigationMenuItem id="nav_2_4_8" itemLabel="#{example_messages['nav_tree']}"
action="go_tree" icon="images/myfaces.gif" />
                   <x:navigationMenuItem id="nav_2_4_9" itemLabel="#{example_messages['nav_rssTicker']}"
action="go_rssticker" icon="images/myfaces.gif" />
  
  
  
  1.2       +15 -1     incubator-myfaces/webapps/examples/web/popup.jsp
  
  Index: popup.jsp
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/webapps/examples/web/popup.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- popup.jsp	16 Nov 2004 16:25:53 -0000	1.1
  +++ popup.jsp	17 Nov 2004 11:25:43 -0000	1.2
  @@ -55,14 +55,28 @@
   
               <h:panelGroup id="body">
                       
  -                <x:popup>
  +                <x:popup styleClass="popup">
                       <h:outputText value="text"/>
                       <f:facet name="popup">
                           <h:panelGroup>
  +                            <h:panelGrid columns="1" >
                               <h:outputText value="Popup Text"/>
                               <h:outputLink value="http://www.myfaces.org" >
                                   <h:outputText value="MyFaces Homepage"/>
                               </h:outputLink>
  +                            <h:outputLink value="http://www.myfaces.org" >
  +                                <h:outputText value="MyFaces Homepage"/>
  +                            </h:outputLink>
  +                            <h:outputLink value="http://www.myfaces.org" >
  +                                <h:outputText value="MyFaces Homepage"/>
  +                            </h:outputLink>
  +                            <h:outputLink value="http://www.myfaces.org" >
  +                                <h:outputText value="MyFaces Homepage"/>
  +                            </h:outputLink>
  +                            <h:outputLink value="http://www.myfaces.org" >
  +                                <h:outputText value="MyFaces Homepage"/>
  +                            </h:outputLink>                            
  +                            </h:panelGrid>
                           </h:panelGroup>
                       </f:facet>
                   </x:popup>
  
  
  

Mime
View raw message