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