String padding in FCC

Hello All,
I have receiver FCC and have requirement of Right padding strings and left padding numerics. FCC  is of fixedLength.
String data type fields have to be end padded with " " e.g. "Data    "
Numeric or Decimal data type have to be forward padded with "0" e.g. "000001234". Can we handle something like this in FCC itself. Is there any solution except writing and using UDF for each field.
Regards
Arpil

String data type fields have to be end padded with " "
I don't think you need right padding as it is already fixed lenght FCC, the space will be added to the string if its shorter than the specified length.
To control this behaviour you can use NameA.fixedLengthTooShortHandling.
http://help.sap.com/saphelp_nw70/helpdata/EN/d2/bab440c97f3716e10000000a155106/content.htm
And for left padding zero's, you either need to use numFormat function as mentioned or write a udf. I dont think this can be handled in FCC.
Refer this link for UDF-
http://wiki.sdn.sap.com/wiki/label/padding

Similar Messages

  • Pad string with leading blanks

    Im having trouble with padding leading blanks...
    String PRpty_no = "10";
    String qsPRpty_no = null;
    qsPRpty_no = "PRpty_no=\""+pad(PRpty_no, 5, true)+"\" AND ";
    protected String pad(String origString, int requiredSize, boolean justRight){
    String theString=origString;
    if(justRight){
    while(theString.length()<requiredSize){ theString=" "+theString; }
    } else {
    while(theString.length()<requiredSize){ theString=theString+" "; }
    return theString;
    Returns:
    theString = " 10"
    theString = " 10"
    theString = " 10"
    It only adds 1 blank. The loop is obviously finishing when theString.length=5.
    If I replace " " with "0" the desired result comes back:
    theString = "010"
    theString = "0010"
    theString = "00010"
    What is the difference using " " to "0"?

    Unfortunately not GreyMan, copyright and all that. In the end the strings get concatenated into an sql query then run:
    String sql="SELECT PRupi FROM PRprop WHERE ("+qsPRpty_no+qsPRpty_suffix+qsPRroad_id+")";
    Where PRpty gets pulled out from an earlier sql as "10" and qsPRpty needs to be " 10" not " 10".

  • String index out of bounds?

    hi, i am writing a java program which reads in a file and then error checks it, once its done this it will output it to another file.
    It was working fine until i tried writing another method, now it keeps telling there is a string index out of bounds exception with the 'charAt' method. I have uploaded all the necessary files to compile and run the program.
    I am unsure of what the problem is so id be grateful of you would be able to check it out. If it helps i programmed and compiled this problem in netbeans 3.6.
    I uploaded it here: http://www.megaupload.com/?d=45QHZYN1
    you have to wait 45 seconds, the timer is in the right hand corner before you can begin download

    try
          {   System.out.println("2");
              Properties props   = new Properties();
              File file          = new File(System.getProperty("user.home") + File.separator + configFileName);
              BufferedInputStream bis = new BufferedInputStream(new FileInputStream (file));
              props.load(bis);
              if(bis != null)
                  bis.close();
              // Load the information from the properties file.
              String driver = (String)props.get("DB_DRIVER");
              String user    = (String)props.get("DB_USERNAME");
              String passwd  = (String)props.get("DB_PASSWORD");
              String url     = (String)props.get("DB_URL");
              conManager = ConnectionManager.getInstance(driver, user, passwd, url);
    logFilename = fileName.substring(0,fileName.lastIndexOf(".")) + ".log";
              System.out.println("log file name :: " + logFilename);
              fout = new FileOutputStream(new File(logFilename));
         catch (Exception e)
             e.printStackTrace();
      public static void main(String[] args)
        FormsRefresher formsRefresher = new FormsRefresher();
        String filename = "D:\\FCC\\FMB\\CLDUDCMT.fmb";   
        String username ="BPELDEMO";
        String pwd = "BPELDEMO";
        String url = "jdbc:oracle:thin:@PLUTO:1521:seriousim";
        String filename = args[8];
        formsRefresher.initialize(filename);
        formsRefresher.processForm(filename);
    }I am getting the error in the lines quoted bold
    This is the code and i am getting another error also along with that.
    That is Unsatisfiedlink error
    Message was edited by:
    Feroz_CG

  • AES-256, BouncyCastle, Sun Crypto Providers, Default Padding

    Hi,
    The subject alsmost says it all, but in a nutshell, I would like to use BC for AES-256. I also wanted to compare the ciphered outputs from both BC and SUN to make sure everything was working ok (I have installed the Unlimited Strength Jurisdiction Policy Files 6 for the Sun JRE 6).
    I have noticed the following, when the data input is a multiple of 16, the ciphered data generated by both engines are the same (Sun = AES, BC = PaddedBufferedBlockCipher(AES Engine) + PKCS7Padding).
    However, when the data input is not of a multiple of 16 - the ciphered output is different.
    Hence my question: What is the default padding and mode used by the Sun JCE when doing a getInstance("AES") ?
    How to make sure that the ciphered data is the same for both engines, regardless of the data input length pls?
    Thx

    Hi,
    So what is the problem with using the BC provider?
    The problem with using the BC provider is that if you have a web started application, the lambda user should not worry about installing an extra set of files for the JRE. And that lambda user might not know at all how to install the policy file as well. (Note that this policy is only required on Windows - works fine on Mac). All of this for AES-256 should be transparent.
    Code for Sun JCE
    public String encryptToBase64(String data) throws Exception {
              Cipher cipher = Cipher.getInstance(aesCipher); // "AES"
             cipher.init(Cipher.ENCRYPT_MODE, secretKey);
             final byte[] newData = EncryptionUtils.getBytes(data);
             final byte[] edata = cipher.doFinal(newData);
             return Base64.encodeBase64String(edata);
    Code for BC Provider works fine (with policy) - same output
    Only difference comes from:
    Security.addProvider(new BouncyCastleProvider());and
    Cipher cipher = Cipher.getInstance(aesCipher, "BC");What I am just trying to do is to use the BC API directly - no provider - so that my AES-256 ciphered output is the same that the Sun and BC provider with policy installed.
    I managed to do it - but by padding manually the data myself so that it is a multiple of 16 in length (I would llike to avoid this):
    public String encryptToBase64(String data) throws Exception {
              final byte[] newData = EncryptionUtils.getBytes(data);
              return Base64.encodeBase64String(encode(newData));
    }     private byte[] encode(byte[] inputBytes) throws Exception {
             final BufferedBlockCipher cipher = getCipher(true);
             final byte[] outputBytes = new byte[cipher.getOutputSize(inputBytes.length)];
             int outputLen = cipher.processBytes(inputBytes, 0, inputBytes.length, outputBytes, 0);
             outputLen += cipher.doFinal(outputBytes, outputLen);
             final byte[] finalBytes = new byte[outputLen];
             System.arraycopy(outputBytes, 0, finalBytes, 0, outputLen);
             return finalBytes;
    private BufferedBlockCipher getCipher(final boolean forEncryption) {
              final BlockCipher aesEngine = new AESEngine();
              final BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(aesEngine, new PKCS7Padding());
             cipher.init(forEncryption, new KeyParameter(rawKey));
             return cipher;
    }with
    public class EncryptionUtils {
         public static final int DEFAULT_BLOCK_SIZE = 16;
         public static final String pad = "                ";
         public static byte[] getBytes(final String str) {
              if (str.length() == DEFAULT_BLOCK_SIZE) {
                   return str.getBytes();
              final int padding = 16 - str.length() % 16;
              final int newSize = str.length() + padding;
              return (str + pad).substring(0, newSize).getBytes();
    }Apologies if I was not clear.
    On top of that - if your code is deciphered on Android for ex, using BC makes sense as I think it is the provider for Android.
    thx

  • Square root formula

    I have a program that has three columns, in the first column it lists numbers 0-10, in the second column I need to get the square root of each number in the first column. How would I get those results. What is the formula for the square root and how would I code it in? Here is my code so far
    public class ThreeColumn {
        public static void main(String[] args) {
        System.out.println("Number \t Square root \t Even/Odd \t \n");
        int  Ans1 = 0, Ans2 = 0, Ans3 = 0;
         for (int i = 0; i <= 10; i++)
    System.out.println(Ans1 + "\t" );
    Ans1++;
    }Thanks

    Here's something to play around with
    import java.text.*;
    class Testing
      public Testing()
        DecimalFormat df = new DecimalFormat("0.00");
        String[] header = {"Number", "Sqr Root","Even/Odd"};
        String pad = "        ";
        for(int x = 0; x < header.length; x++) System.out.print(header[x]+" ");
        System.out.println("\n========================");
        String sqrNum;
        String[] evenOdd = {"Even","Odd"};
        for(int x = 1; x <= 10; x++)
          sqrNum = df.format(Math.sqrt(x));
          System.out.println((pad+x).substring(pad.length()-header[0].length()+(""+x).length())+
                             (pad+sqrNum).substring(pad.length()-header[1].length()+sqrNum.length()-1)+
                             (pad+evenOdd[x%2]).substring(pad.length()-header[2].length()+evenOdd[x%2].length()-1));
        System.exit(0);
      public static void main(String[] args){new Testing();}   
    }

  • Page number instead of number of entries

    Hello
    I have a requirement for changing the number of entries in KM to page numbers.
    So I need to change:
    1-10 11-20 21-24
    to
    1 2 3
    I found a thread on sdn about this requirement, but there wasn't much information. It just said to write your own Collection Renderer.
    I was able to add something between the breadcrumb (showing the map you are on the moment) and page numbers. So I still don't know where the 'page numbers' are added?
    Is there anyone with experience? Or ideas?
    Thanks!
    Christof
    The decompiled Collection Renderer:
    package be.kindengezin.wcm.rendering.collection.cm;
    // FrontEnd Plus GUI for JAD
    // DeCompiled : CollectionListRenderer.class
    import com.sap.tc.logging.Location;
    import com.sap.tc.logging.LogController;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.CellHAlign;
    import com.sapportals.htmlb.enum.CellVAlign;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.rendering.IPageContext;
    import com.sapportals.wcm.WcmException;
    import com.sapportals.wcm.control.util.EmptyComponent;
    import com.sapportals.wcm.control.util.FolderSettings;
    import com.sapportals.wcm.control.util.property.*;
    import com.sapportals.wcm.rendering.base.*;
    import com.sapportals.wcm.rendering.collection.LightCollectionRenderer;
    //import com.sapportals.wcm.rendering.collection.cm.PropertyColumnRenderer;
    //import com.sapportals.wcm.rendering.collection.cm.PropertyHeaderRenderer;
    import com.sapportals.wcm.rendering.readymades.EmptyCollectionInfo;
    import com.sapportals.wcm.rendering.resource.IResourceRenderer;
    import com.sapportals.wcm.rendering.util.HtmlRendererUtil;
    import com.sapportals.wcm.repository.*;
    import com.sapportals.wcm.repository.service.IRepositoryServiceFactory;
    import com.sapportals.wcm.repository.service.layout.IDebugContainer;
    import com.sapportals.wcm.repository.service.layout.customizing.*;
    import com.sapportals.wcm.service.propertyconfig.*;
    import com.sapportals.wcm.util.logging.LoggingFormatter;
    import com.sapportals.wcm.util.profiler.IProfiler;
    import com.sapportals.wcm.util.profiler.Profiler;
    import com.sapportals.wdf.WdfException;
    import java.util.*;
    import to.work.PropertyColumnRenderer;
    import to.work.PropertyHeaderRenderer;
    // Referenced classes of package com.sapportals.wcm.rendering.collection.cm:
    //                 PropertyHeaderRenderer, PropertyColumnRenderer
    public class CollectionListRenderer extends LightCollectionRenderer
         protected class HeaderItem
              private int rowSpan;
              private int colSpan;
              private IMetaName labelMetaName;
              private IPropertyColumn column;
              private boolean processed;
              public void setRowSpan(int row)
                   rowSpan = row;
              public int getRowSpan()
                   return rowSpan;
              public void setColSpan(int col)
                   colSpan = col;
              public int getColSpan()
                   return colSpan;
              public void setLabelMetaName(IMetaName column)
                   labelMetaName = column;
              public IMetaName getLabelMetaName()
                   return labelMetaName;
              public void setPropertyColumn(IPropertyColumn column)
                   this.column = column;
              public IPropertyColumn getPropertyColumn()
                   return column;
              public String toString()
                   return "Item:  RowSpan=" + rowSpan + "; ColSpan=" + colSpan + "; PropertyColumn=" + getLabelMetaName();
              public HeaderItem()
                   rowSpan = 0;
                   colSpan = 0;
                   labelMetaName = null;
                   column = null;
                   processed = false;
              public HeaderItem(int rowSpan, int colSpan, IMetaName metaName, IPropertyColumn column)
                   this.rowSpan = 0;
                   this.colSpan = 0;
                   labelMetaName = null;
                   this.column = null;
                   processed = false;
                   this.rowSpan = rowSpan;
                   this.colSpan = colSpan;
                   labelMetaName = metaName;
                   this.column = column;
         private static final String PROFILER_PATH_UI_RENDER = "/KM/FLEXUI/RENDER/UI";
         private static final String PROFILER_PATH_UI_RENDER_ROW = "/KM/FLEXUI/RENDER/UI/ROW ";
         private static final String PROFILER_PATH_UI_RENDER_GETPROPS = "/KM/FLEXUI/RENDER/UI/GETPROPS";
         private static IProfiler s_profiler = Profiler.getInstance();
         private static Location log;
         private static int PAGER_LINKS_DEFAULT = 5;
         private static final CellVAlign VERTICAL_ALIGN;
         private int MaxNumberOfRows;
         private int noOfColumns;
         private static IPropertyName DEFAULT_PROP_NAMES[];
         private IPropertyPosition propertiesPositions[];
         private static final String NEXT_LINE_START_COLUMN = "col";
         private static final String NEXT_LINE_METANAME = "metaName";
         private static final String NEXT_LINE_METANAME_MODIFIERS = "metaNameModifiers";
         private boolean debug;
         private boolean isManualOrdered;
         public CollectionListRenderer()
              MaxNumberOfRows = 10;
              noOfColumns = 0;
              debug = false;
              isManualOrdered = false;
              initParameterSettings();
              set508enabled(true);
         private void initParameterSettings()
              IParameterName supportedParameters[] = {
                   ICollectionRendererParameterNameConst.BREADCRUMBSTYLE, ICollectionRendererParameterNameConst.BREADCRUMBVISIBILITYSTYLE, ICollectionRendererParameterNameConst.SHOWFOLDERTITLE, ICollectionRendererParameterNameConst.SHOWFILESSTYLE, ICollectionRendererParameterNameConst.SORT_ENABLED, ICollectionRendererParameterNameConst.LINKSSTYLE, ICollectionRendererParameterNameConst.SHOWFOLDERSSTYLE, ICollectionRendererParameterNameConst.SHOW_HIDDEN, ICollectionRendererParameterNameConst.COLUMNS, IResourceRendererParameterNameConst.ICONSTYLE,
                   ICollectionRendererParameterNameConst.ROWS, ICollectionRendererParameterNameConst.ROWSPACING, ICollectionRendererParameterNameConst.COLUMNSPACING, ICollectionRendererParameterNameConst.MASSACTIONSTYLE, ICollectionRendererParameterNameConst.UI_GROUP_MASS, IResourceRendererParameterNameConst.ITEMACTIONSTYLE, ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, ICollectionRendererParameterNameConst.ROWBACKGROUNDSTYLE, ICollectionRendererParameterNameConst.PROPERTYCOLUMNS, ICollectionRendererParameterNameConst.BACKGROUNDIMAGEPATH,
                   ICollectionRendererParameterNameConst.BACKGROUNDIMAGESTYLE, ICollectionRendererParameterNameConst.SORT_PROPERTY, ICollectionRendererParameterNameConst.COMPONENTS, ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, ICollectionRendererParameterNameConst.SORT_ORDER, ICollectionRendererParameterNameConst.COLLECTION_ACTIONSTYLE, ICollectionRendererParameterNameConst.UI_GROUP_COLLECTION, ICollectionRendererParameterNameConst.RESOURCE_LIST_FILTER, ICollectionRendererParameterNameConst.RESIZEHEIGHTSTYLE, ICollectionRendererParameterNameConst.RESIZEWIDHTSTYLE,
                   ICollectionRendererParameterNameConst.FILTEREXTENSION, ICollectionRendererParameterNameConst.FILTERMIMETYPE, ICollectionRendererParameterNameConst.FILTERRESOURCETYPE, IResourceRendererParameterNameConst.UI_GROUP_RESOURCE, ICollectionRendererParameterNameConst.PAGER_LINK_COUNT, ICollectionRendererParameterNameConst.EMPTY_COLLECTION_FILE, ICollectionRendererParameterNameConst.EMPTY_COLLECTION_KEY, ICollectionRendererParameterNameConst.EMPTY_COLLECTION_STYLE
              setSupportedParameters(supportedParameters);
              IParameters parameters = getParameters();
              parameters.setParameter(ICollectionRendererParameterNameConst.BREADCRUMBSTYLE, "horizontal");
              parameters.setParameter(ICollectionRendererParameterNameConst.BREADCRUMBVISIBILITYSTYLE, "standard");
              parameters.setParameter(ICollectionRendererParameterNameConst.SHOWFILESSTYLE, "all");
              parameters.setParameter(ICollectionRendererParameterNameConst.LINKSSTYLE, "all");
              parameters.setParameter(ICollectionRendererParameterNameConst.SHOWFOLDERSSTYLE, "all");
              parameters.setParameter(ICollectionRendererParameterNameConst.MASSACTIONSTYLE, "off");
              parameters.setParameter(IResourceRendererParameterNameConst.ITEMACTIONSTYLE, "hover");
              parameters.setParameter(ICollectionRendererParameterNameConst.SHOWFOLDERTITLE, false);
              parameters.setParameter(ICollectionRendererParameterNameConst.GRIDORDERSTYLE, "columnmajor");
              parameters.setParameter(ICollectionRendererParameterNameConst.ROWS, MaxNumberOfRows);
              parameters.setParameter(ICollectionRendererParameterNameConst.ROWSPACING, 0);
              parameters.setParameter(ICollectionRendererParameterNameConst.SORT_ENABLED, true);
              parameters.setParameter(ICollectionRendererParameterNameConst.COLUMNSPACING, 0);
              parameters.setParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "off");
              parameters.setParameter(ICollectionRendererParameterNameConst.ROWBACKGROUNDSTYLE, "TRANSPARENT");
              parameters.setParameter(ICollectionRendererParameterNameConst.COLLECTION_ACTIONSTYLE, "hover");
              parameters.setParameter(ICollectionRendererParameterNameConst.PROPERTYCOLUMNS, "rnd:icon(noTitle/noColumnSpacing),rnd:displayname(contentLink)");
              parameters.setParameter(ICollectionRendererParameterNameConst.RESOURCE_LIST_FILTER, "default");
              parameters.setParameter(ICollectionRendererParameterNameConst.SHOW_HIDDEN, false);
              parameters.setParameter(ICollectionRendererParameterNameConst.RESIZEHEIGHTSTYLE, "compact");
              parameters.setParameter(ICollectionRendererParameterNameConst.RESIZEWIDHTSTYLE, "compact");
              parameters.setParameter(ICollectionRendererParameterNameConst.PAGER_LINK_COUNT, PAGER_LINKS_DEFAULT);
              parameters.setParameter(ICollectionRendererParameterNameConst.EMPTY_COLLECTION_STYLE, "off");
         public int renderListHeader(FormLayout grid, int row)
              throws WcmException
              if(isExactlyValue(ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, "off"))
                   return row;
              IPropertyPosition position = null;
              IPropertyColumn iterColumns[] = getColumnsList();
              boolean existsResource = getResourceList().size() != 0;
              String propertyHeaderColumnStyle = getParameters().getParameter(ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, "Table Title Color");
              String headerClassStyle = HtmlRendererUtil.getHeaderClassStyle(propertyHeaderColumnStyle);
              if(headerClassStyle == null)
                   headerClassStyle = "";
              FormLayoutCell cell = null;
              if(existsResource)
                   cell = grid.addComponent(row, 1, new HTMLFragment(""));
                   cell.setStyle(headerClassStyle);
              int rowSpan = 0;
              int columnSpan = 0;
              int line = 1;
              int lineNew = 0;
              int column = 1;
              if(!getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off"))
                   column++;
              int startRow = row;
              boolean rowHasTitle = false;
              propertiesPositions = new IPropertyPosition[iterColumns.length];
              PropertyHeaderRenderer sortHeader = new PropertyHeaderRenderer(getProxy(), this, getBundleHandler(), getChildCountMetaName(getParentCollection()), isManualOrdered, getIRS().getSortDefintion(), getResourceContext().getLocale());
              IMetaName metaName = null;
              for(int i = 0; i < iterColumns.length && existsResource; i++)
                   if(iterColumns<i> != null)
                        rowSpan = 0;
                        columnSpan = 0;
                        position = PropertyColumnFactory.getInstance().getPosition(iterColumns<i>);
                        if(position != null)
                             lineNew = position.getRow();
                             if(line != lineNew)
                                  column = position.getColumn();
                                  if(!getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off"))
                                       column++;
                                  line = lineNew;
                                  if(rowHasTitle)
                                       row++;
                                       rowHasTitle = false;
                             rowSpan = position.getSpanRow();
                             columnSpan = position.getSpanColumn();
                        propertiesPositions<i> = PropertyColumnFactory.getInstance().getPropertyPosition(row, rowSpan, column, columnSpan);
                        boolean is508Required = false;
                        try
                             is508Required = getProxy().getDynamicPage().getPageContext().requiresSection508Rendering();
                        catch(Exception ex)
                             log.errorT("Could not retrieve 508 mode for proxy <" + getProxy() + ">: " + LoggingFormatter.extractCallstack(ex));
                        metaName = PropertyHeaderRenderer.getMetaNameForTitle(iterColumns<i>, is508Required);
                        if(metaName != null)
                             rowHasTitle = true;
                        if(!getParameters().getParameter(ICollectionRendererParameterNameConst.SORT_ENABLED, true))
                             sortHeader.setSortEnabledParameter(false);
                        if(metaName != null)
                             if(columnSpan != 0)
                                  cell = grid.addComponent(row, 1, sortHeader.createSortLink(metaName));
                                  cell.setColspan(columnSpan);
                             } else
                                  cell = grid.addComponent(row, column, sortHeader.createSortLink(metaName));
                             String padding[] = HtmlRendererUtil.getPropertyPaddingValues(iterColumns<i>, metaName);
                             cell.setHorizontalAlignment(PropertyColumnFactory.getInstance().getHAlign(iterColumns<i>));
                             cell.setVerticalAlignment(PropertyColumnFactory.getInstance().getVAlign(iterColumns<i>));
                             if(padding != null)
                                  cell.setPaddingTop(padding[0]);
                                  cell.setPaddingRight(padding[1]);
                                  cell.setPaddingBottom(padding[2]);
                                  cell.setPaddingLeft(padding[3]);
                        column++;
                        if(columnSpan != 0)
                             column += columnSpan;
                        if(!iterColumns<i>.contains("noColumnSpacing") && column < noOfColumns)
                             cell = grid.addComponent(row, column, EmptyComponent.render());
                             if(!"0".equals(getColumnSpacing()))
                                  cell.setWidth(getColumnSpacing());
                             cell.setVerticalAlignment(VERTICAL_ALIGN);
                             column++;
              if(!rowHasTitle)
                   row--;
              setClassStyleForm(headerClassStyle, grid, startRow, row, noOfColumns);
              return ++row;
         public int renderListFooter(FormLayout grid, int row)
              throws WcmException
              boolean existsResource = getResourceList().size() != 0;
              if(!isExactlyValue(ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, "off"))
                   String propertyHeaderColumnStyle = getParameters().getParameter(ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, "Table Title Color");
                   String headerClassStyle = HtmlRendererUtil.getHeaderClassStyle(propertyHeaderColumnStyle);
                   if(headerClassStyle == null)
                        headerClassStyle = "";
                   FormLayoutCell cell = null;
              return row;
         public ILayoutObject getNewInstance()
              return initNewInstance(new CollectionListRenderer());
         private String getChildCountMetaName(IResource res)
              throws WcmException
              if(res == null)
                   return null;
              IResourceRenderer resourceRenderer = getRenderer(res);
              String par = resourceRenderer.getParameters().getParameter(IResourceRendererParameterNameConst.SHOWCHILDCOUNTSTYLE);
              if(par == null)
                   return null;
              String resultMetaNameID = null;
              if(par.equals("folders/files"))
                   resultMetaNameID = "rnd:childcount_both";
              else
              if(par.equals("sum"))
                   resultMetaNameID = "rnd:childcount_sum";
              else
              if(par.equals("only files"))
                   resultMetaNameID = "rnd:childcount_files";
              else
              if(par.equals("only folders"))
                   resultMetaNameID = "rnd:childcount_folders";
              if(resultMetaNameID != null)
                   IMetaName metaName = getPropertyConfigurationService().getMetaModel().searchById(resultMetaNameID);
                   if(metaName != null)
                        return getEncodedSortProperty(metaName);
              return null;
         private String getEncodedSortProperty(IMetaName metaName)
              if(metaName.getComposedOfMetaNames() != null)
                   IMetaNameList metaList = metaName.getComposedOfMetaNames();
                   if(metaList.contains(metaName))
                        return metaName.getId();
                   if(metaList.size() == 1)
                        IMetaName composedMetaName = metaList.get(0);
                        return composedMetaName.getId();
                   } else
                        return metaName.getId();
              } else
                   return metaName.getId();
         public static Vector getIMetaNameTypeText(IPropertyColumn propertyColumn, int col)
              Hashtable metaNameHash = null;
              Vector metaNameVector = null;
              IMetaName currentMetaName = null;
              IPropertyWithModifiersList propertyWithModifiers = propertyColumn.getPropertyWithModifier();
              for(int i = 0; i < propertyWithModifiers.size(); i++)
                   currentMetaName = propertyWithModifiers.get(i).getMetaName();
                   if(currentMetaName != null && "Text".equals(currentMetaName.getType()) && propertyWithModifiers.size() != 1)
                        metaNameHash = new Hashtable();
                        metaNameHash.put("metaName", currentMetaName);
                        metaNameHash.put("col", Integer.toString(col));
                        if(propertyWithModifiers.get(i).getConfigModifierList() != null)
                             metaNameHash.put("metaNameModifiers", propertyWithModifiers.get(i));
                        if(metaNameVector == null)
                             metaNameVector = new Vector();
                        metaNameVector.add(metaNameHash);
              return metaNameVector;
         private static boolean[] isNextLineColumnNeeded(IPropertyColumn propertyColumns[])
              boolean result[] = new boolean[propertyColumns.length];
              IMetaName currentMetaName = null;
              for(int j = 0; j < propertyColumns.length; j++)
                   IPropertyColumn propertyColumn = propertyColumns[j];
                   result[j] = false;
                   IPropertyWithModifiersList propertyWithModifiers = propertyColumn.getPropertyWithModifier();
                   for(int i = 0; i < propertyWithModifiers.size(); i++)
                        currentMetaName = propertyWithModifiers.get(i).getMetaName();
                        if(currentMetaName != null && "Text".equals(currentMetaName.getType()) && propertyWithModifiers.size() != 1)
                             if(log.beDebug())
                                  log.debugT("Found meta name <" + currentMetaName + "> in property column <" + propertyColumn + "> that defines we need a new line column");
                             result[j] = true;
              return result;
         private IPropertyConfigurationService getPropertyConfigurationService()
              throws WcmException
              return (IPropertyConfigurationService)ResourceFactory.getInstance().getServiceFactory().getService("PropertyConfigurationService");
         public final void setColumnsList(IPropertyColumn list[])
              throws WcmException
              getIRS().setPropertyColumns(list);
         public IPropertyColumn[] getColumnsList()
              throws WcmException
              return getIRS().getPropertyColumns();
         private IPropertyColumn[] createCollectionColumns()
              String columnsString = getParameters().getParameter(ICollectionRendererParameterNameConst.PROPERTYCOLUMNS, "rnd:icon(noTitle/noColumnSpacing),rnd:displayname(contentLink)");
              return PropertyColumnFactory.getInstance().parseProperty(columnsString);
         public Component renderUI()
              throws WcmException
              s_profiler.start("/KM/FLEXUI/RENDER/UI", com.sapportals.wcm.util.profiler.IProfiler.Level.MEDIUM);
              try
                   if(getProxy().isDebugEnabled())
                        writeDebugInformation();
                   setColumnsList(createCollectionColumns());
                   FormLayout grid = new FormLayout();
                   grid.setMargin("0", "0", "0", "0");
                   grid.setWidth("");               
                   FormLayoutCell cell = null;
                   grid.setDebugMode(debug);
                   int row = 1;
                   grid.addComponent(++row, 1, new TextView("CH-BOVENALL"));
                   if(!isVisible())
                        FormLayout formlayout = grid;
                        return formlayout;
                   if(getParameter(ICollectionRendererParameterNameConst.SHOWFOLDERTITLE, false))
                        cell = grid.addComponent(row, 1, renderFolderTitle());
                        cell.setColspan(10);
                        cell.setPaddingTop("2");
                        cell.setPaddingBottom("3");
                        row++;
                   IResourceList resourcelist = getResourceList();
                   if(!getParameters().isExactlyValue(ICollectionRendererParameterNameConst.EMPTY_COLLECTION_STYLE, "off") && resourcelist != null && resourcelist.size() == 0)
                        cell = grid.addComponent(row, 1, new EmptyCollectionInfo(getProxy(), getParameters()));
                        cell.setColspan(10);
                        cell.setHorizontalAlignment(CellHAlign.LEFT);
                        row++;
                   noOfColumns = PropertyColumnFactory.getNoOfColumn(getColumnsList(), MaxNumberOfRows);
                   int column = 1;
                   if(!getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off"))
                        column++;
                        noOfColumns++;
                   if(getParentCollection() != null)
                        FolderSettings currFolderSettings = new FolderSettings(getParentCollection());
                        isManualOrdered = currFolderSettings.getOrderedFlag();
                   row = renderListHeader(grid, row);
                   boolean widthStrech = getParameters().getParameter(ICollectionRendererParameterNameConst.RESIZEWIDHTSTYLE, "compact").equals("stretch");
                   boolean heightStrech = getParameters().getParameter(ICollectionRendererParameterNameConst.RESIZEHEIGHTSTYLE, "compact").equals("stretch");
                   int maxnumberOfElements = getStartRow() + getParameters().getParameter(ICollectionRendererParameterNameConst.ROWS, MaxNumberOfRows);
                   if(maxnumberOfElements > resourcelist.size())
                        maxnumberOfElements = resourcelist.size();
                   int rowHeightPercent = 0;
                   if(heightStrech && maxnumberOfElements != 0)
                        rowHeightPercent = 100 / maxnumberOfElements;
                   IResourceList renderlist = resourcelist.subList(getStartRow(), maxnumberOfElements);
                   IResourceListIterator iter = renderlist.listIterator();
                   IResource res = null;
                   boolean lightStyleClass = true;
                   String classStyle = "";
                   boolean alternatingMode = isExactlyValue(ICollectionRendererParameterNameConst.ROWBACKGROUNDSTYLE, "ALTERNATING");
                   boolean lineSeparatedMode = isExactlyValue(ICollectionRendererParameterNameConst.ROWBACKGROUNDSTYLE, "LINE_SEPARATED");
                   if(alternatingMode || lineSeparatedMode)
                        grid.addComponent(row, 1, HtmlRendererUtil.importStyles());
                        row++;
                   if(getColumnsList() != null)
                        IPropertyNameList propertynamelist = PropertyColumnFactory.getInstance().getPropertyNameList(getColumnsList());
                        for(int i = 0; i < DEFAULT_PROP_NAMES.length; i++)
                             if(DEFAULT_PROP_NAMES<i> != null)
                                  propertynamelist.add(DEFAULT_PROP_NAMES<i>);
                        s_profiler.start("/KM/FLEXUI/RENDER/UI/GETPROPS", com.sapportals.wcm.util.profiler.IProfiler.Level.MEDIUM);
                        try
                             getProxy().getAmalgamation().readProperties(renderlist, propertynamelist);
                        finally
                             s_profiler.stop("/KM/FLEXUI/RENDER/UI/GETPROPS");
                        IPropertyPosition positions[] = getPositionArray(getColumnsList());
                        boolean nextColumns[] = isNextLineColumnNeeded(getColumnsList());
                        boolean selectionActive = !getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off");
                        List paddings = getPaddingList(getColumnsList(), selectionActive);
                        while(iter.hasNext())
                             res = iter.next();
                             if(alternatingMode)
                                  classStyle = "urCellBgPlain";
                                  if(!lightStyleClass)
                                       classStyle = "urSTbvCellAlt";
                             row = renderFormRow(grid, row, 1, res, classStyle, rowHeightPercent, propertynamelist, positions, nextColumns, paddings);
                             if(lineSeparatedMode && iter.hasNext())
                                  cell = grid.addComponent(row, 1, HtmlRendererUtil.renderLineSeparator("urCellBgPlain", 1));
                                  cell.setColspan(noOfColumns);
                                  row++;
                             lightStyleClass = !lightStyleClass;
                   row = renderListFooter(grid, row);
                   if(widthStrech)
                        grid.setWidth("100%");
                   FormLayout formlayout1 = grid;
                   IParameters parameters = getParameters();
                   formlayout1.addComponent(++row, 1, new TextView("CH-BOVEN "+parameters.getParameter(IParameterName.PAGER_LINK_COUNT).toString()));
                   return formlayout1;
              catch(Exception ex)
                   throw new WcmException(ex);
              finally
                   s_profiler.stop("/KM/FLEXUI/RENDER/UI");
         private static List getPaddingList(IPropertyColumn columnsList[], boolean selectionActive)
              List result = new ArrayList();
              for(int i = 0; i < columnsList.length; i++)
                   String padding[] = null;
                   try
                        padding = PropertyColumnRenderer.getPropertyColumnArrayPadding(columnsList<i>, selectionActive);
                   catch(WdfException e)
                        log.errorT("Could not parse padding for column <" + columnsList<i> + "> " + LoggingFormatter.beautify(e));
                        padding = (new String[] {
                             "0", "0", "0", "0"
                   result.add(padding);
              return result;
         private static IPropertyPosition[] getPositionArray(IPropertyColumn columns[])
              IPropertyPosition result[] = new IPropertyPosition[columns.length];
              for(int i = 0; i < columns.length; i++)
                   result<i> = PropertyColumnFactory.getInstance().getPosition(columns<i>);
              if(log.beDebug())
                   log.debugT("Calculated property position array <" + result + "> for property column array <" + columns + ">");
              return result;
         private int renderFormRow(FormLayout grid, int row, int column, IResource res, String classStyle, int rowHeightPercent, IPropertyNameList propertynamelist,
                   IPropertyPosition positions[], boolean nextColumns[], List paddings)
              throws WcmException
              s_profiler.start("/KM/FLEXUI/RENDER/UI/ROW ", com.sapportals.wcm.util.profiler.IProfiler.Level.MEDIUM);
              try
                   boolean emptyRow = true;
                   try
                        Vector nextLine = new Vector();
                        Vector nextLineColumn = new Vector();
                        Hashtable nextLineElement = new Hashtable();
                        FormLayoutCell cell = null;
                        int nextLineCol = 0;
                        int line = 1;
                        int startRow = row;
                        boolean selectionActive = false;
                        IPropertyPosition position = null;
                        IResourceRenderer renderer = getRenderer(res);
                        renderer.setPropertyNameList(propertynamelist);
                        String padding[] = null;
                        Component comp = new HTMLFragment(" ");
                        if(!getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off"))
                             comp = renderItemSelectionMode(res);
                             cell = grid.addComponent(row, column, comp);
                             cell.setVerticalAlignment(VERTICAL_ALIGN);
                             cell.setPaddingRight("2");
                             cell.setPaddingLeft("3");
                             selectionActive = true;
                             column++;
                        int columnSpan = 0;
                        int rowSpan = 0;
                        IMetaName metaName = null;
                        for(int i = 0; i < getColumnsList().length; i++)
                             try
                                  columnSpan = 0;
                                  position = positions<i>;
                                  if(position != null)
                                       int lineNew = position.getRow();
                                       if(line != lineNew)
                                            column = position.getColumn();
                                            if(!getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off"))
                                                 column++;
                                            line = lineNew;
                                            if(!emptyRow)
                                                 row++;
                                            emptyRow = true;
                                       columnSpan = position.getSpanColumn();
                                       rowSpan = position.getSpanRow();
                                  comp = PropertyColumnRenderer.renderPropertyColumn(renderer, res, getColumnsList()<i>, false, getProxy());
                                  emptyRow = emptyRow && (comp == null || (comp instanceof EmptyComponent));
                                  if(comp != null)
                                       if(columnSpan != 0)
                                            cell = grid.addComponent(row, column, comp);
                                            cell.setColspan(columnSpan);
                                       } else
                                            cell = grid.addComponent(row, column, comp);
                                       if(rowSpan != 0)
                                            cell.setRowspan(rowSpan);
                                       cell.setVerticalAlignment(PropertyColumnFactory.getInstance().getVAlign(getColumnsList()<i>));
                                       cell.setHorizontalAlignment(PropertyColumnFactory.getInstance().getHAlign(getColumnsList()<i>));
                                       padding = (String[])paddings.get(i);
                                       if(padding != null)
                                            cell.setPaddingTop(padding[0]);
                                            cell.setPaddingRight(padding[1]);
                                            cell.setPaddingBottom(padding[2]);
                                            cell.setPaddingLeft(padding[3]);
                                       selectionActive = false;
                                  if(nextColumns<i>)
                                       nextLineColumn = getIMetaNameTypeText(getColumnsList()<i>, column);
                                       nextLine.addAll(nextLineColumn);
                                  column++;
                             catch(WcmException wcmEx)
                                  log.debugT("Could not rendere row for resource <" + res + "> & columns <" + getColumnsList()<i> + ">" + LoggingFormatter.extractCallstack(wcmEx));
                                  if(columnSpan != 0)
                                       cell = grid.addComponent(row, column, EmptyComponent.render());
                                       cell.setColspan(columnSpan);
                                  } else
                                       cell = grid.addComponent(row, column, EmptyComponent.render());
                                  column++;
                             if(columnSpan != 0)
                                  column += columnSpan;
                             if(!getColumnsList()<i>.contains("noColumnSpacing") && column < noOfColumns)
                                  cell = grid.addComponent(row, column, EmptyComponent.render());
                                  if(!"0".equals(getColumnSpacing()))
                                       cell.setWidth(getColumnSpacing());
                                  column++;
                        boolean emptyComponent = true;
                        for(int k = 0; k < nextLine.size(); k++)
                             nextLineElement = (Hashtable)nextLine.elementAt(k);
                             if(nextLineElement != null)
                                  IPropertyWithModifiers currProp = (IPropertyWithModifiers)nextLineElement.get("metaNameModifiers");
                                  nextLineCol = Integer.parseInt((String)nextLineElement.get("col"));
                                  metaName = (IMetaName)nextLineElement.get("metaName");
                                  renderer.getParameters().setParameter(IResourceRendererParameterNameConst.PROPERTY_MODIFIERS, PropertyColumnFactory.getInstance().getModifierString(currProp.getModifierList()));
                                  comp = PropertyColumnRenderer.renderMetaProperty(renderer, metaName, false, true);
                                  emptyComponent = false;
                                  if(comp != null && (comp instanceof EmptyComponent))
                                       emptyComponent = true;
                                  if(!emptyComponent)
                                       if(!emptyRow)
                                            row++;
                                       cell = grid.addComponent(row, nextLineCol, comp);
                                       cell.setColspan(column);
                                       emptyRow = false;
                        int rowSpace = 0;
                        try
                             rowSpace = Integer.parseInt(getRowSpacing());
                        catch(NumberFormatException nfEx)
                             log.debugT("Could not get an Integer from <" + getRowSpacing() + ">; " + LoggingFormatter.extractCallstack(nfEx));
                             rowSpace = 0;
                        int endRow = row;
                        if(emptyRow)
                             endRow = row - 1;
                        if(rowSpace != 0)
                             String paddingStyle = String.valueOf(rowSpace);
                             if(startRow != endRow)
                                  setHeightPercentageForm(rowHeightPercent, paddingStyle, 1, grid, startRow, noOfColumns);
                                  setHeightPercentageForm(rowHeightPercent, paddingStyle, 1, grid, endRow, noOfColumns);
                             } else
                                  setHeightPercentageForm(rowHeightPercent, paddingStyle, 0, grid, endRow, noOfColumns);
                        if(!"".equals(classStyle))
                             setClassStyleForm(classStyle, grid, startRow, row, noOfColumns);
                   catch(Exception e)
                        throw new WcmException(e);
                   if(!emptyRow)
                        row++;
              finally
                   s_profiler.stop("/KM/FLEXUI/RENDER/UI/ROW ");
              return row;
         private void setHeightPercentageForm(int rowHeightPercent, String padding, int paddingStyle, FormLayout grid, int row, int col)
              FormLayoutCell cell = null;
              FormLayoutRow rows = grid.getRow(row);
              for(int j = 1; j <= col; j++)
                   cell = rows.getCell(j);
                   if(cell != null)
                        if(rowHeightPercent != 0)
                             cell.setWidth(""";height="" + String.valueOf(rowHeightPercent) + "%"");
                        if(paddingStyle == 1)
                             cell.setPaddingTop(padding);
                        else
                        if(paddingStyle == -1)
                             cell.setPaddingBottom(padding);
                        } else
                             cell.setPaddingTop(padding);
                             cell.setPaddingBottom(padding);
         private void setClassStyleForm(String classStyle, FormLayout grid, int startRow, int endRow, int col)
              FormLayoutCell cell = null;
              FormLayoutRow currentRow = null;
              int rowSpan = 0;
              int noCol = col;
              boolean hasRowSpan = false;
              for(int i = startRow; i <= endRow; i++)
                   currentRow = grid.getRow(i);
                   if(currentRow != null)
                        if(hasRowSpan)
                             noCol = col - 1;
                             hasRowSpan = --rowSpan > 0;
                        } else
                             noCol = col;
                        for(int j = 1; j <= noCol; j++)
                             cell = currentRow.getCell(j);
                             if(cell != null && cell.getRowspan() > 1)
                                  hasRowSpan = true;
                                  rowSpan = cell.getRowspan() - 1;
                             if(cell != null)
                                  cell.setStyle(classStyle);
                             } else
                                  cell = grid.addComponent(i, j, EmptyComponent.render());
                                  cell.setStyle(classStyle);
         public HeaderItem[][] genetateMatrixHeader()
              throws WcmException
              if(isExactlyValue(ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, "off"))
                   return null;
              IPropertyPosition position = null;
              IPropertyColumn iterColumns[] = getColumnsList();
              boolean existsResource = getResourceList().size() != 0;
              if(!existsResource)
                   return null;
              HeaderItem headerMatrix[][] = new HeaderItem[10][20];
              int currentRow = 0;
              int currentColumn = 0;
              int currentRowSpan = 0;
              int currentColumnSpan = 0;
              int nextCol = 0;
              int maxRow = 0;
              int maxCol = 0;
              boolean is508Required = false;
              try
                   is508Required = getProxy().getDynamicPage().getPageContext().requiresSection508Rendering();
              catch(Exception ex)
                   log.errorT("Could not retrieve 508 mode for proxy <" + getProxy() + ">: " + LoggingFormatter.extractCallstack(ex));
              IMetaName metaName = null;
              for(int i = 0; i < iterColumns.length && existsResource; i++)
                   if(iterColumns<i> != null)
                        position = PropertyColumnFactory.getInstance().getPosition(iterColumns<i>);
                        if(position != null)
                             if(currentRow != position.getRow() - 1)
                                  nextCol = 0;
                             currentRow = position.getRow() - 1;
                             currentColumn = (position.getColumn() - 1) + nextCol;
                             currentRowSpan = position.getSpanRow();
                             currentColumnSpan = position.getSpanColumn();
                        } else
                             currentRowSpan = 0;
                             currentColumnSpan = 0;
                   metaName = PropertyHeaderRenderer.getMetaNameForTitle(iterColumns<i>, is508Required);
                   if(metaName != null)
                        headerMatrix[currentRow][currentColumn] = new HeaderItem(currentRowSpan, currentColumnSpan, metaName, iterColumns<i>);
                        nextCol = 1;
                        maxRow = maxRow <= currentRow ? currentRow : maxRow;
                        maxCol = maxCol <= currentColumn ? currentColumn : maxCol;
                   currentColumn++;
                   if(currentColumnSpan != 0)
                        currentColumn += currentColumnSpan;
                   if(!iterColumns<i>.contains("noColumnSpacing"))
                        currentColumn++;
              maxRow++;
              maxCol++;
              if(maxRow > 0 || maxCol > 0)
                   HeaderItem resultMatrix[][] = new HeaderItem[maxRow][maxCol];
                   for(int i = 0; i < maxRow; i++)
                        for(int k = 0; k < maxCol; k++)
                             resultMatrix<i>[k] = headerMatrix<i>[k];
                   return resultMatrix;
              } else
                   return null;
         public int renderListHeader1(FormLayout grid, int row)
              throws WcmException
              if(isExactlyValue(ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, "off"))
                   return row;
              HeaderItem header[][] = genetateMatrixHeader();
              if(header == null)
                   return row;
              String propertyHeaderColumnStyle = getParameters().getParameter(ICollectionRendererParameterNameConst.PROPERTY_COLUMN_HEADER_STYLE, "Table Title Color");
              String headerClassStyle = HtmlRendererUtil.getHeaderClassStyle(propertyHeaderColumnStyle);
              if(headerClassStyle == null)
                   headerClassStyle = "";
              FormLayoutCell cell = null;
              int columnSpan = 0;
              int column = 1;
              if(!getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off"))
                   column++;
              int startRow = row;
              HeaderItem headerItem = null;
              PropertyHeaderRenderer sortHeader = new PropertyHeaderRenderer(getProxy(), this, getBundleHandler(), getChildCountMetaName(getParentCollection()), isManualOrdered, getIRS().getSortDefintion(), getResourceContext().getLocale());
              IMetaName metaName = null;
              int colHeader = 0;
              for(int i = 0; i < header.length; i++)
                   row += i;
                   if(!getParameters().getParameter(ICollectionRendererParameterNameConst.ITEMSELECTIONMODE, "multiple").equals("off"))
                        colHeader = 1;
                   else
                        colHeader = 0;
                   for(int k = 0; k < header[0].length; k++)
                        headerItem = header<i>[k];
                        if(headerItem != null)
                             boolean is508Required = false;
                             try
                                  is508Required = getProxy().getDynamicPage().getPageContext().requiresSection508Rendering();
                             catch(Exception ex)
                                  log.errorT("Could not retrieve 508 mode for proxy <" + getProxy() + ">: " + LoggingFormatter.extractCallstack(ex));
                             metaName = headerItem.getLabelMetaName();
                             if(headerItem.getColSpan() != 0)
                                  cell = grid.addComponent(row, k + colHeader + 1, sortHeader.createSortLink(metaName));
                                  cell.setColspan(headerItem.getColSpan());
                             } else
                                  cell = grid.addComponent(row, k + colHeader + 1, sortHeader.createSortLink(metaName));
                             String padding[] = HtmlRendererUtil.getPropertyPaddingValues(headerItem.getPropertyColumn(), metaName);
                             cell.setHorizontalAlignment(PropertyColumnFacto

    Hello
    My problem is the following on the moment:
    In debug, I get the message the pager can't be created.
    Could not create command with alias KenGPager and classname be.kindengezin.wcm.rendering.component.cm.Pager:java.lang.ClassNotFoundException: be.kindengezin.wcm.rendering.component.cm.Pager
         at com.sapportals.wcm.crt.CrtClassLoaderRegistry.findClass(CrtClassLoaderRegistry.java:176)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at com.sapportals.wcm.rendering.collection.ComponentFactory.createComponent(ComponentFactory.java:447)
         at com.sapportals.wcm.rendering.collection.ComponentFactory.initialize(ComponentFactory.java:489)
         at com.sapportals.wcm.rendering.collection.ComponentFactory.configEvent(ComponentFactory.java:553)
         at com.sapportals.config.event.ConfigEventService.dispatchEvent(ConfigEventService.java:227)
         at com.sapportals.config.event.ConfigEventService.configEvent(ConfigEventService.java:112)
         at com.sapportals.config.event.ConfigEventDispatcher.callConfigListeners(ConfigEventDispatcher.java:308)
         at com.sapportals.config.event.ConfigEventDispatcher.flushEvents(ConfigEventDispatcher.java:251)
         at com.sapportals.config.event.ConfigEventDispatcher.run(ConfigEventDispatcher.java:110)
    My java files start as following:
    package be.kindengezin.wcm.rendering.component.cm;
    import com.sap.tc.logging.Location;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.TextViewDesign;
    import com.sapportals.htmlb.event.Event;
    import com.sapportals.wcm.WcmException;
    import com.sapportals.wcm.control.util.PropertyRendererString;
    import com.sapportals.wcm.rendering.base.*;
    import com.sapportals.wcm.rendering.collection.*;
    import com.sapportals.wcm.rendering.util.EmptyHtmlFragment;
    import com.sapportals.wcm.rendering.util.PagerData;
    import com.sapportals.wcm.repository.*;
    import com.sapportals.wcm.repository.service.IRepositoryServiceFactory;
    import com.sapportals.wcm.repository.service.layout.customizing.IParameterName;
    import com.sapportals.wcm.service.propertyconfig.*;
    import com.sapportals.wcm.util.logging.LoggingFormatter;
    import com.sapportals.wcm.util.name.IName;
    import com.sapportals.wcm.util.resource.ResourceBundles;
    import com.sapportals.wcm.util.uri.RID;
    import java.util.*;
    // Referenced classes of package com.sapportals.wcm.rendering.component.cm:
    //                 LightComponent, PagerComponent, PagerInterval
    public class Pager extends LightComponent
    Edited by: Christof Houben on Oct 6, 2008 3:44 PM

  • Help Needed.. Creating custom calendar problems

    I am trying to create a calendar like this
    DateRun Shift
    10/27/2004 06:30 A
    10/27/2004 18:30 B
    10/28/2004 06:30 C
    10/28/2004 18:30 D
    and so on.. except that there is a small login inside for day when it is Thursday. One week Shift 'A' works and the next week Shift 'B' works..
    Here is the procedure; Appreciate your help immediately.,..
    CREATE OR REPLACE procedure create_calendar as
    STARTDATE VARCHAR2(20);
    shifter1 varchar2(5);
    shifter2 varchar2(5);
    shiftcycle number;
    counts number;
    begin
    startdate := '11/09/2000';
    counts:= 0;
    shiftcycle:= 14;
    delete from calendar;
    commit;
    for counts in 0..1000
    loop
    dbms_output.put_line(counts);
    if to_char(sysdate + counts,'DAY') = 'MONDAY' or to_char(sysdate + counts,'DAY') = 'TUESDAY' or to_char(sysdate + counts,'DAY') = 'WEDNESDAY'
    then
    dbms_output.put_line('Code in here 1');
    shifter1:= 'A';
    shifter2:= 'B';
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 06:30',shifter1 from dual;
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 18:30',shifter2 from dual;
    elsif to_char(sysdate + counts,'DAY') = 'THURSDAY' and mod((to_char(sysdate + counts,'mm/dd/yyyy') - startdate),shiftcycle) = 0
    then
    dbms_output.put_line('Code in here 2');
    shifter1:= 'A';
    shifter2:= 'B';
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 06:30',shifter1 from dual;
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 18:30',shifter2 from dual;
    elsif to_char(sysdate + counts,'DAY') = 'THURSDAY' and mod((to_char(sysdate + counts,'mm/dd/yyyy') - startdate),shiftcycle) <> 0
    then
    dbms_output.put_line('Code in here 3');
    shifter1:= 'C';
    shifter2:= 'D';
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 06:30',shifter1 from dual;
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 18:30',shifter2 from dual;
    elsif to_char(sysdate + counts,'DAY') = 'FRIDAY' or to_char(sysdate + counts,'DAY') = 'SATURDAY' or to_char(sysdate + counts,'DAY') = 'SUNDAY'
    then
    dbms_output.put_line('Code in here 4');
    shifter1:= 'C';
    shifter2:= 'D';
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 06:30',shifter1 from dual;
    insert into calendar (daterun, shift) select to_char(sysdate + counts,'mm/dd/yyyy') || ' 18:30',shifter2 from dual;
    end if;
    --exit when counts >1000;
    end loop;
    commit;
    end create_calendar;

    You don't say what your problem is, so it is kind of difficult to help.
    As a guess, I would say that your code only inserts rows for Wednesdays. TO_CHAR(date, 'DAY') returns a string padded with spaces to the length of the longest day name, in English, that is Wednesday (9 characters).
    SQL>DECLARE
      2     x DATE := sysdate;
      3  BEGIN
      4     IF TO_CHAR(x, 'DAY') = 'THURSDAY' THEN
      5        DBMS_OUTPUT.Put_Line('Is Thursday');
      6     ELSE
      7        DBMS_OUTPUT.Put_Line('Is Not');
      8     END IF;
      9
    10     IF TO_CHAR(x, 'DAY') = 'THURSDAY ' THEN
    11        DBMS_OUTPUT.Put_Line('Now it is Thursday');
    12     ELSE
    13        DBMS_OUTPUT.Put_Line('No it is not!');
    14     END IF;
    15  END;
    16  /
    Is Not
    Now it is ThursdayTTFN
    John

  • For SAPscript INCLUDE TEXT, how to align as Paragraph format

    Hi experts and ABAP colleagues!
    Need your help on this sapscript problem:
    How to align texts taken from "INCLUDE TEXT" in SAPscript, according to tab defined in Paragraph Format?
    For example, I defined BG to have tabstop at the 2nd column (or equivalent to 1st tab position) where I need to print the text, and then declared it in SE71 like below:
    However the text prints at the leftmost instead of at the 2nd col position - (8th char tab defined in par. format BG).  Hence it is not aligned to its proper heading.  Line Number instead of Description - which is not okay for client view that needs these Thai texts. 
    The technical details I included below.  Kindly examine:
    1.)  Window >Main > Text Element > Include Text command
    /E   ITEM_TEXT
    BG   ,,&TTXIT-TDTEXT&
    /:   INCLUDE &T166P-TXNAM& OBJECT &T166P-TDOBJECT& ID &T166P-TDID&
    /:   NEW-PARAGRAPH BG
    Note:  I used command "NEW-PARAGRAPH" and had exactly the above code in se71.  Anything missed here?  Pls. help.  Thanks.
    #2.) Paragraph Format > Tab
    No. -
      Tab Position -
    Alignment
    1            8,00 CH            LEFT
    2            28,00 CH          CENTER
    etc.
    Note:   and then i put in  ",,&TTXIT-TDTEXT&" (see above) with the 2 comma's beforehand to say that its on the 1st tab or at the 8th character where it should be printed, but does not give intended result... pls help.
    #3.) Paragraph Formats > Standard Attributes
    Left Margin - 0 cm
    Alignment - Left
    no blank lines checkbox - ticked
    Note:  Is there any more attribute i can manipulate from here to force display at the right position?
    Thank you so much in advance for all your help.  Our project team will really appreciate it.  May the Lord bless you as we go through our SAP work!
    Sincerely,
    Celeste

    Here's a thought, instead of using tabs, try writing a method that takes a string that is the starting string, a pad character, and a length and returns a string padded to that length with the specified character.
    public String padR(String src, String padChar, int len)
        // ... You get to fill in the rest suggestion try to do it without a loop
    }Have fun,
    PS.

  • Outputting BigInteger Results one line at a time

    hi all,
    im new to this. im havin problems with my code. i was to read into two Bigintegers and multi[ply them.. but with the multiplication i want to show each line as it is being done and send it to the screen. as u can see from the code i was hopin to do it in two parts. the first gettin the result and the second just workin it out line by line. is this a good way to do it?  i was tryin to read the last digit and work up to the work up to the first but i cant do it. here is a snippet of the calucatations.. i really hope someone can help cause im really stuck at this point
    thanks a million
    al.
    BigInteger num1 = new BigInteger(textAreaNum1.getText());
        BigInteger num2 = new BigInteger(textAreaNum2.getText());
        result = num1.multiply(num2);
        totalDigit = num2;
        currDigit= num2;
        for (BigInteger ix = BigInteger.ZERO; ix.compareTo(totalDigit) < 0; ix = currDigit.add(BigInteger.ONE))
          currResult = currDigit.multiply(num1);
          textAreaCalculation.setText("" + num1 + "" + zeroAdder);
    textAreaResult.setText(""+ result);
    // the resultin screen should look like
    // 234
    // *123
    // 702
    // 4680
    // 23400
    // 28782

    this is my program as it stands but with another class callin the frame.. so u want me to change the textfield to jtextfield?
    package Mulitply;
    import java.awt.*;
    import java.awt.event.*;
    import java.math.BigInteger;
    import javax.swing.JTextArea.*;
    * Title: Mulitplier of Large Numbers
    * Description: This class extends the application class and add all
    * all the data below to it. it basically sets up the frame
    * in terms of look,feel and action.
    * Copyright: Copyright (c) 2004
    * Company:
    * author
    * version 1.0
    class CalcFrame extends Frame implements ActionListener{
    Button btnMult;
    TextField textAreaNum1, textAreaNum2, textAreaCalculation, textAreaResult;
    public CalcFrame() {
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    setSize(1000, 300);
    setTitle("Mulitpler");
    setLayout(new FlowLayout());
    setBackground(Color.lightGray);
    Panel pnlNums = new Panel();
    Panel pnlBtns = new Panel();
    Panel pnlCalculation = new Panel();
    Panel pnlResult = new Panel();
    setLayout(new GridLayout(3, 1));
    textAreaNum1 = new TextField(50);
    textAreaNum2 = new TextField(50);
    pnlNums.add(textAreaNum1);
    pnlNums.add(textAreaNum2);
    btnMult = new Button("*");
    btnMult.addActionListener(this);
    pnlBtns.add(btnMult);
    textAreaCalculation = new TextField(50);
    textAreaResult = new TextField(50);
    pnlResult.add(textAreaResult);
    pnlCalculation.add(textAreaCalculation);
    add(pnlNums);
    add(pnlBtns);
    add(pnlCalculation);
    add(pnlResult);
    public void actionPerformed(ActionEvent e) {
    String str1 = textAreaNum1.getText().trim();
    String str2 = textAreaNum2.getText().trim();
    int len1 = str1.length();
    int len2 = str2.length();
    if ( (len1 == 0) || (len2 == 0))
    return;
    BigInteger num1 = new BigInteger(str1);
    BigInteger num2 = new BigInteger(str2);
    BigInteger result = num1.multiply(num2);
    String resultStr = result.toString();
    int resultLen = resultStr.length();
    textAreaCalculation.setText("");
    textAreaCalculation.append(str1 + "\n");
    textAreaCalculation.append("*" + str2 + "\n");
    textAreaCalculation.append(pad(resultLen, "--") + "\n");
    BigInteger ten = new BigInteger("10");
    for (int i = (len2 - 1); i >= 0; i--) {
    BigInteger curNum = new BigInteger(str2.substring(i, i + 1));
    BigInteger curRes = curNum.multiply(num1);
    for (int j = 0; j < len2 - 1 - i; j++)
    curRes = curRes.multiply(ten);
    String curResStr = curRes.toString();
    int curResLen = curResStr.length();
    textAreaCalculation.append(pad(resultLen - curResLen, "--") + curResStr + "\n");
    textAreaCalculation.append(pad(resultLen, "--") + "\n");
    textAreaCalculation.append(resultStr + "\n");
    String pad(int n, String s) {
    String ret = "";
    for (int i = 0; i < n; i++)
    ret += s;
    return ret;
    }

  • How batch export layers to files png in cc

    I am having trouble with an export layers to files script i am wanting to batch export layer to png and this script i have seems to be the one i want although every time i run the script i get this error message "could not complete the action  since the destination folder doesn't exist" the script required me to hard code my destination path the path i require is "C:/Users/Tim/Desktop/Backdrops/png/" I am not completely sure why its stating it does not exist any help would be greatly appreciated. i have tried to contact the creator but the post it was on was very old.
    // enable double clicking from the Macintosh Finder or the Windows Explorer
    #target photoshop
    //=================================================================
    // Globals
    //=================================================================
    var exportPath = "/Users/pedr/Documents/Work/Clients/Pathways/Learning_Hub/Source/Comics/export";
    exportPath = exportPath + '/layers';
    // UI strings to be localized
    var strTitle = localize("$$$/JavaScripts/X2L/Title=X2L");
    var strButtonRun = localize("$$$/JavaScripts/X2L/Run=Run");
    var strButtonCancel = localize("$$$/JavaScripts/X2L/Cancel=Cancel");
    var strHelpText = localize("$$$/JavaScripts/X2L/Help=Please specify the format and location for saving each layer as a file.");
    var strLabelDestination = localize("$$$/JavaScripts/X2L/Destination=Destination:");
    var strButtonBrowse = localize("$$$/JavaScripts/X2L/Browse=&Browse...");
    var strLabelFileNamePrefix = localize("$$$/JavaScripts/X2L/FileNamePrefix=File Name Prefix:");
    var strCheckboxVisibleOnly = localize("$$$/JavaScripts/X2L/VisibleOnly=&Visible Layers Only");
    var strLabelFileType = localize("$$$/JavaScripts/X2L/FileType=File Type:");
    var strCheckboxIncludeICCProfile = localize("$$$/JavaScripts/X2L/IncludeICC=&Include ICC Profile");
    var strJPEGOptions = localize("$$$/JavaScripts/X2L/JPEGOptions=JPEG Options:");
    var strLabelQuality = localize("$$$/JavaScripts/X2L/Quality=Quality:");
    var strCheckboxMaximizeCompatibility = localize("$$$/JavaScripts/X2L/Maximize=&Maximize Compatibility");
    var strTIFFOptions = localize("$$$/JavaScripts/X2L/TIFFOptions=TIFF Options:");
    var strLabelImageCompression = localize("$$$/JavaScripts/X2L/ImageCompression=Image Compression:");
    var strNone = localize("$$$/JavaScripts/X2L/None=None");
    var strPDFOptions = localize("$$$/JavaScripts/X2L/PDFOptions=PDF Options:");
    var strLabelEncoding = localize("$$$/JavaScripts/X2L/Encoding=Encoding:");
    var strTargaOptions = localize("$$$/JavaScripts/X2L/TargaOptions=Targa Options:");
    var strLabelDepth = localize("$$$/JavaScripts/X2L/Depth=Depth:");
    var strRadiobutton16bit = localize("$$$/JavaScripts/X2L/Bit16=16bit");
    var strRadiobutton24bit = localize("$$$/JavaScripts/X2L/Bit24=24bit");
    var strRadiobutton32bit = localize("$$$/JavaScripts/X2L/Bit32=32bit");
    var strBMPOptions = localize("$$$/JavaScripts/X2L/BMPOptions=BMP Options:");
    var strAlertSpecifyDestination = localize("$$$/JavaScripts/X2L/SpecifyDestination=Please specify destination.");
    var strAlertDestinationNotExist = localize("$$$/JavaScripts/X2L/DestionationDoesNotExist=Destination does not exist.");
    var strTitleSelectDestination = localize("$$$/JavaScripts/X2L/SelectDestination=Select Destination");
    var strAlertDocumentMustBeOpened = localize("$$$/JavaScripts/X2L/OneDocument=You must have a document open to export!");
    var strAlertNeedMultipleLayers = localize("$$$/JavaScripts/X2L/NoLayers=You need a document with multiple layers to export!");
    var strAlertWasSuccessful = localize("$$$/JavaScripts/X2L/Success= was successful.");
    var strUnexpectedError = localize("$$$/JavaScripts/X2L/Unexpected=Unexpected error");
    var strMessage = localize("$$$/JavaScripts/X2L/Message=X2L");
    var stretQuality = localize( "$$$/locale_specific/JavaScripts/X2L/ETQualityLength=30" );
    var stretDestination = localize( "$$$/locale_specific/JavaScripts/X2L/ETDestinationLength=160" );
    var strddFileType = localize( "$$$/locale_specific/JavaScripts/X2L/DDFileType=100" );
    var strpnlOptions = localize( "$$$/locale_specific/JavaScripts/X2L/PNLOptions=100" );
    var strPNG8Options = localize("$$$/JavaScripts/X2L/PNG8Options=PNG-8 Options:");
    var strCheckboxPNGTransparency = localize("$$$/JavaScripts/X2L/Transparency=Transparency");
    var strCheckboxPNGInterlaced = localize("$$$/JavaScripts/X2L/Interlaced=Interlaced");
    var strCheckboxPNGTrm = localize("$$$/JavaScripts/X2L/Trim=Trim Layers");
    var strPNG24Options = localize("$$$/JavaScripts/X2L/PNG24Options=PNG-24 Options:");
    // the drop down list indexes for file type
    var png24Index = 7;
    main();
    // Functions
    // Function: main
    // Usage: the core routine for this script
    // Input: <none>
    // Return: <none>
    function main() {
        if ( app.documents.length <= 0 ) {
            if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                alert( strAlertDocumentMustBeOpened );
            return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
        var exportInfo = new Object();
        initExportInfo(exportInfo);
        // look for last used params via Photoshop registry, getCustomOptions will throw if none exist
        try {
        catch(e) {
            // it's ok if we don't have any options, continue with defaults
        try {
            var docName = app.activeDocument.name;  // save the app.activeDocument name before duplicate.
            var layerCount = app.documents[docName].layers.length;
            var layerSetsCount = app.documents[docName].layerSets.length;
            if ((layerCount <= 1)&&(layerSetsCount <= 0)) {
                if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                    alert( strAlertNeedMultipleLayers );
                return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
            } else {
                var rememberMaximize;
                var needMaximize = exportInfo.psdMaxComp ? QueryStateType.ALWAYS : QueryStateType.NEVER;
                app.activeDocument = app.documents[docName];
                var duppedDocument = app.activeDocument.duplicate();
                duppedDocument.activeLayer = duppedDocument.layers[duppedDocument.layers.length-1]; // for removing
                setInvisibleAllArtLayers(duppedDocument);
                exportChildren(duppedDocument, app.documents[docName], exportInfo, duppedDocument, exportInfo.fileNamePrefix);
                duppedDocument.close( SaveOptions.DONOTSAVECHANGES );
                if ( rememberMaximize != undefined ) {
                    app.preferences.maximizeCompatibility = rememberMaximize;
                if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
                    //alert(strTitle + strAlertWasSuccessful);
                app.playbackDisplayDialogs = DialogModes.ALL;
        } catch (e) {
            if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                alert(e);
            return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
    // Function: settingDialog
    // Usage: pop the ui and get user settings
    // Input: exportInfo object containing our parameters
    // Return: on ok, the dialog info is set to the exportInfo object
    function settingDialog(exportInfo) {
      return;
    // Function: hideAllFileTypePanel
    // Usage: hide all the panels in the common actions
    // Input: <none>, dlgMain is a global for this script
    // Return: <none>, all panels are now hidden
    function hideAllFileTypePanel() {
    // Function: initExportInfo
    // Usage: create our default parameters
    // Input: a new Object
    // Return: a new object with params set to default
    function initExportInfo(exportInfo) {
        //exportInfo.destination = new String(exportPath);
        exportInfo.fileNamePrefix = new String("untitled_");
        exportInfo.visibleOnly = false;
        exportInfo.fileType = png24Index;
        exportInfo.icc = true;
        exportInfo.png24Transparency = true;
        exportInfo.png24Interlaced = false;
        exportInfo.png24Trim = true;
        try {
            exportInfo.destination = Folder(new String(exportPath)).fsName; // destination folder
            var tmp = app.activeDocument.fullName.name;
            exportInfo.fileNamePrefix = decodeURI(tmp.substring(0, tmp.indexOf("."))); // filename body part
        } catch(someError) {
            exportInfo.destination = new String(exportPath);
            exportInfo.fileNamePrefix = app.activeDocument.name; // filename body part
    // Function: saveFile
    // Usage: the worker routine, take our params and save the file accordingly
    // Input: reference to the document, the name of the output file,
    //        export info object containing more information
    // Return: <none>, a file on disk
    function saveFile( docRef, fileNameBody, exportInfo) {
                saveFile(docRef, fileNameBody, exportInfo, false, true);
                function saveFile( docRef, fileNameBody, exportInfo, interlacedValue, transparencyValue) {
                var id6 = charIDToTypeID( "Expr" );
                    var desc3 = new ActionDescriptor();
                    var id7 = charIDToTypeID( "Usng" );
                        var desc4 = new ActionDescriptor();
                        var id8 = charIDToTypeID( "Op  " );
                        var id9 = charIDToTypeID( "SWOp" );
                        var id10 = charIDToTypeID( "OpSa" );
                        desc4.putEnumerated( id8, id9, id10 );
                        var id11 = charIDToTypeID( "Fmt " );
                        var id12 = charIDToTypeID( "IRFm" );
                        var id13 = charIDToTypeID( "PN24" );
                        desc4.putEnumerated( id11, id12, id13 );
                        var id14 = charIDToTypeID( "Intr" );
                        desc4.putBoolean( id14, interlacedValue );
                        var id15 = charIDToTypeID( "Trns" );
                        desc4.putBoolean( id15, transparencyValue );
                        var id16 = charIDToTypeID( "Mtt " );
                        desc4.putBoolean( id16, true );
                        var id17 = charIDToTypeID( "MttR" );
                        desc4.putInteger( id17, 255 );
                        var id18 = charIDToTypeID( "MttG" );
                        desc4.putInteger( id18, 255 );
                        var id19 = charIDToTypeID( "MttB" );
                        desc4.putInteger( id19, 255 );
                        var id20 = charIDToTypeID( "SHTM" );
                        desc4.putBoolean( id20, false );
                        var id21 = charIDToTypeID( "SImg" );
                        desc4.putBoolean( id21, true );
                        var id22 = charIDToTypeID( "SSSO" );
                        desc4.putBoolean( id22, false );
                        var id23 = charIDToTypeID( "SSLt" );
                            var list1 = new ActionList();
                        desc4.putList( id23, list1 );
                        var id24 = charIDToTypeID( "DIDr" );
                        desc4.putBoolean( id24, false );
                        var id25 = charIDToTypeID( "In  " );
                        desc4.putPath( id25, new File( exportPath + "C:/Users/Tim/Desktop/Backdrops/png/"  + fileNameBody + ".png") );
                    var id26 = stringIDToTypeID( "SaveForWeb" );
                    desc3.putObject( id7, id26, desc4 );
                executeAction( id6, desc3, DialogModes.NO );
    // Function: zeroSuppress
    // Usage: return a string padded to digit(s)
    // Input: num to convert, digit count needed
    // Return: string padded to digit length
    function zeroSuppress (num, digit) {
        var tmp = num.toString();
        while (tmp.length < digit) {
            tmp = "0" + tmp;
        return tmp;
    // Function: setInvisibleAllArtLayers
    // Usage: unlock and make invisible all art layers, recursively
    // Input: document or layerset
    // Return: all art layers are unlocked and invisible
    function setInvisibleAllArtLayers(obj) {
        for( var i = 0; i < obj.artLayers.length; i++) {
            obj.artLayers[i].allLocked = false;
            obj.artLayers[i].visible = false;
        for( var i = 0; i < obj.layerSets.length; i++) {
            setInvisibleAllArtLayers(obj.layerSets[i]);
    // Function: removeAllInvisibleArtLayers
    // Usage: remove all the invisible art layers, recursively
    // Input: document or layer set
    // Return: <none>, all layers that were invisible are now gone
    function removeAllInvisibleArtLayers(obj) {
        for( var i = obj.artLayers.length-1; 0 <= i; i--) {
            try {
                if(!obj.artLayers[i].visible) {
                    obj.artLayers[i].remove();
            catch (e) {
        for( var i = obj.layerSets.length-1; 0 <= i; i--) {
            removeAllInvisibleArtLayers(obj.layerSets[i]);
    // Function: removeAllEmptyLayerSets
    // Usage: find all empty layer sets and remove them, recursively
    // Input: document or layer set
    // Return: empty layer sets are now gone
    function removeAllEmptyLayerSets(obj) {
        var foundEmpty = true;
        for( var i = obj.layerSets.length-1; 0 <= i; i--) {
            if( removeAllEmptyLayerSets(obj.layerSets[i])) {
                obj.layerSets[i].remove();
            } else {
                foundEmpty = false;
        if (obj.artLayers.length > 0) {
            foundEmpty = false;
        return foundEmpty;
    // Function: zeroSuppress
    // Usage: return a string padded to digit(s)
    // Input: num to convert, digit count needed
    // Return: string padded to digit length
    function removeAllInvisible(docRef) {
        removeAllInvisibleArtLayers(docRef);
        removeAllEmptyLayerSets(docRef);
    // Function: exportChildren
    // Usage: find all the children in this document to save
    // Input: duplicate document, original document, export info,
    //        reference to document, starting file name
    // Return: <none>, documents are saved accordingly
    function exportChildren(dupObj, orgObj, exportInfo, dupDocRef, fileNamePrefix) {
        for( var i = 0; i < dupObj.artLayers.length; i++) {
            if (exportInfo.visibleOnly) { // visible layer only
                if (!orgObj.artLayers[i].visible) {
                    continue;
            dupObj.artLayers[i].visible = true;
            var layerName = dupObj.artLayers[i].name;  // store layer name before change doc
            var duppedDocumentTmp = dupDocRef.duplicate();
            if ((png24Index == exportInfo.fileType)||(png8Index == exportInfo.fileType)) { // PSD: Keep transparency
                removeAllInvisible(duppedDocumentTmp);
                //PNGFileOptions
                        if (activeDocument.activeLayer.isBackgroundLayer == false) { //is it anything but a background layer?
                            app.activeDocument.trim(TrimType.TRANSPARENT);
            } else { // just flatten
                duppedDocumentTmp.flatten();
            // Edit
            var docName = app.activeDocument.name;
            // For some reason indexOf fails if we include the '-', so we use 'copy' and decrement the index by 1.
            docName = docName.slice(0, docName.indexOf('copy')-1);
            var fileNameBody = (docName+'_'+layerName).toLowerCase();
            fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|]/g, "_");  // '/\:*?"<>|' -> '_'
            if (fileNameBody.length > 120) {
                fileNameBody = fileNameBody.substring(0,120);
            saveFile(duppedDocumentTmp, fileNameBody, exportInfo);
            duppedDocumentTmp.close(SaveOptions.DONOTSAVECHANGES);
            dupObj.artLayers[i].visible = false;
        for( var i = 0; i < dupObj.layerSets.length; i++) {
            if (exportInfo.visibleOnly) { // visible layer only
                if (!orgObj.layerSets[i].visible) {
                    continue;
            var fileNameBody = fileNamePrefix;
            fileNameBody += "_" + zeroSuppress(i, 4) + "s";
            exportChildren(dupObj.layerSets[i], orgObj.layerSets[i], exportInfo, dupDocRef, fileNameBody);  // recursive call
    // Function: objectToDescriptor
    // Usage: create an ActionDescriptor from a JavaScript Object
    // Input: JavaScript Object (o)
    //        object unique string (s)
    //        Pre process converter (f)
    // Return: ActionDescriptor
    // NOTE: Only boolean, string, number and UnitValue are supported, use a pre processor
    //       to convert (f) other types to one of these forms.
    // REUSE: This routine is used in other scripts. Please update those if you
    //        modify. I am not using include or eval statements as I want these
    //        scripts self contained.
    function objectToDescriptor (o, s, f) {
        o = {};
        var d = new ActionDescriptor;
        var l = o.reflect.properties.length;
        d.putString( app.charIDToTypeID( 'Msge' ), s );
        for (var i = 0; i < l; i++ ) {
            var k = o.reflect.properties[i].toString();
            if (k == "__proto__" || k == "__count__" || k == "__class__" || k == "reflect")
                continue;
            var v = o[ k ];
            k = app.stringIDToTypeID(k);
            switch ( typeof(v) ) {
                case "boolean":
                    d.putBoolean(k, v);
                    break;
                case "string":
                    d.putString(k, v);
                    break;
                case "number":
                    d.putDouble(k, v);
                    break;
                default:
                    if ( v instanceof UnitValue ) {
                        var uc = new Object;
                        uc["px"] = charIDToTypeID("#Rlt"); // unitDistance
                        uc["%"] = charIDToTypeID("#Prc"); // unitPercent
                        d.putUnitDouble(k, uc[v.type], v.value);
                    } else {
                        throw( new Error("Unsupported type in objectToDescriptor " + typeof(v) ) );
        return d;
    // Function: descriptorToObject
    // Usage: update a JavaScript Object from an ActionDescriptor
    // Input: JavaScript Object (o), current object to update (output)
    //        Photoshop ActionDescriptor (d), descriptor to pull new params for object from
    //        object unique string (s)
    //        JavaScript Function (f), post process converter utility to convert
    // Return: Nothing, update is applied to passed in JavaScript Object (o)
    // NOTE: Only boolean, string, number and UnitValue are supported, use a post processor
    //       to convert (f) other types to one of these forms.
    // REUSE: This routine is used in other scripts. Please update those if you
    //        modify. I am not using include or eval statements as I want these
    //        scripts self contained.
    function descriptorToObject (o, d, s, f) {
        var l = d.count;
        if (l) {
            var keyMessage = app.charIDToTypeID( 'Msge' );
            if ( d.hasKey(keyMessage) && ( s != d.getString(keyMessage) )) return;
        for (var i = 0; i < l; i++ ) {
            var k = d.getKey(i); // i + 1 ?
            var t = d.getType(k);
            strk = app.typeIDToStringID(k);
            switch (t) {
                case DescValueType.BOOLEANTYPE:
                    o[strk] = d.getBoolean(k);
                    break;
                case DescValueType.STRINGTYPE:
                    o[strk] = d.getString(k);
                    break;
                case DescValueType.DOUBLETYPE:
                    o[strk] = d.getDouble(k);
                    break;
                case DescValueType.UNITDOUBLE:
                    var uc = new Object;
                    uc[charIDToTypeID("#Rlt")] = "px"; // unitDistance
                    uc[charIDToTypeID("#Prc")] = "%"; // unitPercent
                    uc[charIDToTypeID("#Pxl")] = "px"; // unitPixels
                    var ut = d.getUnitDoubleType(k);
                    var uv = d.getUnitDoubleValue(k);
                    o[strk] = new UnitValue( uv, uc[ut] );
                    break;
                case DescValueType.INTEGERTYPE:
                case DescValueType.ALIASTYPE:
                case DescValueType.CLASSTYPE:
                case DescValueType.ENUMERATEDTYPE:
                case DescValueType.LISTTYPE:
                case DescValueType.OBJECTTYPE:
                case DescValueType.RAWTYPE:
                case DescValueType.REFERENCETYPE:
                default:
                    throw( new Error("Unsupported type in descriptorToObject " + t ) );
        if (undefined != f) {
            o = f(o);
    // Function: preProcessExportInfo
    // Usage: convert Photoshop enums to strings for storage
    // Input: JavaScript Object of my params for this script
    // Return: JavaScript Object with objects converted for storage
    function preProcessExportInfo(o) {
        o.tiffCompression = o.tiffCompression.toString();
        o.pdfEncoding = o.pdfEncoding.toString();
        o.targaDepth = o.targaDepth.toString();
        o.bmpDepth = o.bmpDepth.toString();
        return o;
    // Function: postProcessExportInfo
    // Usage: convert strings from storage to Photoshop enums
    // Input: JavaScript Object of my params in string form
    // Return: JavaScript Object with objects in enum form
    function postProcessExportInfo(o) {
        o.tiffCompression = eval(o.tiffCompression);
        o.pdfEncoding = eval(o.pdfEncoding);
        o.targaDepth = eval(o.targaDepth);
        o.bmpDepth = eval(o.bmpDepth);
        return o;
    // Function: StrToIntWithDefault
    // Usage: convert a string to a number, first stripping all characters
    // Input: string and a default number
    // Return: a number
    function StrToIntWithDefault( s, n ) {
        var onlyNumbers = /[^0-9]/g;
        var t = s.replace( onlyNumbers, "" );
        t = parseInt( t );
        if ( ! isNaN( t ) ) {
            n = t;
        return n;
    // End X2L.jsx

    I have put the like var exportPath = "~/Desktop/Backdrops/png/";  and have removed the exportPath = exportPath + '/layers';
    but when i run the script it still comes up with the error
    could not complete action since the destination folder does not exist
    if you are using the extendedscript toolkit would be able to run the script and see if you know were the problem is coming from i cant seem to understand why its not seeing the destination.
    thanks for all your help
    // enable double clicking from the Macintosh Finder or the Windows Explorer
    #target photoshop
    //=================================================================
    // Globals
    //=================================================================
    var exportPath = "~/Desktop/Backdrops/png/";
    // UI strings to be localized
    var strTitle = localize("$$$/JavaScripts/X2L/Title=X2L");
    var strButtonRun = localize("$$$/JavaScripts/X2L/Run=Run");
    var strButtonCancel = localize("$$$/JavaScripts/X2L/Cancel=Cancel");
    var strHelpText = localize("$$$/JavaScripts/X2L/Help=Please specify the format and location for saving each layer as a file.");
    var strLabelDestination = localize("$$$/JavaScripts/X2L/Destination=Destination:");
    var strButtonBrowse = localize("$$$/JavaScripts/X2L/Browse=&Browse...");
    var strLabelFileNamePrefix = localize("$$$/JavaScripts/X2L/FileNamePrefix=File Name Prefix:");
    var strCheckboxVisibleOnly = localize("$$$/JavaScripts/X2L/VisibleOnly=&Visible Layers Only");
    var strLabelFileType = localize("$$$/JavaScripts/X2L/FileType=File Type:");
    var strCheckboxIncludeICCProfile = localize("$$$/JavaScripts/X2L/IncludeICC=&Include ICC Profile");
    var strJPEGOptions = localize("$$$/JavaScripts/X2L/JPEGOptions=JPEG Options:");
    var strLabelQuality = localize("$$$/JavaScripts/X2L/Quality=Quality:");
    var strCheckboxMaximizeCompatibility = localize("$$$/JavaScripts/X2L/Maximize=&Maximize Compatibility");
    var strTIFFOptions = localize("$$$/JavaScripts/X2L/TIFFOptions=TIFF Options:");
    var strLabelImageCompression = localize("$$$/JavaScripts/X2L/ImageCompression=Image Compression:");
    var strNone = localize("$$$/JavaScripts/X2L/None=None");
    var strPDFOptions = localize("$$$/JavaScripts/X2L/PDFOptions=PDF Options:");
    var strLabelEncoding = localize("$$$/JavaScripts/X2L/Encoding=Encoding:");
    var strTargaOptions = localize("$$$/JavaScripts/X2L/TargaOptions=Targa Options:");
    var strLabelDepth = localize("$$$/JavaScripts/X2L/Depth=Depth:");
    var strRadiobutton16bit = localize("$$$/JavaScripts/X2L/Bit16=16bit");
    var strRadiobutton24bit = localize("$$$/JavaScripts/X2L/Bit24=24bit");
    var strRadiobutton32bit = localize("$$$/JavaScripts/X2L/Bit32=32bit");
    var strBMPOptions = localize("$$$/JavaScripts/X2L/BMPOptions=BMP Options:");
    var strAlertSpecifyDestination = localize("$$$/JavaScripts/X2L/SpecifyDestination=Please specify destination.");
    var strAlertDestinationNotExist = localize("$$$/JavaScripts/X2L/DestionationDoesNotExist=Destination does not exist.");
    var strTitleSelectDestination = localize("$$$/JavaScripts/X2L/SelectDestination=Select Destination");
    var strAlertDocumentMustBeOpened = localize("$$$/JavaScripts/X2L/OneDocument=You must have a document open to export!");
    var strAlertNeedMultipleLayers = localize("$$$/JavaScripts/X2L/NoLayers=You need a document with multiple layers to export!");
    var strAlertWasSuccessful = localize("$$$/JavaScripts/X2L/Success= was successful.");
    var strUnexpectedError = localize("$$$/JavaScripts/X2L/Unexpected=Unexpected error");
    var strMessage = localize("$$$/JavaScripts/X2L/Message=X2L");
    var stretQuality = localize( "$$$/locale_specific/JavaScripts/X2L/ETQualityLength=30" );
    var stretDestination = localize( "$$$/locale_specific/JavaScripts/X2L/ETDestinationLength=160" );
    var strddFileType = localize( "$$$/locale_specific/JavaScripts/X2L/DDFileType=100" );
    var strpnlOptions = localize( "$$$/locale_specific/JavaScripts/X2L/PNLOptions=100" );
    var strPNG8Options = localize("$$$/JavaScripts/X2L/PNG8Options=PNG-8 Options:");
    var strCheckboxPNGTransparency = localize("$$$/JavaScripts/X2L/Transparency=Transparency");
    var strCheckboxPNGInterlaced = localize("$$$/JavaScripts/X2L/Interlaced=Interlaced");
    var strCheckboxPNGTrm = localize("$$$/JavaScripts/X2L/Trim=Trim Layers");
    var strPNG24Options = localize("$$$/JavaScripts/X2L/PNG24Options=PNG-24 Options:");
    // the drop down list indexes for file type
    var png24Index = 7;
    main();
    // Functions
    // Function: main
    // Usage: the core routine for this script
    // Input: <none>
    // Return: <none>
    function main() {
        if ( app.documents.length <= 0 ) {
            if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                alert( strAlertDocumentMustBeOpened );
            return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
        var exportInfo = new Object();
        initExportInfo(exportInfo);
        // look for last used params via Photoshop registry, getCustomOptions will throw if none exist
        try {
        catch(e) {
            // it's ok if we don't have any options, continue with defaults
        try {
            var docName = app.activeDocument.name;  // save the app.activeDocument name before duplicate.
            var layerCount = app.documents[docName].layers.length;
            var layerSetsCount = app.documents[docName].layerSets.length;
            if ((layerCount <= 1)&&(layerSetsCount <= 0)) {
                if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                    alert( strAlertNeedMultipleLayers );
                return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
            } else {
                var rememberMaximize;
                var needMaximize = exportInfo.psdMaxComp ? QueryStateType.ALWAYS : QueryStateType.NEVER;
                app.activeDocument = app.documents[docName];
                var duppedDocument = app.activeDocument.duplicate();
                duppedDocument.activeLayer = duppedDocument.layers[duppedDocument.layers.length-1]; // for removing
                setInvisibleAllArtLayers(duppedDocument);
                exportChildren(duppedDocument, app.documents[docName], exportInfo, duppedDocument, exportInfo.fileNamePrefix);
                duppedDocument.close( SaveOptions.DONOTSAVECHANGES );
                if ( rememberMaximize != undefined ) {
                    app.preferences.maximizeCompatibility = rememberMaximize;
                if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
                    //alert(strTitle + strAlertWasSuccessful);
                app.playbackDisplayDialogs = DialogModes.ALL;
        } catch (e) {
            if ( DialogModes.NO != app.playbackDisplayDialogs ) {
                alert(e);
            return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
    // Function: settingDialog
    // Usage: pop the ui and get user settings
    // Input: exportInfo object containing our parameters
    // Return: on ok, the dialog info is set to the exportInfo object
    function settingDialog(exportInfo) {
      return;
    // Function: hideAllFileTypePanel
    // Usage: hide all the panels in the common actions
    // Input: <none>, dlgMain is a global for this script
    // Return: <none>, all panels are now hidden
    function hideAllFileTypePanel() {
    // Function: initExportInfo
    // Usage: create our default parameters
    // Input: a new Object
    // Return: a new object with params set to default
    function initExportInfo(exportInfo) {
        //exportInfo.destination = new String(exportPath);
        exportInfo.fileNamePrefix = new String("untitled_");
        exportInfo.visibleOnly = false;
        exportInfo.fileType = png24Index;
        exportInfo.icc = true;
        exportInfo.png24Transparency = true;
        exportInfo.png24Interlaced = false;
        exportInfo.png24Trim = true;
        try {
            exportInfo.destination = Folder(new String(exportPath)).fsName; // destination folder
            var tmp = app.activeDocument.fullName.name;
            exportInfo.fileNamePrefix = decodeURI(tmp.substring(0, tmp.indexOf("."))); // filename body part
        } catch(someError) {
            exportInfo.destination = new String(exportPath);
            exportInfo.fileNamePrefix = app.activeDocument.name; // filename body part
    // Function: saveFile
    // Usage: the worker routine, take our params and save the file accordingly
    // Input: reference to the document, the name of the output file,
    //        export info object containing more information
    // Return: <none>, a file on disk
    function saveFile( docRef, fileNameBody, exportInfo) {
                saveFile(docRef, fileNameBody, exportInfo, false, true);
                function saveFile( docRef, fileNameBody, exportInfo, interlacedValue, transparencyValue) {
                var id6 = charIDToTypeID( "Expr" );
                    var desc3 = new ActionDescriptor();
                    var id7 = charIDToTypeID( "Usng" );
                        var desc4 = new ActionDescriptor();
                        var id8 = charIDToTypeID( "Op  " );
                        var id9 = charIDToTypeID( "SWOp" );
                        var id10 = charIDToTypeID( "OpSa" );
                        desc4.putEnumerated( id8, id9, id10 );
                        var id11 = charIDToTypeID( "Fmt " );
                        var id12 = charIDToTypeID( "IRFm" );
                        var id13 = charIDToTypeID( "PN24" );
                        desc4.putEnumerated( id11, id12, id13 );
                        var id14 = charIDToTypeID( "Intr" );
                        desc4.putBoolean( id14, interlacedValue );
                        var id15 = charIDToTypeID( "Trns" );
                        desc4.putBoolean( id15, transparencyValue );
                        var id16 = charIDToTypeID( "Mtt " );
                        desc4.putBoolean( id16, true );
                        var id17 = charIDToTypeID( "MttR" );
                        desc4.putInteger( id17, 255 );
                        var id18 = charIDToTypeID( "MttG" );
                        desc4.putInteger( id18, 255 );
                        var id19 = charIDToTypeID( "MttB" );
                        desc4.putInteger( id19, 255 );
                        var id20 = charIDToTypeID( "SHTM" );
                        desc4.putBoolean( id20, false );
                        var id21 = charIDToTypeID( "SImg" );
                        desc4.putBoolean( id21, true );
                        var id22 = charIDToTypeID( "SSSO" );
                        desc4.putBoolean( id22, false );
                        var id23 = charIDToTypeID( "SSLt" );
                            var list1 = new ActionList();
                        desc4.putList( id23, list1 );
                        var id24 = charIDToTypeID( "DIDr" );
                        desc4.putBoolean( id24, false );
                        var id25 = charIDToTypeID( "In  " );
                        desc4.putPath( id25, new File( exportPath + "C:/Users/Tim/Desktop/Backdrops/png/"  + fileNameBody + ".png") );
                    var id26 = stringIDToTypeID( "SaveForWeb" );
                    desc3.putObject( id7, id26, desc4 );
                executeAction( id6, desc3, DialogModes.NO );
    // Function: zeroSuppress
    // Usage: return a string padded to digit(s)
    // Input: num to convert, digit count needed
    // Return: string padded to digit length
    function zeroSuppress (num, digit) {
        var tmp = num.toString();
        while (tmp.length < digit) {
            tmp = "0" + tmp;
        return tmp;
    // Function: setInvisibleAllArtLayers
    // Usage: unlock and make invisible all art layers, recursively
    // Input: document or layerset
    // Return: all art layers are unlocked and invisible
    function setInvisibleAllArtLayers(obj) {
        for( var i = 0; i < obj.artLayers.length; i++) {
            obj.artLayers[i].allLocked = false;
            obj.artLayers[i].visible = false;
        for( var i = 0; i < obj.layerSets.length; i++) {
            setInvisibleAllArtLayers(obj.layerSets[i]);
    // Function: removeAllInvisibleArtLayers
    // Usage: remove all the invisible art layers, recursively
    // Input: document or layer set
    // Return: <none>, all layers that were invisible are now gone
    function removeAllInvisibleArtLayers(obj) {
        for( var i = obj.artLayers.length-1; 0 <= i; i--) {
            try {
                if(!obj.artLayers[i].visible) {
                    obj.artLayers[i].remove();
            catch (e) {
        for( var i = obj.layerSets.length-1; 0 <= i; i--) {
            removeAllInvisibleArtLayers(obj.layerSets[i]);
    // Function: removeAllEmptyLayerSets
    // Usage: find all empty layer sets and remove them, recursively
    // Input: document or layer set
    // Return: empty layer sets are now gone
    function removeAllEmptyLayerSets(obj) {
        var foundEmpty = true;
        for( var i = obj.layerSets.length-1; 0 <= i; i--) {
            if( removeAllEmptyLayerSets(obj.layerSets[i])) {
                obj.layerSets[i].remove();
            } else {
                foundEmpty = false;
        if (obj.artLayers.length > 0) {
            foundEmpty = false;
        return foundEmpty;
    // Function: zeroSuppress
    // Usage: return a string padded to digit(s)
    // Input: num to convert, digit count needed
    // Return: string padded to digit length
    function removeAllInvisible(docRef) {
        removeAllInvisibleArtLayers(docRef);
        removeAllEmptyLayerSets(docRef);
    // Function: exportChildren
    // Usage: find all the children in this document to save
    // Input: duplicate document, original document, export info,
    //        reference to document, starting file name
    // Return: <none>, documents are saved accordingly
    function exportChildren(dupObj, orgObj, exportInfo, dupDocRef, fileNamePrefix) {
        for( var i = 0; i < dupObj.artLayers.length; i++) {
            if (exportInfo.visibleOnly) { // visible layer only
                if (!orgObj.artLayers[i].visible) {
                    continue;
            dupObj.artLayers[i].visible = true;
            var layerName = dupObj.artLayers[i].name;  // store layer name before change doc
            var duppedDocumentTmp = dupDocRef.duplicate();
            if ((png24Index == exportInfo.fileType)||(png8Index == exportInfo.fileType)) { // PSD: Keep transparency
                removeAllInvisible(duppedDocumentTmp);
                //PNGFileOptions
                        if (activeDocument.activeLayer.isBackgroundLayer == false) { //is it anything but a background layer?
                            app.activeDocument.trim(TrimType.TRANSPARENT);
            } else { // just flatten
                duppedDocumentTmp.flatten();
            // Edit
            var docName = app.activeDocument.name;
            // For some reason indexOf fails if we include the '-', so we use 'copy' and decrement the index by 1.
            docName = docName.slice(0, docName.indexOf('copy')-1);
            var fileNameBody = (docName+'_'+layerName).toLowerCase();
            fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|]/g, "_");  // '/\:*?"<>|' -> '_'
            if (fileNameBody.length > 120) {
                fileNameBody = fileNameBody.substring(0,120);
            saveFile(duppedDocumentTmp, fileNameBody, exportInfo);
            duppedDocumentTmp.close(SaveOptions.DONOTSAVECHANGES);
            dupObj.artLayers[i].visible = false;
        for( var i = 0; i < dupObj.layerSets.length; i++) {
            if (exportInfo.visibleOnly) { // visible layer only
                if (!orgObj.layerSets[i].visible) {
                    continue;
            var fileNameBody = fileNamePrefix;
            fileNameBody += "_" + zeroSuppress(i, 4) + "s";
            exportChildren(dupObj.layerSets[i], orgObj.layerSets[i], exportInfo, dupDocRef, fileNameBody);  // recursive call
    // Function: objectToDescriptor
    // Usage: create an ActionDescriptor from a JavaScript Object
    // Input: JavaScript Object (o)
    //        object unique string (s)
    //        Pre process converter (f)
    // Return: ActionDescriptor
    // NOTE: Only boolean, string, number and UnitValue are supported, use a pre processor
    //       to convert (f) other types to one of these forms.
    // REUSE: This routine is used in other scripts. Please update those if you
    //        modify. I am not using include or eval statements as I want these
    //        scripts self contained.
    function objectToDescriptor (o, s, f) {
        o = {};
        var d = new ActionDescriptor;
        var l = o.reflect.properties.length;
        d.putString( app.charIDToTypeID( 'Msge' ), s );
        for (var i = 0; i < l; i++ ) {
            var k = o.reflect.properties[i].toString();
            if (k == "__proto__" || k == "__count__" || k == "__class__" || k == "reflect")
                continue;
            var v = o[ k ];
            k = app.stringIDToTypeID(k);
            switch ( typeof(v) ) {
                case "boolean":
                    d.putBoolean(k, v);
                    break;
                case "string":
                    d.putString(k, v);
                    break;
                case "number":
                    d.putDouble(k, v);
                    break;
                default:
                    if ( v instanceof UnitValue ) {
                        var uc = new Object;
                        uc["px"] = charIDToTypeID("#Rlt"); // unitDistance
                        uc["%"] = charIDToTypeID("#Prc"); // unitPercent
                        d.putUnitDouble(k, uc[v.type], v.value);
                    } else {
                        throw( new Error("Unsupported type in objectToDescriptor " + typeof(v) ) );
        return d;
    // Function: descriptorToObject
    // Usage: update a JavaScript Object from an ActionDescriptor
    // Input: JavaScript Object (o), current object to update (output)
    //        Photoshop ActionDescriptor (d), descriptor to pull new params for object from
    //        object unique string (s)
    //        JavaScript Function (f), post process converter utility to convert
    // Return: Nothing, update is applied to passed in JavaScript Object (o)
    // NOTE: Only boolean, string, number and UnitValue are supported, use a post processor
    //       to convert (f) other types to one of these forms.
    // REUSE: This routine is used in other scripts. Please update those if you
    //        modify. I am not using include or eval statements as I want these
    //        scripts self contained.
    function descriptorToObject (o, d, s, f) {
        var l = d.count;
        if (l) {
            var keyMessage = app.charIDToTypeID( 'Msge' );
            if ( d.hasKey(keyMessage) && ( s != d.getString(keyMessage) )) return;
        for (var i = 0; i < l; i++ ) {
            var k = d.getKey(i); // i + 1 ?
            var t = d.getType(k);
            strk = app.typeIDToStringID(k);
            switch (t) {
                case DescValueType.BOOLEANTYPE:
                    o[strk] = d.getBoolean(k);
                    break;
                case DescValueType.STRINGTYPE:
                    o[strk] = d.getString(k);
                    break;
                case DescValueType.DOUBLETYPE:
                    o[strk] = d.getDouble(k);
                    break;
                case DescValueType.UNITDOUBLE:
                    var uc = new Object;
                    uc[charIDToTypeID("#Rlt")] = "px"; // unitDistance
                    uc[charIDToTypeID("#Prc")] = "%"; // unitPercent
                    uc[charIDToTypeID("#Pxl")] = "px"; // unitPixels
                    var ut = d.getUnitDoubleType(k);
                    var uv = d.getUnitDoubleValue(k);
                    o[strk] = new UnitValue( uv, uc[ut] );
                    break;
                case DescValueType.INTEGERTYPE:
                case DescValueType.ALIASTYPE:
                case DescValueType.CLASSTYPE:
                case DescValueType.ENUMERATEDTYPE:
                case DescValueType.LISTTYPE:
                case DescValueType.OBJECTTYPE:
                case DescValueType.RAWTYPE:
                case DescValueType.REFERENCETYPE:
                default:
                    throw( new Error("Unsupported type in descriptorToObject " + t ) );
        if (undefined != f) {
            o = f(o);
    // Function: preProcessExportInfo
    // Usage: convert Photoshop enums to strings for storage
    // Input: JavaScript Object of my params for this script
    // Return: JavaScript Object with objects converted for storage
    function preProcessExportInfo(o) {
        o.tiffCompression = o.tiffCompression.toString();
        o.pdfEncoding = o.pdfEncoding.toString();
        o.targaDepth = o.targaDepth.toString();
        o.bmpDepth = o.bmpDepth.toString();
        return o;
    // Function: postProcessExportInfo
    // Usage: convert strings from storage to Photoshop enums
    // Input: JavaScript Object of my params in string form
    // Return: JavaScript Object with objects in enum form
    function postProcessExportInfo(o) {
        o.tiffCompression = eval(o.tiffCompression);
        o.pdfEncoding = eval(o.pdfEncoding);
        o.targaDepth = eval(o.targaDepth);
        o.bmpDepth = eval(o.bmpDepth);
        return o;
    // Function: StrToIntWithDefault
    // Usage: convert a string to a number, first stripping all characters
    // Input: string and a default number
    // Return: a number
    function StrToIntWithDefault( s, n ) {
        var onlyNumbers = /[^0-9]/g;
        var t = s.replace( onlyNumbers, "" );
        t = parseInt( t );
        if ( ! isNaN( t ) ) {
            n = t;
        return n;
    // End X2L.jsx

  • How to list the active Alerts used within a tab(report) within a Document

    Hello
    We have a number of tabs/reports within a single webi document. There are a couple of alerts within the webi document but only one is used within a given tab/report.
    Is there an API around that will help me query the alerts that are enabled within each tab/report within a given document instance?
    There is an IReportProcessingInfo class that is around for it looks like its not applicable for Webi documents.
    Regards
    Madhu
    BO XI R2 SP2 on Windows 2003

    Hi Madhu,
    Below is a sample code to traverse through the ReportStructure and get the Alerters from the cells.
    Hope this helps.
    Regards,
    Dan
    Main:
                /************************** RETRIEVING PARAMETERS **************************/
                // Retrieve the logon information
                String username = "username";
                String password = "password";
                String cmsName  = "cms name";
                String authType = "secEnterprise"; 
                // Retrieve the name of the Web Intelligence document to be used in the sample
                String webiDocName = "WebI Alerter Test";
                /************************** LOGON TO THE ENTERPRISE **************************/
                // Logon to the enterprise
                IEnterpriseSession boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsName, authType);
                /************************** RETRIEVE INFOOBJECT FOR THE WEBI DOCUMENT **************************/
                // Retrieve the IInfoStore object
                IInfoStore boInfoStore =(IInfoStore) boEnterpriseSession.getService("InfoStore"); 
                session.setAttribute("SAMPLE.InfoStore", boInfoStore); 
                // Build query to retrieve the universe InfoObjects
                String sQuery = "SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='" + CeKind.WEBI + "' AND SI_NAME='" + webiDocName + "'";
                // Execute the query
                IInfoObjects boInfoObjects = (IInfoObjects) boInfoStore.query(sQuery);
                // Retrieve the InfoObject for the Web Intelligence document
                IInfoObject boInfoObject = (IInfoObject) boInfoObjects.get(0);
                /************************** RETRIEVE DOCUMENT INSTANCE FOR THE WEBI DOCUMENT **************************/
                // Retrieve the Report Engines
                ReportEngines boReportEngines = (ReportEngines) boEnterpriseSession.getService("ReportEngines");;
                // Retrieve the Report Engine for Web Intelligence documents
                ReportEngine boReportEngine = boReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
                // Retrieve the document instance for the Web Intelligence document
                DocumentInstance boDocumentInstance = boReportEngine.openDocument(boInfoObject.getID());
                ReportStructure boReportStructure = boDocumentInstance.getStructure();
                out.print(traverseReportStructure(boReportStructure));
                out.print("&lt;HR>Process Complete!&lt;HR>");
                boDocumentInstance.closeDocument();
                boReportEngine.close();
                boEnterpriseSession.logoff();
    Functions:
    String traverseReportStructure(ReportStructure boReportStructure) {
                String output = "";
                for (int i=0; i&lt;boReportStructure.getReportElementCount(); i++) {
                            output += traverseReportElement(boReportStructure.getReportElement(i), 0);
                return output;
    String traverseReportElement(ReportElement boReportElement, int level) {
                String output = "";
                String padding = getPadding(level);
                if (boReportElement instanceof ReportContainer) {
                            output += padding + "Report Name: " + ((ReportContainer) boReportElement).getName() + "&lt;BR>";
                } else if (boReportElement instanceof PageHeaderFooter) {
                            if (((PageHeaderFooter) boReportElement).isHeader()) {
                                        output += padding + "Report Header&lt;BR>";
                            } else {
                                        output += padding + "Report Footer&lt;BR>";
                } else if (boReportElement instanceof ReportBody) {
                            output += padding + "Report Body&lt;BR>";
                } else if (boReportElement instanceof Cell) {
                            output += padding;
                            output += "Cell ID: " + ((Cell) boReportElement).getID() + " - ";
                            output += getAlerters(((Cell) boReportElement).getAlerters(), level+1);
                } else if (boReportElement instanceof ReportBlock) {
                            output += padding + "Block Name: " + ((ReportBlock) boReportElement).getName() + "&lt;BR>";
                            output += traverseReportBlock((ReportBlock) boReportElement, level+1);
                } else {
                            output += padding + boReportElement.getClass().getName() + "&lt;BR>";
                for (int i=0; i&lt;boReportElement.getReportElementCount(); i++) {
                            output += traverseReportElement(boReportElement.getReportElement(i), level+1);
                return output;
    String traverseReportBlock(ReportBlock boReportBlock, int level) {
                String output = "";
                String padding = getPadding(level);
                Representation boRepresentation = boReportBlock.getRepresentation();
                output += padding + "Block type is [" + boRepresentation.getClass().getName() + "].&lt;BR>";
                if (boRepresentation instanceof SimpleTable) {
                            SimpleTable boSimpleTable = (SimpleTable) boRepresentation;
                            output += padding + "Processing SimpleTable...&lt;BR>";
                            output += padding + "Block Header&lt;BR>" + traverseCellMatrix(boSimpleTable.getHeader(null), level+1);
                            output += padding + "Block Body&lt;BR>" + traverseCellMatrix(boSimpleTable.getBody(), level+1);
                            output += padding + "Block Footer&lt;BR>" + traverseCellMatrix(boSimpleTable.getFooter(null), level+1);
                } else {
                            output += padding + "Unhandled Block Type...&lt;BR>";
                return output;
    String traverseCellMatrix(CellMatrix boCellMatrix, int level) {
                String output = "";
                String padding = getPadding(level);
                if (boCellMatrix.getRowCount()>0) {
                            TableCell boTableCell = null;
                            for (int i=0; i&lt;boCellMatrix.getColumnCount(); i++) {
                                        boTableCell = (TableCell) boCellMatrix.getCell(0, i);
                                        output += padding + "Column: " + i + " - " + boTableCell.getText() + " - ";
                                        output += getAlerters(boTableCell.getAlerters(), level+1);
                } else {
                            output += padding + "No Cells.&lt;BR>";
                return output;
    String getAlerters(Alerters boAlerters, int level) {
                String output = "";
                String padding = getPadding(level);
                if (boAlerters.getCount()&lt;=0) {
                            output += "No alerters.&lt;BR>";
                } else {
                            output += "Alerters found!&lt;BR>";
                            Alerter boAlerter = null;
                            for (int i=0; i&lt;boAlerters.getCount(); i++) {
                                        boAlerter = boAlerters.getAlerter(i);
                                        output += padding + "&lt;B>" + boAlerter.getName() + "&lt;/B>&lt;BR>";
                return output;
    String getPadding(int level) {
                String output = "";
                for (int i=0; i&lt;level; i++) {
                            output += "     ";
                return output;
    Edited by: Dan Cuevas on May 25, 2009 9:45 PM

  • Mapping problem in idoc

    Hi
      I had a source segment E1EDP20 (0---99 occurences), i need to pass a constant value to target field poitem.
      the requirement is
    on every occurence of  E1EDP20, the constant value should be incremented by 1 and that constant should be passed to target field poitem.
    Ex- on first occurence of E1EDP20 the constant value should be 1.
          on second occurence of E1EDP20 the constant value should be 2.
         on third occurence of E1EDP20 the constant value should be 3.
    like this as long as on  E1EDP20 occurs the constant value should be incremented by 1.
    the constant should be passed to targetfield poitem.
    pls suggest what is the logic should i write for the above requirement.
    regards
    raghu

    If your requirement is to make the string length to 4 padding with 0's before, then try the below udf.
    public static String Pad(String input, String padChar, int iLength, String sPadDir) {
              StringBuffer strBuf = new StringBuffer(input);
              String sTemp = "";
              int iInputLen = input.length();
              if (iInputLen >= iLength)
                   return input;
              if (sPadDir.length() != 0) {
                   if (sPadDir.equalsIgnoreCase("right")) {
                        for (int j = 0; j < iLength - iInputLen; j++) {
                             sTemp = strBuf.append(padChar).toString();
                   } else if (sPadDir.equalsIgnoreCase("left")) {
                        for (int h = 0; h < iLength - iInputLen; h++) {
                             sTemp = strBuf.insert(h, padChar).toString();
                   } else {
                        sTemp = "Pad Direction Incorrect";
              } else {
                   sTemp = "Pad Direction Does not exist";
              return sTemp;
    constant value->UDF->Target
    If you use the above UDF, you would get the output as 0xxx if your input is xxx,00xx for xx input,000x for x input.
    Regards,
    Swetha.

  • Line up text in a JTextArea

    I'm trying to format line up text in columns in a JTextArea. Here is an example of what I'm trying to do.
    SubTotal $5.00
    Tax $8.00
    Total $13.00
    I've tried formating the text so that the first work will be a certain length but it still will not line up correctly in the text area because different letters take up different amounts of space. Thanks

    change the font of the textarea to monospaced, then append the data
    something like in this println
    class Testing
      public Testing()
        String pad = "                   ";
        String[][] lines = {{"SubTotal", "$5.00"},{"Tax", "$8.00"},{"Total", "$13.00"}};
        for(int x = 0; x < lines.length; x++)
          System.out.println(lines[x][0]+(pad+lines[x][1]).substring(lines[x][0].length()+lines[x][1].length()));
      public static void main(String[] args){new Testing();}
    }

  • Need help with formatting a number

    hi all,
    the problem i am having has been a hot topic over time in java. i have an integer say 123. i want to convert this to a string of 10 characters. how do i pad the first seven spaces with blanks. ex. " 123" in c++ you can use sprintf. how do i do this in java. i have seen mention of NumberFormat but being new to java cannot figure this class out. any helpful code would be much appreciated.
    thanks

    That would certainly works but it is not the most efficent method to achive the goal since it discards String objects left right and center (especially if you want more than 10 padding spaces)
    public String pad(Integer i) {
    String value = i.toString();
    StringBuffer buff = new StringBuffer();
    for( int i = 0, n = ( 10 - value.length ); i < n; i++ ) {
    buff.append( " " );
    return buff.toString() + value;
    }

  • Unique file name for saving file on server.

    Hi
    I am having a servlet which will be used to save a file from client machine to server.
    Now, this servlet can be used with multiple users through web at same time.
    All user will be uploading files.
    There will be cases where 2 users from different location will upload files with same name.
    Thus, it is important for me that I append some string in uploaded file name, so that file name stands unique.
    How can I get this unique number.
    Is there no instance number for generated class !!.
    Thanks

    A few years ago I found this code on the Internet. I have forgotten where, but I'ven been using it since then and until now it always generate the unique number.
          * Generates unique ID based on timestamp, thread ID, random seed and random
          * double. Each part is converted to hexadecimal, padded left with zeros to
          * a length of 8 chars and then concatentated to each other.
          * @return Unique 32-char hexadecimal string.
         public static synchronized String getUniqueID() {
              final String pad = "0";
              final int padLength = 8;
              final int padDirection = StringX.PAD_LEFT;
              String timestamp = Integer.toHexString(Long.valueOf(System
                        .currentTimeMillis()).intValue());
              String threadHashCode = Integer.toHexString(Thread.currentThread()
                        .hashCode());
              String randomInt = Integer.toHexString(RANDOM.nextInt());
              String mathRandom = Integer.toHexString(new Double(Math.random()
                        * Integer.MAX_VALUE).intValue());
              // You may remove this try block if you want to increase performance by
              // 1ms.
              // But the generated ID might not be fully 100% guaranteed to be unique.
              // If you want to keep this block, then you can "almost" safely remove
              // the
              // randomInt and mathRandom parts of the UniqueID.
              try {
                   Thread.currentThread().join(1); // System.currentTimeMillis()++
              } catch (InterruptedException e) {
                   // Do nothing. However very, very, very rare. Haven't seen it
                   // earlier.
              return StringX.pad(timestamp, pad, padLength, padDirection)
                        + StringX.pad(threadHashCode, pad, padLength, padDirection)
                        + StringX.pad(randomInt, pad, padLength, padDirection)
                        + StringX.pad(mathRandom, pad, padLength, padDirection);
         }

Maybe you are looking for

  • Shared Reviews on SharePoint 2010 Won't Open on 11.0.09

    Does anyone else run shared reviews on SharePoint 2010?  Since the 11.0.09 update shared reviews will not open in IE 10 or 11 causing a fault in it's Data Execution Prevention.  Our marketing team is up in arms at this point as our help desk has to c

  • My internet speed keeps to be occupied when streaming video and closing the broswer!!

    My internet speed is fully occupied when streaming a video and going to different points in it (walking through it) then close the tab the speed still occupied even if I close the broswer !!!! (also tried on firefox and chrome), Iam running fresh ins

  • How to Import AVCHD 1080/60p Files into Final Cut Pro 7?

    How do I import AVCHD 1080 / 60p Files into Final Cut Pro 7? And if there is no direct way [I certainly haven't found one, but I'm no expert], what additional software would be used? I want to import the files from a Panasonic HDC-HS700 onto an Intel

  • Ipod will not charge up

    ipod touch will not charge up .. . . have tried other chargers, and rebooting it - still wont work it is 1 year and 1 month old any suggestions to getting it working again? is it worth taking it into Apple? can they change the battery? how much would

  • How to append an xml string as a child node to a dom document

    Hi I have an xml represented as a String. Now I want to add this xml string as a child node to another DOM Document. Do I have to first parse the xml String into a xml Document and then add the nodes to the existing Document. Is there a simpler way t