Package javolution.text

Examples of javolution.text.TextBuilder


  {
    //
    Post p = getGPosttByTopic(topic);
    Locale locale = Locale.getDefault();
    DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
        TextBuilder html = new TextBuilder("<html><body><br><br>");
    html.append("<table border=0 width=610><tr><td width=10></td><td width=600 align=left>");
    html.append("<a action=\"bypass _bbshome\">HOME</a>&nbsp;>&nbsp;<a action=\"bypass _bbsmemo\">Memo Form</a>");
    html.append("</td></tr>");
    html.append("</table>");
    html.append("<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\">");
    html.append("<center>");
    html.append("<table border=0 cellspacing=0 cellpadding=0 bgcolor=333333>");
    html.append("<tr><td height=10></td></tr>");
    html.append("<tr>");
    html.append("<td fixWIDTH=55 align=right valign=top>&$413; : &nbsp;</td>");
    html.append("<td fixWIDTH=380 valign=top>"+topic.getName()+"</td>");
    html.append("<td fixwidth=5></td>");
    html.append("<td fixwidth=50></td>");
    html.append("<td fixWIDTH=120></td>");
    html.append("</tr>");
    html.append("<tr><td height=10></td></tr>");
    html.append("<tr>");
    html.append("<td align=right><font color=\"AAAAAA\" >&$417; : &nbsp;</font></td>");
    html.append("<td><font color=\"AAAAAA\">"+topic.getOwnerName()+"</font></td>");
    html.append("<td></td>");
    html.append("<td><font color=\"AAAAAA\">&$418; :</font></td>");
    html.append("<td><font color=\"AAAAAA\">"+dateFormat.format(p.getCPost(0).postDate)+"</font></td>");
    html.append("</tr>");
    html.append("<tr><td height=10></td></tr>");
    html.append("</table>");
    html.append("<br>");
    html.append("<table border=0 cellspacing=0 cellpadding=0>");
    html.append("<tr>");
    html.append("<td fixwidth=5></td>");
    String Mes = p.getCPost(0).postTxt.replace(">","&gt;");
    Mes = Mes.replace("<","&lt;");
    Mes = Mes.replace("\n","<br1>");
    html.append("<td FIXWIDTH=600 align=left>"+ Mes +"</td>");
    html.append("<td fixqqwidth=5></td>");
    html.append("</tr>");
    html.append("</table>");
    html.append("<br>");
    html.append("<img src=\"L2UI.squareblank\" width=\"1\" height=\"5\">");
    html.append("<img src=\"L2UI.squaregray\" width=\"610\" height=\"1\">");
    html.append("<img src=\"L2UI.squareblank\" width=\"1\" height=\"5\">");
    html.append("<table border=0 cellspacing=0 cellpadding=0 FIXWIDTH=610>");
    html.append("<tr>");
    html.append("<td width=50>");
    html.append("<button value=\"&$422;\" action=\"bypass _bbsmemo\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\">");
    html.append("</td>");
    html.append("<td width=560 align=right><table border=0 cellspacing=0><tr>");
    html.append("<td FIXWIDTH=300></td><td><button value = \"&$424;\" action=\"bypass _bbsposts;edit;"+ forum.getID() +";"+ topic.getID() +";0\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td>&nbsp;");
    html.append("<td><button value = \"&$425;\" action=\"bypass _bbstopics;del;"+forum.getID()+";"+ topic.getID() +"\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td>&nbsp;");
    html.append("<td><button value = \"&$421;\" action=\"bypass _bbstopics;crea;"+forum.getID()+"\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td>&nbsp;");
    html.append("</tr></table>");
    html.append("</td>");
    html.append("</tr>");
    html.append("</table>");
    html.append("<br>");
    html.append("<br>");
    html.append("<br></center>");
    html.append("</body>");
    html.append("</html>");
    separateAndSend(html.toString(),activeChar);
  }
