[jsword-devel] online module editor
Troy A. Griffitts
jsword-devel@crosswire.org
Fri, 01 Nov 2002 13:24:04 -0700
I could still really use some expert help here. If anyone can answer
some basic Java question, please frequent irc.openprojects.net #sword
I'm spending way too much time trying to get dumb things working like
piping data from an InputStream to a Writer.
Runtime::exec gives me an InputStream,
jsp gives me a Writer.
I need to preserve the stream, as is, so as not to disrupt the UTF8
character encoding stream.
Here's my code that doesn't compile:
int runCommand(String command, Writer result) {
int retVal = -1;
try {
java.lang.Process p = Runtime.getRuntime().exec(command);
retVal = p.waitFor();
InputStream is = p.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
int len;
byte inBuf[] = new byte[8192];
do {
len = bis.read(inBuf, 0, 8192);
if (len > 0)
result.write(inBuf, 0, len);
} while (len > 0);
}
catch (Exception e) {e.printStackTrace();}
return retVal;
}
Any help would be greatly appreciated.
-Troy.
Joe Walker wrote:
>
> Hi,
>
> Sorry I've been slow to answer. It looks good - you're clearly not
> *that* rusty! I could only move one marker at a time, so as soon as I
> moved the second, the first jumped back to the end of the line. It could
> be a bug (I'm on 1.4.0 IIRC) or it could be that I don't understand what
> you are trying to do enough.
> Don't worry about flooding the list.
>
> Joe.
>
> Troy A. Griffitts wrote:
>
>> Ok guys, here's my latest stuff.
>> This will be my last post to jsword-devel unless anyone specifically
>> notes they are interested. I know this isn't jsword-specific, but
>> thought the Java aspect might be interesting, but I don't want to
>> flood your list.
>>
>>
>> Remember to click on the image you'd like to move (it actually takes a
>> second or so now, because it does lookups for word definition entries).
>>
>> Also new and not obvious is left and right arrow sliding of images and
>> space-bar to toggle move/size action.
>>
>> remember: java -jar ModEdit.jar
>>
>> It looks much nicer under 1.4.1 opposed to 1.3.1 (what my ide uses).
>>
>> -Troy.
>>
>>
>>
>>
>>
>>
>> Troy A. Griffitts wrote:
>>
>>> Here's this afternoon's stuff. I gave up preserving spaces. It's
>>> cheezy, but for now, I'm converting them to '_'. Stuff seems to work
>>> ok like this. We'll see how much I get done tonight but am off to do
>>> some OSIS texts right now. If you're taking any time looking into
>>> it, please let me know so we don't duplicate efforts.
>>>
>>> Thanks,
>>> -Troy.
>>>
>>> PS. In case you didn't know, you can try the silly app out with
>>> something like: java -jar ModEdit.jar
>>>
>>>
>>>
>>> Troy A. Griffitts wrote:
>>>
>>>> Ok, here's my first VERY FEEBLE attempt at this. Anyone want to
>>>> take a shot at doing a little more. Attached is some very ugly code
>>>> in a generically packaged project-- not so worried about that yet.
>>>> Please don't try to clean it up, as I will be experimenting much
>>>> more with sloppy code.
>>>>
>>>> I'M JUST TRYING TO GET THE DRAGGING of the image to work correctly.
>>>> It drags, but:
>>>>
>>>> o doesn't preserve spaces correctly.
>>>> o gets stuck at the beginning
>>>> o forces you to click on the image once before dragging.
>>>>
>>>> if you uncomment the code that adds 2 more images (with different
>>>> identifiers), you'll see even more problems.
>>>>
>>>> BUT I don't think it's a bad days start considering the thickness of
>>>> the cobwebs :)
>>>>
>>>> Need much help from you experts.
>>>>
>>>> My plan tomorrow is try to fix the above bugs and look into:
>>>>
>>>> o creating the images on the fly
>>>> o setting the URLBase so the images can be loaded
>>>>
>>>>
>>>> Thanks for any time you might spend on me. I'm going to sleep now :)
>>>>
>>>> -Troy.
>>>>
>>>>
>>>>
>>>> Joe Walker wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I think that none of JEditorPane, JTextPane or JTextField support
>>>>> d&d well enough. Anyone know better?
>>>>>
>>>>> I'm not sure quite what the "arXA>" is about - but would I be
>>>>> correct in assuming that you want to allow people to mark-up
>>>>> Biblical text with things like strongs numbers? If so then you
>>>>> could have it more like a word processor where there is a Strongs
>>>>> button in place of a Bold button. IIRC the Swing Trail in the Java
>>>>> Tutorial has a styled text editor somewhere.
>>>>>
>>>>> Joe.
>>>>>
>>>>> Troy A. Griffitts wrote:
>>>>>
>>>>>> On that same note, does anyone know if it's easy to 'drag' images
>>>>>> around in a text display widget?
>>>>>>
>>>>>> Here's my idea... Say there was text something like:
>>>>>>
>>>>>> In the beginning was the Word, and the Word was with God, and the
>>>>>> Word was God.[strongs: en><][strongs: arXA><]
>>>>>>
>>>>>> and stuff like [strongs: en> and <] were images. I would like the
>>>>>> editor to be able to drag the images to the appropriate place in
>>>>>> the text, e.g.
>>>>>>
>>>>>> [strongs: en>In<] [strongs: arXA>the beginning<] was the Word, and
>>>>>> the Word was with God, and the Word was God.
>>>>>>
>>>>>> Any ideas from those more Java savvy than myself?
>>>>>>
>>>>>> -Troy.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> jsword-devel mailing list
>>>>> jsword-devel@crosswire.org
>>>>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel