001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *   http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package org.apache.myfaces.tobago.taglib.component;
021    
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
023    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LEFT;
024    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MODAL;
025    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TOP;
026    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
027    import org.apache.myfaces.tobago.component.ComponentUtil;
028    import org.apache.myfaces.tobago.component.UIPopup;
029    
030    import javax.faces.component.UIComponent;
031    import javax.servlet.jsp.tagext.BodyTag;
032    
033    // Some Weblogic versions need explicit 'implements' for BodyTag
034    public class PopupTag extends TobagoBodyTag
035        implements BodyTag, PopupTagDeclaration {
036      private String width;
037      private String height;
038      private String left;
039      private String top;
040      private String modal;
041    
042      public String getComponentType() {
043        return UIPopup.COMPONENT_TYPE;
044      }
045    
046      public void release() {
047        super.release();
048        width = null;
049        height = null;
050        left = null;
051        top = null;
052        modal = null;
053      }
054    
055      protected void setProperties(UIComponent component) {
056        super.setProperties(component);
057        ComponentUtil.setStringProperty(component, ATTR_WIDTH, width);
058        ComponentUtil.setStringProperty(component, ATTR_HEIGHT, height);
059        ComponentUtil.setStringProperty(component, ATTR_LEFT, left);
060        ComponentUtil.setStringProperty(component, ATTR_TOP, top);
061        ComponentUtil.setBooleanProperty(component, ATTR_MODAL, modal);
062    
063      }
064    
065      public void setWidth(String width) {
066        this.width = width;
067      }
068    
069      public void setHeight(String height) {
070        this.height = height;
071      }
072    
073      public void setLeft(String left) {
074        this.left = left;
075      }
076    
077      public void setTop(String top) {
078        this.top = top;
079      }
080    
081      public void setModal(String modal) {
082        this.modal = modal;
083      }
084    }
085