View Full Code Here


    if (index < 1)
    {
      index = 1;
    }
    //header
        TextBuilder html = new TextBuilder("<html><body><br><br><center>");
    html.append("<br1><br1><table border=0 cellspacing=0 cellpadding=0>");
    html.append("<tr><td FIXWIDTH=15>&nbsp;</td>");
    html.append("<td width=610 height=30 align=left>");
    html.append("<a action=\"bypass _bbsclan_clanlist\"> CLAN COMMUNITY </a>");
    html.append("</td></tr></table>");
    html.append("<table border=0 cellspacing=0 cellpadding=0 width=610 bgcolor=434343>");
    html.append("<tr><td height=10></td></tr>");
    html.append("<tr>");
    html.append("<td fixWIDTH=5></td>");
    html.append("<td fixWIDTH=600>");
    html.append("<a action=\"bypass _bbsclan_clanhome;"
      + ((activeChar.getClan() != null) ? activeChar.getClan().getClanId() : 0)
      + "\">[GO TO MY CLAN]</a>&nbsp;&nbsp;");
    html.append("</td>");
    html.append("<td fixWIDTH=5></td>");
    html.append("</tr>");
    html.append("<tr><td height=10></td></tr>");
    html.append("</table>");
    //body
    html.append("<br>");
    html.append("<table border=0 cellspacing=0 cellpadding=2 bgcolor=5A5A5A width=610>");
    html.append("<tr>");
    html.append("<td FIXWIDTH=5></td>");
    html.append("<td FIXWIDTH=200 align=center>CLAN NAME</td>");
    html.append("<td FIXWIDTH=200 align=center>CLAN LEADER</td>");
    html.append("<td FIXWIDTH=100 align=center>CLAN LEVEL</td>");
    html.append("<td FIXWIDTH=100 align=center>CLAN MEMBERS</td>");
    html.append("<td FIXWIDTH=5></td>");
    html.append("</tr>");
    html.append("</table>");
    html.append("<img src=\"L2UI.Squareblank\" width=\"1\" height=\"5\">");
    int i = 0;
    for (L2Clan cl : ClanTable.getInstance().getClans())
    {
      if(i > (index + 1)*7)
      {
        break;
      }
      if(i >= (index - 1)*7)
      {
      html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\">");
      html.append("<table border=0 cellspacing=0 cellpadding=0 width=610>");
      html.append("<tr> ");
      html.append("<td FIXWIDTH=5></td>");
      html.append("<td FIXWIDTH=200 align=center><a action=\"bypass _bbsclan_clanhome;"
        + cl.getClanId() + "\">" + cl.getName() + "</a></td>");
      html.append("<td FIXWIDTH=200 align=center>" + cl.getLeaderName() + "</td>");
      html.append("<td FIXWIDTH=100 align=center>" + cl.getLevel() + "</td>");
      html.append("<td FIXWIDTH=100 align=center>" + cl.getMembersCount() + "</td>");
      html.append("<td FIXWIDTH=5></td>");
      html.append("</tr>");
      html.append("<tr><td height=5></td></tr>");
      html.append("</table>");
      html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\">");
      html.append("<img src=\"L2UI.SquareGray\" width=\"610\" height=\"1\">");
      }
      i++;
    }
    html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"2\">");
    html.append("<table cellpadding=0 cellspacing=2 border=0><tr>");
    if (index == 1)
    {
      html.append("<td><button action=\"\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");
    }
    else
    {
      html.append("<td><button action=\"_bbsclan_clanlist;" + (index - 1)
        + "\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");
    }
    i = 0;
    int nbp;
    nbp = ClanTable.getInstance().getClans().length / 8;
    if (nbp * 8 != ClanTable.getInstance().getClans().length)
    {
      nbp++;
    }
    for (i = 1; i <= nbp; i++)
    {
      if (i == index)
      {
        html.append("<td> " + i + " </td>");
      }
      else
      {
        html.append("<td><a action=\"bypass _bbsclan_clanlist;" + i + "\"> " + i + " </a></td>");
      }

    }
    if (index == nbp)
    {
      html.append("<td><button action=\"\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>");
    }
    else
    {
      html.append("<td><button action=\"bypass _bbsclan_clanlist;" + (index + 1)
        + "\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>");
    }
    html.append("</tr></table>");
    html.append("<table border=0 cellspacing=0 cellpadding=0>");
    html.append("<tr><td width=610><img src=\"sek.cbui141\" width=\"610\" height=\"1\"></td></tr>");
    html.append("</table>");
    html.append("<table border=0><tr><td><combobox width=65 var=keyword list=\"Name;Ruler\"></td><td><edit var = \"Search\" width=130 height=11 length=\"16\"></td>");
    //TODO: search (Write in BBS)
    html.append("<td><button value=\"&$420;\" action=\"Write 5 -1 0 Search keyword keyword\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"> </td> </tr></table>");
    html.append("<br>");
    html.append("<br>");
    html.append("</center>");
    html.append("</body>");
    html.append("</html>");
    separateAndSend(html.toString(), activeChar);
  }
