diff options
author | Javen O'Neal <onealj@apache.org> | 2017-02-08 07:47:30 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2017-02-08 07:47:30 +0000 |
commit | 7b38711979249d1ea6bb3da7974125ef0332c78e (patch) | |
tree | 57321baea500c11f3be2bcbe1345e6b0c75afebd /src/excelant/java/org/apache/poi/ss | |
parent | 2a0c4cdde470a9641c0c56f8c7f7e689992e81e8 (diff) | |
download | poi-7b38711979249d1ea6bb3da7974125ef0332c78e.tar.gz poi-7b38711979249d1ea6bb3da7974125ef0332c78e.zip |
Convert all *.java files to use native end of line character(s)
$ dos2unix `find -name *.java`
$ svn propset svn:eol-style native `find -name *.java`
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782114 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/excelant/java/org/apache/poi/ss')
4 files changed, 226 insertions, 226 deletions
diff --git a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java index 35f5420f01..c6baee4f24 100644 --- a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java +++ b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntHandlerTask.java @@ -1,76 +1,76 @@ -/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.ss.excelant;
-
-import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-
-/**
- * This is the class that backs the <handler> tag in the Ant task.
- * <p>
- * Its purpose is to provide a way to manipulate a workbook in the course
- * of an ExcelAnt task. The idea being to model a way for test writers to
- * simulate the behaviors of the workbook.
- * <p>
- * Suppose, for example, you have a workbook that has a worksheet that
- * reacts to values entered or selected by the user. It's possible in
- * Excel to change other cells based on this but this isn't easily possible
- * in POI. In ExcelAnt we handle this using the Handler, which is a Java
- * class you write to manipulate the workbook.
- * <p>
- * In order to use this tag you must write a class that implements the
- * <code>IExcelAntWorkbookHandler</code> interface. After writing the
- * class you should package it and it's dependencies into a jar file to
- * add as library in your Ant build file.
- *
- * @author Jon Svede ( jon [at] loquatic [dot] com )
- * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov )
- *
- */
-public class ExcelAntHandlerTask extends Task {
-
- private String className ;
-
- private ExcelAntWorkbookUtil wbUtil ;
-
- public void setClassName( String cName ) {
- className = cName ;
- }
-
- protected void setEAWorkbookUtil( ExcelAntWorkbookUtil wkbkUtil ) {
- wbUtil = wkbkUtil ;
- }
-
- @Override
- public void execute() throws BuildException {
- log( "handling the workbook with class " + className, Project.MSG_INFO ) ;
- try {
- Class<?> clazz = Class.forName( className ) ;
- Object handlerObj = clazz.newInstance() ;
- if( handlerObj instanceof IExcelAntWorkbookHandler ) {
- IExcelAntWorkbookHandler iHandler = (IExcelAntWorkbookHandler)handlerObj ;
- iHandler.setWorkbook( wbUtil.getWorkbook() ) ;
- iHandler.execute() ;
- }
- } catch( Exception e ) {
- throw new BuildException( e.getMessage(), e ) ;
- }
- }
- }
+/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.ss.excelant; + +import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; + +/** + * This is the class that backs the <handler> tag in the Ant task. + * <p> + * Its purpose is to provide a way to manipulate a workbook in the course + * of an ExcelAnt task. The idea being to model a way for test writers to + * simulate the behaviors of the workbook. + * <p> + * Suppose, for example, you have a workbook that has a worksheet that + * reacts to values entered or selected by the user. It's possible in + * Excel to change other cells based on this but this isn't easily possible + * in POI. In ExcelAnt we handle this using the Handler, which is a Java + * class you write to manipulate the workbook. + * <p> + * In order to use this tag you must write a class that implements the + * <code>IExcelAntWorkbookHandler</code> interface. After writing the + * class you should package it and it's dependencies into a jar file to + * add as library in your Ant build file. + * + * @author Jon Svede ( jon [at] loquatic [dot] com ) + * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov ) + * + */ +public class ExcelAntHandlerTask extends Task { + + private String className ; + + private ExcelAntWorkbookUtil wbUtil ; + + public void setClassName( String cName ) { + className = cName ; + } + + protected void setEAWorkbookUtil( ExcelAntWorkbookUtil wkbkUtil ) { + wbUtil = wkbkUtil ; + } + + @Override + public void execute() throws BuildException { + log( "handling the workbook with class " + className, Project.MSG_INFO ) ; + try { + Class<?> clazz = Class.forName( className ) ; + Object handlerObj = clazz.newInstance() ; + if( handlerObj instanceof IExcelAntWorkbookHandler ) { + IExcelAntWorkbookHandler iHandler = (IExcelAntWorkbookHandler)handlerObj ; + iHandler.setWorkbook( wbUtil.getWorkbook() ) ; + iHandler.execute() ; + } + } catch( Exception e ) { + throw new BuildException( e.getMessage(), e ) ; + } + } + } diff --git a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntSet.java b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntSet.java index 974b1b9e4c..e62f0623d9 100644 --- a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntSet.java +++ b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntSet.java @@ -1,48 +1,48 @@ -/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.ss.excelant;
-
-import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
-import org.apache.tools.ant.Task;
-
-/**
- *
- * @author Jon Svede ( jon [at] loquatic [dot] com )
- * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov )
- *
- */
-public abstract class ExcelAntSet extends Task {
-
- protected String cellStr ;
-
- protected ExcelAntWorkbookUtil wbUtil ;
-
- public void setCell( String cellName ) {
- cellStr = cellName ;
- }
-
- public String getCell() {
- return cellStr ;
- }
-
-
- public void setWorkbookUtil( ExcelAntWorkbookUtil wb ) {
- wbUtil = wb ;
- }
-
-}
+/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.ss.excelant; + +import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil; +import org.apache.tools.ant.Task; + +/** + * + * @author Jon Svede ( jon [at] loquatic [dot] com ) + * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov ) + * + */ +public abstract class ExcelAntSet extends Task { + + protected String cellStr ; + + protected ExcelAntWorkbookUtil wbUtil ; + + public void setCell( String cellName ) { + cellStr = cellName ; + } + + public String getCell() { + return cellStr ; + } + + + public void setWorkbookUtil( ExcelAntWorkbookUtil wb ) { + wbUtil = wb ; + } + +} diff --git a/src/excelant/java/org/apache/poi/ss/excelant/IExcelAntWorkbookHandler.java b/src/excelant/java/org/apache/poi/ss/excelant/IExcelAntWorkbookHandler.java index 139e34c0d7..c8db7008d6 100644 --- a/src/excelant/java/org/apache/poi/ss/excelant/IExcelAntWorkbookHandler.java +++ b/src/excelant/java/org/apache/poi/ss/excelant/IExcelAntWorkbookHandler.java @@ -1,42 +1,42 @@ -/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.ss.excelant;
-
-import org.apache.poi.ss.usermodel.Workbook;
-
-
-/**
- * In Excel there are many ways to handle manipulating a workbook based
- * on some arbitrary user action (onChange, etc). You use this interface
- * to create classes that will handle the workbook in whatever manner is needed
- * that cannot be handled by POI.
- * <p>
- * For example, suppose that in Excel when you update a cell the workbook
- * does some calculations and updates other cells based on that change. In
- * ExcelAnt you would set the value of the cell then write your own handler
- * then call that from your Ant task after the set task.
- *
- * @author Jon Svede ( jon [at] loquatic [dot] com )
- * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov )
- *
- */
-public interface IExcelAntWorkbookHandler {
- public void setWorkbook( Workbook workbook ) ;
-
- public void execute() ;
-}
+/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.ss.excelant; + +import org.apache.poi.ss.usermodel.Workbook; + + +/** + * In Excel there are many ways to handle manipulating a workbook based + * on some arbitrary user action (onChange, etc). You use this interface + * to create classes that will handle the workbook in whatever manner is needed + * that cannot be handled by POI. + * <p> + * For example, suppose that in Excel when you update a cell the workbook + * does some calculations and updates other cells based on that change. In + * ExcelAnt you would set the value of the cell then write your own handler + * then call that from your Ant task after the set task. + * + * @author Jon Svede ( jon [at] loquatic [dot] com ) + * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov ) + * + */ +public interface IExcelAntWorkbookHandler { + public void setWorkbook( Workbook workbook ) ; + + public void execute() ; +} diff --git a/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilFactory.java b/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilFactory.java index 08e7fb3d98..683ac46368 100644 --- a/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilFactory.java +++ b/src/excelant/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilFactory.java @@ -1,60 +1,60 @@ -/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-package org.apache.poi.ss.excelant.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * This is a factory class maps file names to WorkbookUtil instances. This
- * helps ExcelAnt be more efficient when being run many times in an Ant build.
- *
- * @author Jon Svede (jon [at] loquatic [dot] com)
- * @author Brian Bush (brian [dot] bush [at] nrel [dot] gov)
- *
- */
-public final class ExcelAntWorkbookUtilFactory {
-
- private static Map<String, ExcelAntWorkbookUtil> workbookUtilMap;
-
- private ExcelAntWorkbookUtilFactory() {
- }
-
- /**
- * Using the fileName, check the internal map to see if an instance
- * of the WorkbookUtil exists. If not, then add an instance to the map.
- *
- * @param fileName The filename to use as key to look for the ExcelAntWorkbookUtil.
- * @return An instance of ExcelAntWorkbookUtil associated with the filename or
- * a freshly instantiated one if none did exist before.
- */
- public static ExcelAntWorkbookUtil getInstance(String fileName) {
- if(workbookUtilMap == null) {
- workbookUtilMap = new HashMap<String, ExcelAntWorkbookUtil>();
- }
-
- if(workbookUtilMap.containsKey(fileName)) {
- return workbookUtilMap.get(fileName);
- }
-
- ExcelAntWorkbookUtil wbu = new ExcelAntWorkbookUtil(fileName);
- workbookUtilMap.put(fileName, wbu);
- return wbu;
- }
-}
+/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.ss.excelant.util; + +import java.util.HashMap; +import java.util.Map; + + +/** + * This is a factory class maps file names to WorkbookUtil instances. This + * helps ExcelAnt be more efficient when being run many times in an Ant build. + * + * @author Jon Svede (jon [at] loquatic [dot] com) + * @author Brian Bush (brian [dot] bush [at] nrel [dot] gov) + * + */ +public final class ExcelAntWorkbookUtilFactory { + + private static Map<String, ExcelAntWorkbookUtil> workbookUtilMap; + + private ExcelAntWorkbookUtilFactory() { + } + + /** + * Using the fileName, check the internal map to see if an instance + * of the WorkbookUtil exists. If not, then add an instance to the map. + * + * @param fileName The filename to use as key to look for the ExcelAntWorkbookUtil. + * @return An instance of ExcelAntWorkbookUtil associated with the filename or + * a freshly instantiated one if none did exist before. + */ + public static ExcelAntWorkbookUtil getInstance(String fileName) { + if(workbookUtilMap == null) { + workbookUtilMap = new HashMap<String, ExcelAntWorkbookUtil>(); + } + + if(workbookUtilMap.containsKey(fileName)) { + return workbookUtilMap.get(fileName); + } + + ExcelAntWorkbookUtil wbu = new ExcelAntWorkbookUtil(fileName); + workbookUtilMap.put(fileName, wbu); + return wbu; + } +} |