/** anylyze describeLayout result */ public void analyzeDetailLayoutSection(Object result, String sobject, LayoutHolder sf) { Log.v(TAG, "\nAnalyzing " + sobject + " Detail Layout..."); // SObjectFactory sf = new SObjectFactory(); // sf.sections = new ArrayList<SectionHolder>(); String res = result.toString(); if (-1 == res.indexOf("detailLayoutSections")) { Log.v(TAG, "No Detail List...#:" + res.indexOf("detailLayoutSections")); return; } // String fn = "layouts=anyType"; String fn = "detailLayoutSections=anyType"; int start = res.indexOf(fn); String kpn = "editLayoutSections=anyType"; int end = res.indexOf(kpn); String f = res.substring(start + fn.length() + 1, end); // Log.v(TAG, "orignal :" + f ); /** analyze start form 'detailLayoutSections' */ String[] dls = f.split("detailLayoutSections=anyType\\{"); // System.out.println("0 : " + dls[0]); // System.out.println("1 : " + dls[1]); int index = 0, e1 = 0; for (String s : dls) { SectionHolder sh = new SectionHolder(); sh.fields = new ArrayList<FieldHolder>(); getHeading(s, sh); sh.sectionOrder = index; // if(!sh.name.equals("Address Information"))getLayoutItems(s, sh); // else getLayoutItems(s, sh); getLayoutItems(s, sh); index++; sf.detail.add(sh); /* s1 = fs[i].indexOf( "calculated=" ); e1 = fs[i].indexOf( ";", s1 ); System.out.print(":calculated=" + fs[i].substring(s1 + "calculated=".length(), e1)); */ } HashMap<String, LayoutHolder> te = new HashMap<String, LayoutHolder>(); te.put(sobject, sf); SObjectDB.SOBJECTS.put(sobject, sf); }
/** get Section Header of layout */ private void getHeading(String s, SectionHolder sh) { int s1 = s.indexOf("heading="); int e1 = s.indexOf(";", s1); String ret = s.substring(s1 + "heading=".length(), e1); Log.v(TAG, ret); sh.name = ret; }
/** get Related Section Header of layout */ private void getRelatedLabel(String s, SectionHolder sh) { int s1 = s.indexOf("field="); int e1 = s.indexOf(".", s1); String ret = s.substring(s1 + "field=".length(), e1); // Log.v(TAG, ret); sh.name = ret; }