Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Question about splitCharacter

Question about splitCharacter

2007-11-08       - By Tom Tolman

 Back
Reply:     1     2     3     4     5  





I have implemented SplitCharacter and was hoping to have it split after
the close parenthesis ')', but not before this character,  As such I
have something like:



public boolean isSplitCharacter(int start, int current, int end, char[]
cc, PdfChunk[] ck) {

  char c;

  if (ck == null)

      c = cc[current];

  else

      c = ck[Math.min(current, ck.length -
1)].getUnicodeEquivalent(cc[current]);

  if ((c ')') || (c==' ')) {

      return true;

  }



This appears to work in some situations such as the breaking of
"aaa)bbb" is correct and desired as:

aaa)

bbb



However, in the case where a closing parenthesis ends the line, it is
treating it as a "split before character".  In other words, the line:



hello (test)



is split as follows:

hello (test

)



instead of what I want which is:

hello

(test)





According to the implicit definition "treat a split character as if it
can go at the beginning or end of a line" it is working, but what I
desire is "treat this split character as if it only can go on the end of
the line".



So my questions are:



1) Is there native support for this concept of the split character being
at the start or end of a contiguous set of characters?

2) If not, can I "force" it by breaking the text into chunks that are
stuck next to each other?

3) If breaking the text into chunks does not work, is the only real
remaining course of action to insert line breaks manually?



Thanks for any ideas,








<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft
-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn
:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office
:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid
:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3
-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="
#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss=
"urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft
-com:office:component:spreadsheet" xmlns:oa="urn:schemas-microsoft-com:office
:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http:/
/schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:x2="http://schemas
.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com
/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap
/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http:/
/schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com
/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sps="http:/
/schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001
/XMLSchema-instance" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile"
xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:mver=
"http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http:/
/schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas
.openxmlformats.org/package/2006/relationships" xmlns:ex12t="http://schemas
.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas
.microsoft.com/exchange/services/2006/messages" xmlns="http://www.w3.org/TR/REC
-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@(protected)
  {font-family:Calibri;
  panose-1 (See http://ose-1.ora-code.com):2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
  {margin:0in;
  margin-bottom:.0001pt;
  font-size:11.0pt;
  font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
  {mso-style-priority:99;
  color:blue;
  text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
  {mso-style-priority:99;
  color:purple;
  text-decoration:underline;}
pre
  {mso-style-priority:99;
  mso-style-link:"HTML Preformatted Char";
  margin:0in;
  margin-bottom:.0001pt;
  font-size:10.0pt;
  font-family:"Courier New";}
span.EmailStyle17
  {mso-style-type:personal-compose;
  font-family:"Calibri","sans-serif";
  color:windowtext;}
span.HTMLPreformattedChar
  {mso-style-name:"HTML Preformatted Char";
  mso-style-priority:99;
  mso-style-link:"HTML Preformatted";
  font-family:"Courier New";}
.MsoChpDefault
  {mso-style-type:export-only;}
@(protected) Section1
  {size:8.5in 11.0in;
  margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
  {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
 <o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>I have implemented SplitCharacter and was hoping to have it
split after the close parenthesis ')', but not before this character,&nbsp; As
such I have something like:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'
>public
boolean isSplitCharacter(int start, int current, int end, char[] cc, PdfChunk[]
ck) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;
char c;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;
if (ck == null)<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
c = cc[current];<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;
else<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
c = ck[Math.min(current, ck.length - 1)].getUnicodeEquivalent(cc[current]);<o:p
></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;
if ((c ')') || (c==' ')) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return true;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>This appears to work in some situations such as the breaking
of &nbsp;&quot;aaa)bbb&quot; is correct and desired as:<o:p></o:p></p>

<p class=MsoNormal>aaa) <o:p></o:p></p>

<p class=MsoNormal>bbb <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>However, in the case where a closing parenthesis ends the
line, it is treating it as a &quot;split before character&quot;.&nbsp; In other
words, the line:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>hello (test)<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>is split as follows:<o:p></o:p></p>

<p class=MsoNormal>hello (test<o:p></o:p></p>

<p class=MsoNormal>)<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>instead of what I want which is:<o:p></o:p></p>

<p class=MsoNormal>hello<o:p></o:p></p>

<p class=MsoNormal>(test)<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>According to the implicit definition &quot;treat a split
character as if it can go at the beginning or end of a line&quot; it is
working, but what I desire is &quot;treat this split character as if it only
can go on the end of the line&quot;.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>So my questions are:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>1) Is there native support for this concept of the split
character being at the start or end of a contiguous set of characters?<o:p></o
:p></p>

<p class=MsoNormal>2) If not, can I &quot;force&quot; it by breaking the text
into chunks that are stuck next to each other?<o:p></o:p></p>

<p class=MsoNormal>3) If breaking the text into chunks does not work, is the
only real remaining course of action to insert line breaks manually?<o:p></o:p>
</p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Thanks for any ideas,<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

©2008 junlu.com - Jax Systems, LLC, U.S.A.