001 package org.apache.myfaces.tobago.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 org.apache.myfaces.tobago.TobagoConstants; 021 022 import javax.faces.context.FacesContext; 023 024 025 public class UICell extends UIPanelBase { 026 027 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Cell"; 028 029 private Integer spanX; 030 private Integer spanY; 031 private String scrollbars; 032 033 public Integer getSpanX() { 034 if (spanX != null) { 035 return spanX; 036 } 037 javax.faces.el.ValueBinding vb = getValueBinding(TobagoConstants.ATTR_SPAN_X); 038 if (vb != null) { 039 Number number = (Number) vb.getValue(getFacesContext()); 040 if (number != null) { 041 return number.intValue(); 042 } 043 } 044 return 1; 045 } 046 047 public void setSpanX(Integer spanX) { 048 this.spanX = spanX; 049 } 050 051 public Integer getSpanY() { 052 if (spanY != null) { 053 return spanY; 054 } 055 javax.faces.el.ValueBinding vb = getValueBinding(TobagoConstants.ATTR_SPAN_Y); 056 if (vb != null) { 057 Number number = (Number) vb.getValue(getFacesContext()); 058 if (number != null) { 059 return number.intValue(); 060 } 061 } 062 return 1; 063 } 064 065 public void setSpanY(Integer spanY) { 066 this.spanY = spanY; 067 } 068 069 public String getScrollbars() { 070 if (scrollbars != null) { 071 return scrollbars; 072 } 073 javax.faces.el.ValueBinding vb = getValueBinding(TobagoConstants.ATTR_SCROLLBARS); 074 if (vb != null) { 075 java.lang.String scrollbars = (java.lang.String) vb.getValue(getFacesContext()); 076 if (scrollbars != null) { 077 return scrollbars; 078 } 079 } 080 return "false"; 081 } 082 083 public void setScrollbars(String scrollbars) { 084 this.scrollbars = scrollbars; 085 } 086 087 public void restoreState(FacesContext context, Object state) { 088 Object[] values = (Object[]) state; 089 super.restoreState(context, values[0]); 090 spanX = (Integer) values[1]; 091 spanY = (Integer) values[2]; 092 scrollbars = (String) values[3]; 093 } 094 095 public Object saveState(FacesContext context) { 096 Object[] values = new Object[4]; 097 values[0] = super.saveState(context); 098 values[1] = spanX; 099 values[2] = spanY; 100 values[3] = scrollbars; 101 return values; 102 } 103 }