View Full Code Here

  @Override
  public String format(LogRecord record)
  {
    Object[] params = record.getParameters();
        TextBuilder output = new TextBuilder();
    output.append('[');
    output.append(dateFmt.format(new Date(record.getMillis())));
    output.append(']');
    output.append(' ');
    if (params != null) {
      for (Object p : params) {
        output.append(p);
        output.append(' ');
      }
    }
    output.append(record.getMessage());
    output.append(CRLF);

    return output.toString();
  }
View Full Code Here

  private SimpleDateFormat dateFmt = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS");

  @Override
  public String format(LogRecord record)
  {
        TextBuilder output = new TextBuilder();

    return output
    .append(dateFmt.format(new Date(record.getMillis())))
    .append(_)
    .append(record.getLevel().getName())
    .append(_)
    .append(record.getThreadID())
View Full Code Here

//  private static final String _ = " ";
  private static final String CRLF = "\r\n";
  @Override
  public String format(LogRecord record)
  {
        TextBuilder output = new TextBuilder();
//    output.append(record.getLevel().getName());
//    output.append(_);
//    output.append(record.getLoggerName());
//    output.append(_);
    output.append(record.getMessage());
    output.append(CRLF);
    if (record.getThrown() != null) {
        try {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            record.getThrown().printStackTrace(pw);
            pw.close();
        output.append(sw.toString());
        output.append(CRLF);
        } catch (Exception ex) {
        }
    }

    return output.toString();
  }
View Full Code Here

  private SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");

  @Override
  public String format(LogRecord record)
  {
        TextBuilder output = new TextBuilder();
    output.append('[');
    output.append(dateFmt.format(new Date(record.getMillis())));
    output.append(']');
    output.append(' ');
    output.append(record.getMessage());
    for (Object p : record.getParameters())
    {
      if (p == null) continue;
      output.append(',');
      output.append(' ');
      if (p instanceof L2ItemInstance)
      {
        L2ItemInstance item = (L2ItemInstance)p;
        output.append("item " + item.getObjectId() + ":");
        if (item.getEnchantLevel() > 0) output.append("+" + item.getEnchantLevel() + " ");
        output.append(item.getItem().getName());
        output.append("(" + item.getCount() + ")");
      }
//      else if (p instanceof L2PcInstance)
//        output.append(((L2PcInstance)p).getName());
      else output.append(p.toString()/* + ":" + ((L2Object)p).getObjectId()*/);
    }
    output.append(CRLF);

    return output.toString();
  }
View Full Code Here

  private SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");

  @Override
  public String format(LogRecord record)
  {
        TextBuilder output = new TextBuilder();
    output.append('[');
    output.append(dateFmt.format(new Date(record.getMillis())));
    output.append(']');
    output.append(' ');
    output.append(record.getMessage());
    for (Object p : record.getParameters())
    {
      if (p == null) continue;
      output.append(',');
      output.append(' ');
      output.append(p.toString());
    }
    output.append(CRLF);

    return output.toString();
  }
View Full Code Here

   * @param forum
   * @param activeChar
   */
  private void showMemoNewTopics(Forum forum, L2PcInstance activeChar)
  {
        TextBuilder html = new TextBuilder("<html>");
    html.append("<body><br><br>");
    html.append("<table border=0 width=610><tr><td width=10></td><td width=600 align=left>");
    html.append("<a action=\"bypass _bbshome\">HOME</a>&nbsp;>&nbsp;<a action=\"bypass _bbsmemo\">Memo Form</a>");
    html.append("</td></tr>");
    html.append("</table>");
    html.append("<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\">");
    html.append("<center>");
    html.append("<table border=0 cellspacing=0 cellpadding=0>");
    html.append("<tr><td width=610><img src=\"sek.cbui355\" width=\"610\" height=\"1\"><br1><img src=\"sek.cbui355\" width=\"610\" height=\"1\"></td></tr>");
    html.append("</table>");
    html.append("<table fixwidth=610 border=0 cellspacing=0 cellpadding=0>");
    html.append("<tr><td><img src=\"l2ui.mini_logo\" width=5 height=20></td></tr>");
    html.append("<tr>");
    html.append("<td><img src=\"l2ui.mini_logo\" width=5 height=1></td>");
    html.append("<td align=center FIXWIDTH=60 height=29>&$413;</td>");
    html.append("<td FIXWIDTH=540><edit var = \"Title\" width=540 height=13></td>");
    html.append("<td><img src=\"l2ui.mini_logo\" width=5 height=1></td>");
    html.append("</tr></table>");
    html.append("<table fixwidth=610 border=0 cellspacing=0 cellpadding=0>");
    html.append("<tr><td><img src=\"l2ui.mini_logo\" width=5 height=10></td></tr>");
    html.append("<tr>");
    html.append("<td><img src=\"l2ui.mini_logo\" width=5 height=1></td>");
    html.append("<td align=center FIXWIDTH=60 height=29 valign=top>&$427;</td>");
    html.append("<td align=center FIXWIDTH=540><MultiEdit var =\"Content\" width=535 height=313></td>");
    html.append("<td><img src=\"l2ui.mini_logo\" width=5 height=1></td>");
    html.append("</tr>");
    html.append("<tr><td><img src=\"l2ui.mini_logo\" width=5 height=10></td></tr>");
    html.append("</table>");
    html.append("<table fixwidth=610 border=0 cellspacing=0 cellpadding=0>");
    html.append("<tr><td><img src=\"l2ui.mini_logo\" width=5 height=10></td></tr>");
    html.append("<tr>");
    html.append("<td><img src=\"l2ui.mini_logo\" width=5 height=1></td>");
    html.append("<td align=center FIXWIDTH=60 height=29>&nbsp;</td>");
    html.append("<td align=center FIXWIDTH=70><button value=\"&$140;\" action=\"Write Topic crea "
      + forum.getID()
      + " Title Content Title\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td>");
    html.append("<td align=center FIXWIDTH=70><button value = \"&$141;\" action=\"bypass _bbsmemo\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"> </td>");
    html.append("<td align=center FIXWIDTH=400>&nbsp;</td>");
    html.append("<td><img src=\"l2ui.mini_logo\" width=5 height=1></td>");
    html.append("</tr></table>");
    html.append("</center>");
    html.append("</body>");
    html.append("</html>");
    send1001(html.toString(), activeChar);
    send1002(activeChar);
  }
View Full Code Here



    private String rndPW(int length)
    {
        TextBuilder password = new TextBuilder();
        String lowerChar= "qwertyuiopasdfghjklzxcvbnm";
        String upperChar = "QWERTYUIOPASDFGHJKLZXCVBNM";
        String digits = "1234567890";
        for (int i = 0; i < length; i++)
        {
            int charSet = Rnd.nextInt(3);
            switch (charSet)
            {
                case 0:
                    password.append(lowerChar.charAt(Rnd.nextInt(lowerChar.length()-1)));
                    break;
                case 1:
                    password.append(upperChar.charAt(Rnd.nextInt(upperChar.length()-1)));
                    break;
                case 2:
                    password.append(digits.charAt(Rnd.nextInt(digits.length()-1)));
                    break;
            }
        }
        return password.toString();
    }
View Full Code Here

                ipAddress.startsWith("127.0.0.1"));
    }

    public static String printData(byte[] data, int len)
  {
        TextBuilder result = new TextBuilder();

    int counter = 0;

    for (int i=0;i< len;i++)
    {
      if (counter % 16 == 0)
      {
        result.append(fillHex(i,4)+": ");
      }

      result.append(fillHex(data[i] & 0xff, 2) + " ");
      counter++;
      if (counter == 16)
      {
        result.append("   ");

        int charpoint = i-15;
        for (int a=0; a<16;a++)
        {
          int t1 = data[charpoint++];
          if (t1 > 0x1f && t1 < 0x80)
          {
            result.append((char)t1);
          }
          else
          {
            result.append('.');
          }
        }

        result.append("\n");
        counter = 0;
      }
    }

    int rest = data.length % 16;
    if (rest > 0 )
    {
      for (int i=0; i<17-rest;i++ )
      {
        result.append("   ");
      }

      int charpoint = data.length-rest;
      for (int a=0; a<rest;a++)
      {
        int t1 = data[charpoint++];
        if (t1 > 0x1f && t1 < 0x80)
        {
          result.append((char)t1);
        }
        else
        {
          result.append('.');
        }
      }

      result.append("\n");
    }


    return result.toString();
  }
View Full Code Here

TOP

Related Classes of javolution.text.TextBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.