1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package helper; 25 26 import java.util.ArrayList; 27 28 import com.sun.star.beans.PropertyValue; 29 30 public class PropertyHelper 31 { 32 /** 33 Create a PropertyValue[] from a ArrayList 34 @param _aPropertyList 35 @return a PropertyValue[] 36 */ createPropertyValueArrayFormArrayList(ArrayList _aPropertyList)37 public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList _aPropertyList) 38 { 39 // copy the whole PropertyValue List to an PropertyValue Array 40 PropertyValue[] aSaveProperties = null; 41 42 if (_aPropertyList == null) 43 { 44 aSaveProperties = new PropertyValue[0]; 45 } 46 else 47 { 48 aSaveProperties = (PropertyValue[])_aPropertyList.toArray(new PropertyValue[_aPropertyList.size()]); 49 // old java 1.4 50 // if (_aPropertyList.size() > 0) 51 // { 52 // aSaveProperties = new PropertyValue[_aPropertyList.size()]; 53 // for (int i = 0;i<_aPropertyList.size(); i++) 54 // { 55 // aSaveProperties[i] = (PropertyValue) _aPropertyList.get(i); 56 // } 57 // } 58 // else 59 // { 60 // aSaveProperties = new PropertyValue[0]; 61 // } 62 63 // show properties? 64 // if (_aPropertyList.size() > 0) 65 // { 66 // // aSaveProperties = new PropertyValue[_aPropertyList.size()]; 67 // for (int i = 0;i<_aPropertyList.size(); i++) 68 // { 69 // PropertyValue aProp = (PropertyValue) _aPropertyList.get(i); 70 // showProperty(aProp); 71 // } 72 // } 73 74 } 75 return aSaveProperties; 76 } 77 } 78