Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Ta só o método que cria aquela tabela com os ícones.
- Na classe 'FormatterUtil' você insere o link para as imagens YES, NO e NONE (quando não tiver o scan).
- ;*
- */
- package system.format;
- import java.util.ArrayList;
- import java.util.Vector;
- import system.exception.FormatException;
- import system.format.external.FormatterUtil;
- /**
- * @author RENAN - @rnxn
- */
- // App heart :p
- public class Format extends FormatterUtil {
- private StringBuilder build, aux;
- public synchronized String setTable(Vector<Integer> to32Bits, Vector<Integer> to64Bits ){
- String table = null;
- StringBuilder tableHeader = new StringBuilder();
- tableHeader.append("[TABLE=\"class: ")
- .append(TABLE_BORDER_OUT_CLASS)
- .append(", width: ")
- .append(TABLE_SIZE)
- .append(", align: ")
- .append(TABLE_ALIGN).append("\"]");
- table = tableHeader.toString();
- //cria a primeira linha da tabela (que é diferente das demais)
- aux = new StringBuilder();
- aux.append(putBBCode(BBCODE_IN, TABLE_LINE));
- for(String s : TABLE_HEAD) {
- aux.append(putQuotedBBCode(BBCODE_IN, TABLE_COLUMN, "align: " + TABLE_ROW_ALIGN))
- .append(putBBCodeWithValue(BBCODE_IN, SIZE, Integer.toString(3)))
- .append(putBBCode(BBCODE_IN, BOLD))
- .append(s) /* header */
- .append(putBBCode(BBCODE_OUT, BOLD))
- .append(putBBCode(BBCODE_OUT, SIZE))
- .append(putBBCode(BBCODE_OUT, TABLE_COLUMN));
- }
- aux.append(putBBCode(BBCODE_OUT, TABLE_LINE));
- //fim da primeira linha.
- table += aux.toString();
- StringBuilder tableContent = new StringBuilder();
- // cria o restante da tabela.
- for( int i = 0; i < SO_LIST.length; i++ ){
- tableContent.append(putBBCode(BBCODE_IN, TABLE_LINE))
- .append(putBBCodeWithValue(BBCODE_IN, TABLE_COLUMN, "align: " + TABLE_ROW_ALIGN))
- .append(SO_LIST[i] )
- .append(putBBCode(BBCODE_OUT, TABLE_COLUMN))
- .append(putBBCodeWithValue(BBCODE_IN, TABLE_COLUMN, "align: " + TABLE_ROW_ALIGN))
- .append(changeNumberForIcon(to32Bits.get(i))) // troca o número pelo ícone.
- .append(putBBCode(BBCODE_OUT, TABLE_COLUMN))
- .append(putBBCodeWithValue(BBCODE_IN, TABLE_COLUMN, "align: " + TABLE_ROW_ALIGN))
- .append(changeNumberForIcon(to64Bits.get(i))) // troca o número pelo ícone.
- .append(putBBCode(BBCODE_OUT, TABLE_COLUMN))
- .append(putBBCode(BBCODE_OUT, TABLE_LINE));
- //System.out.println(to32Bits.get(i));
- //System.out.println(to64Bits.get(i));
- }
- table += tableContent.toString();
- table += putBBCode(BBCODE_OUT, TABLE);
- aux.append(putBBCode(BBCODE_OUT, TABLE));
- return table;
- }
- private String changeNumberForIcon( int num ){
- String icon = null;
- switch( num ){
- case -1 : icon = ICON_NO; break;
- case 0 : icon = ICON_NONE; break;
- case 1 : icon = ICON_YES; break;
- }
- try {
- return setImage(icon);
- } catch(FormatException e) {
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement