/* FreezeInfoLoaderImpl.java

{{IS_NOTE
	Purpose:
		
	Description:
		
	History:
		2013/8/8 , Created by dennis
}}IS_NOTE

Copyright (C) 2013 Potix Corporation. All Rights Reserved.

{{IS_RIGHT
}}IS_RIGHT
*/
package org.zkoss.zssex.ui.impl;

import org.zkoss.zss.api.model.Sheet;
import org.zkoss.zss.model.SSheet;
import org.zkoss.zss.ui.sys.FreezeInfoLoader;

/**
 * @author dennis
 *
 */
public class FreezeInfoLoaderImpl implements FreezeInfoLoader {
	private static final long serialVersionUID = 4560868068016070088L;

	/* (non-Javadoc)
	 * @see org.zkoss.zss.ui.sys.FreezeInfoLoader#getRowFreeze(java.lang.Object)
	 */
	@Override
	public int getRowFreeze(Object sheet) {
		if(sheet instanceof Sheet){
			return ((Sheet)sheet).getRowFreeze()-1;
		}else if(sheet instanceof SSheet){
			return ((SSheet)sheet).getViewInfo().getNumOfRowFreeze()-1;
		}
		return -1;
	}

	/* (non-Javadoc)
	 * @see org.zkoss.zss.ui.sys.FreezeInfoLoader#getColumnFreeze(java.lang.Object)
	 */
	@Override
	public int getColumnFreeze(Object sheet) {
		if(sheet instanceof Sheet){
			return ((Sheet)sheet).getColumnFreeze()-1;
		}else if(sheet instanceof SSheet){
			return ((SSheet)sheet).getViewInfo().getNumOfColumnFreeze()-1;
		}
		return -1;
	}

}
