while (input.hasNext()) { // Read each line from the scanner String input = input.next(); // Split data on two delimiters '-' and ':' String[] data = input.split("-|:"); int listNumber = Integer.parseInt(data[0]); String listData1 = data[1]; String listData2 = data[2]; // Add to the datalist datalist.add(new ListData(listNumber, listData1, listData2)); }
/** * * @param numbered true if the list should be numbered; false if it should be * bulleted. * @param styleSheet The document's stylesheet. */ public HWPFList(boolean numbered, StyleSheet styleSheet) { _listData = new ListData((int)(Math.random() * System.currentTimeMillis()), numbered); _override = new ListFormatOverride(_listData.getLsid()); _styleSheet = styleSheet; }
ListData listItem = new ListData(); listItem.setItem(itemValue); } else if(detailType.matches("title")){ listItem.setTitle(detailValue); } else if(detailType.matches("subhead")){ listItem.setSubhead(detailValue); listItem.setThumb(tImg); } else if(detailType.matches("photo")){ ImageManager im = new ImageManager(); Bitmap pImg = im.getImage(detailValue); listItem.setPhoto(pImg); } else if(detailType.matches("localAddress")){ listItem.setLocalAddress(detailValue); } else if(detailType.matches("phone")){ listItem.setPhone(detailValue); } else if(detailType.matches("webUrl")){ URL webUrl1 = new URL(detailValue); listItem.setWebURL(webUrl1); } else if(detailType.matches("facebook")){ listItem.setFacebook(detailValue); } else if(detailType.matches("twitter")){ listItem.setTwitter(detailValue); } else if(detailType.matches("latitude")){ float itemLat = Float.parseFloat(detailValue); listItem.setLatitude(itemLat); } else if(detailType.matches("longitude")){ float itemLon = Float.parseFloat(detailValue);
public ListTables( byte[] tableStream, final int lstOffset, final int fcPlfLfo, final int lcbPlfLfo ) { /* * The PlfLst structure contains the list formatting information for the * document. -- Page 425 of 621. [MS-DOC] -- v20110315 Word (.doc) * Binary File Format */ int offset = lstOffset; int cLst = LittleEndian.getShort( tableStream, offset ); offset += LittleEndian.SHORT_SIZE; int levelOffset = offset + ( cLst * LSTF.getSize() ); for ( int x = 0; x < cLst; x++ ) { ListData lst = new ListData( tableStream, offset ); _listMap.put( Integer.valueOf( lst.getLsid() ), lst ); offset += LSTF.getSize(); int num = lst.numLevels(); for ( int y = 0; y < num; y++ ) { ListLevel lvl = new ListLevel(); levelOffset += lvl.read( tableStream, levelOffset ); lst.setLevel( y, lvl ); } } this._plfLfo = new PlfLfo( tableStream, fcPlfLfo, lcbPlfLfo ); }
/** * Sets the paragraph properties for a particular level of the list. * * @param level The level number. * @param pap The paragraph properties */ public void setLevelParagraphProperties(int level, ParagraphProperties pap) { ListLevel listLevel = _listData.getLevel(level); int styleIndex = _listData.getLevelStyle(level); ParagraphProperties base = _styleSheet.getParagraphStyle(styleIndex); byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(pap, base); listLevel.setLevelProperties(grpprl); }
public void writeListDataTo( FileInformationBlock fib, ByteArrayOutputStream tableStream ) throws IOException { final int startOffset = tableStream.size(); fib.setFcPlfLst( startOffset ); int listSize = _listMap.size(); // use this stream as a buffer for the levels since their size varies. ByteArrayOutputStream levelBuf = new ByteArrayOutputStream(); byte[] shortHolder = new byte[2]; LittleEndian.putShort(shortHolder, 0, (short)listSize); tableStream.write(shortHolder); for(ListData lst : _listMap.values()) { tableStream.write(lst.toByteArray()); ListLevel[] lvls = lst.getLevels(); for (int y = 0; y < lvls.length; y++) { levelBuf.write(lvls[y].toByteArray()); } } /* * An array of LVLs is appended to the PlfLst. lcbPlfLst does not * account for the array of LVLs. -- Page 76 of 621 -- [MS-DOC] -- * v20110315 Word (.doc) Binary File Format */ fib.setLcbPlfLst( tableStream.size() - startOffset ); tableStream.write( levelBuf.toByteArray() ); }
for (int i = 0; i < title.length; i++) { ListData ld = new ListData(); ld.setTitle(title[i]); ld.setDescription(desc[i]); ld.setImgResId(img[i]);
public void showCustomList() { mAllLists = new ArrayList<>(); mAllLists = mListTableHelper.getAllList(); final ListData taskList = new ListData(); taskList.setId(100000000); taskList.setTitle("Default List"); mAllLists.add(0, taskList); AlertDialog.Builder builder = new AlertDialog.Builder(AddTaskActivity.this); LayoutInflater inflater = getLayoutInflater(); View convertView = (View) inflater.inflate(R.layout.tablelist, null, false); ListView lv = (ListView) convertView.findViewById(R.id.tableslist); final ListItemAdapter adapter = new ListItemAdapter(AddTaskActivity.this,mAllLists,selectedItem); builder.setAdapter(adapter, null); alertDialog = builder.create(); alertDialog.show(); }
public int addList(ListData lst, ListFormatOverride override) { int lsid = lst.getLsid(); while (_listMap.get(Integer.valueOf(lsid)) != null) { lsid = lst.resetListID(); override.setLsid(lsid); } _listMap.put(Integer.valueOf(lsid), lst); _overrideList.add(override); return lsid; }
public void setLevelStyle( int level, int styleIndex ) { _listData.setLevelStyle( level, styleIndex ); } }
/** * Sets the character properties of the list numbers. * * @param level the level number that the properties should apply to. * @param chp The character properties. */ public void setLevelNumberProperties(int level, CharacterProperties chp) { ListLevel listLevel = _listData.getLevel(level); int styleIndex = _listData.getLevelStyle(level); CharacterProperties base = _styleSheet.getCharacterStyle(styleIndex); byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(chp, base); listLevel.setNumberProperties(grpprl); }
public void writeListDataTo( FileInformationBlock fib, HWPFOutputStream tableStream ) throws IOException { final int startOffset = tableStream.getOffset(); fib.setFcPlcfLst( startOffset ); int listSize = _listMap.size(); // use this stream as a buffer for the levels since their size varies. ByteArrayOutputStream levelBuf = new ByteArrayOutputStream(); byte[] shortHolder = new byte[2]; LittleEndian.putShort(shortHolder, (short)listSize); tableStream.write(shortHolder); for(Integer x : _listMap.sortedKeys()) { ListData lst = _listMap.get(x); tableStream.write(lst.toByteArray()); ListLevel[] lvls = lst.getLevels(); for (int y = 0; y < lvls.length; y++) { levelBuf.write(lvls[y].toByteArray()); } } /* * An array of LVLs is appended to the PlfLst. lcbPlfLst does not * account for the array of LVLs. -- Page 76 of 621 -- [MS-DOC] -- * v20110315 Word (.doc) Binary File Format */ fib.setLcbPlcfLst( tableStream.getOffset() - startOffset ); tableStream.write( levelBuf.toByteArray() ); }
/** * * @param numbered * true if the list should be numbered; false if it should be * bulleted. * @param styleSheet * The document's stylesheet. */ public HWPFList( boolean numbered, StyleSheet styleSheet ) { _listData = new ListData( (int) ( Math.random() * System.currentTimeMillis() ), numbered ); _lfo = new LFO(); _lfo.setLsid( _listData.getLsid() ); _lfoData = new LFOData(); _styleSheet = styleSheet; }
public int addList( ListData lst, LFO lfo, LFOData lfoData ) { int lsid = lst.getLsid(); while ( _listMap.get( Integer.valueOf( lsid ) ) != null ) { lsid = lst.resetListID(); lfo.setLsid( lsid ); } _listMap.put( Integer.valueOf( lsid ), lst ); if ( lfo == null && lfoData != null ) { throw new IllegalArgumentException( "LFO and LFOData should be specified both or noone" ); } if ( lfo != null ) { _plfLfo.add( lfo, lfoData ); } return lsid; } }