TextPane and Document, how do I work with them?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

TextPane and Document, how do I work with them?

Wouter Schaart
Hello,

I'm in the process of writing book authoring software, I'd like to use a rich text editor for this, and it seems that TextPane and Document could fit my requirements. I've tried to find information about the two but they seem to be two very scarsely documented systems.

Ideally I'd be able to force my documents into very strict structures. Much like XML documents can be forced into very strict structure.
<Book>
  <Title>
  <Author>
  <Summary>
  <Section>
    <Summary>
    <Chapter>
       <Title>
       <Summary>
       <Body>

I'd like to be able to show and hide parts of the text, for example show only summaries when the user desires it. Or show only chapters 3 to 5. Preferably without removing the rest of the document.

Further I'd like to be able to add todo information and annotations to random spans of text. Preferably overlapping each other and spanning the elements above, but not being able to do so is something I'd be able to live with. Of course those spans should remain anchored to the relevant text, additions and removals should not cause problems.

I looked into the pivot code and it seems to me that while document with some subclassed nodes would be very able to represent the information I want to put into it, Textpane has some very clear assumptions on how to work with them. And clearly did not have my unusal document structure in mind.

I'm hoping someone could give me some advice on how to proceed. Can I use TextPane and somehow inject my rules on how to work with a document there? Or should I build my own TextPaneish control? I've tried to do this but got stuck on the skin the function of which isn't apparent to me just now. Is there some tutorial on how to build your own widget available?

Kind regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TextPane and Document, how do I work with them?

Wouter Schaart
Hello again.

I hate to be a bother :) But I'm still not having a lot of luck in this area. Does anyone have any suggestion that might help me on my way?

Kind regards


On Fri, Oct 18, 2013 at 9:58 PM, Wouter Schaart <[hidden email]> wrote:
Hello,

I'm in the process of writing book authoring software, I'd like to use a rich text editor for this, and it seems that TextPane and Document could fit my requirements. I've tried to find information about the two but they seem to be two very scarsely documented systems.

Ideally I'd be able to force my documents into very strict structures. Much like XML documents can be forced into very strict structure.
<Book>
  <Title>
  <Author>
  <Summary>
  <Section>
    <Summary>
    <Chapter>
       <Title>
       <Summary>
       <Body>

I'd like to be able to show and hide parts of the text, for example show only summaries when the user desires it. Or show only chapters 3 to 5. Preferably without removing the rest of the document.

Further I'd like to be able to add todo information and annotations to random spans of text. Preferably overlapping each other and spanning the elements above, but not being able to do so is something I'd be able to live with. Of course those spans should remain anchored to the relevant text, additions and removals should not cause problems.

I looked into the pivot code and it seems to me that while document with some subclassed nodes would be very able to represent the information I want to put into it, Textpane has some very clear assumptions on how to work with them. And clearly did not have my unusal document structure in mind.

I'm hoping someone could give me some advice on how to proceed. Can I use TextPane and somehow inject my rules on how to work with a document there? Or should I build my own TextPaneish control? I've tried to do this but got stuck on the skin the function of which isn't apparent to me just now. Is there some tutorial on how to build your own widget available?

Kind regards

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TextPane and Document, how do I work with them?

Roger and Beth Whitcomb
Hi Wouter,
I've been thinking about your idea/request, and I confess that I'm somewhat at a loss.
So, basically you would *probably* need to create subclasses of some of the org.apache.pivot.wtk.text.Node classes, and the skins that go along with them.  Although these *kind of* look like actual components (like Rollup) that can be inserted into TextPane directly (without creating any custom subclasses).  And/or you could put actual TextPane components underneath Rollup components.

HTH,
~Roger

On Oct 21, 2013, at 3:07 PM, Wouter Schaart <[hidden email]> wrote:

Hello again.

I hate to be a bother :) But I'm still not having a lot of luck in this area. Does anyone have any suggestion that might help me on my way?

Kind regards


On Fri, Oct 18, 2013 at 9:58 PM, Wouter Schaart <[hidden email]> wrote:
Hello,

I'm in the process of writing book authoring software, I'd like to use a rich text editor for this, and it seems that TextPane and Document could fit my requirements. I've tried to find information about the two but they seem to be two very scarsely documented systems.

Ideally I'd be able to force my documents into very strict structures. Much like XML documents can be forced into very strict structure.
<Book>
  <Title>
  <Author>
  <Summary>
  <Section>
    <Summary>
    <Chapter>
       <Title>
       <Summary>
       <Body>

I'd like to be able to show and hide parts of the text, for example show only summaries when the user desires it. Or show only chapters 3 to 5. Preferably without removing the rest of the document.

Further I'd like to be able to add todo information and annotations to random spans of text. Preferably overlapping each other and spanning the elements above, but not being able to do so is something I'd be able to live with. Of course those spans should remain anchored to the relevant text, additions and removals should not cause problems.

I looked into the pivot code and it seems to me that while document with some subclassed nodes would be very able to represent the information I want to put into it, Textpane has some very clear assumptions on how to work with them. And clearly did not have my unusal document structure in mind.

I'm hoping someone could give me some advice on how to proceed. Can I use TextPane and somehow inject my rules on how to work with a document there? Or should I build my own TextPaneish control? I've tried to do this but got stuck on the skin the function of which isn't apparent to me just now. Is there some tutorial on how to build your own widget available?

Kind regards


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TextPane and Document, how do I work with them?

Wouter Schaart
Thanks Roger,

The textpane control neatly delegates some of it's behavior to the org.apache.pivot.wtk.text.Node subclasses. But TextPane hard links to those subclasses. If I insert my own type there TextPane complains about an "Unsupported node type" I'm not going to be able to do any of that without subclassing textpane, but unfortunately the skin won't let me do that.

I admit that by now I'm suffering that incurable common cold for the programmer the "I'll roll my own." syndrome. ;) However documentation isnt' common on that subject either. Do you know a good resource on how to roll my own component? And if that fails, in your opinion, what's the absolute simplest control for me to replicate and experiment with? I thought Label would be simple, but it's got a lot of frills.

Kind regards


On Tue, Oct 22, 2013 at 5:24 PM, Roger Whitcomb <[hidden email]> wrote:
Hi Wouter,
I've been thinking about your idea/request, and I confess that I'm somewhat at a loss.
So, basically you would *probably* need to create subclasses of some of the org.apache.pivot.wtk.text.Node classes, and the skins that go along with them.  Although these *kind of* look like actual components (like Rollup) that can be inserted into TextPane directly (without creating any custom subclasses).  And/or you could put actual TextPane components underneath Rollup components.

HTH,
~Roger

On Oct 21, 2013, at 3:07 PM, Wouter Schaart <[hidden email]> wrote:

Hello again.

I hate to be a bother :) But I'm still not having a lot of luck in this area. Does anyone have any suggestion that might help me on my way?

Kind regards


On Fri, Oct 18, 2013 at 9:58 PM, Wouter Schaart <[hidden email]> wrote:
Hello,

I'm in the process of writing book authoring software, I'd like to use a rich text editor for this, and it seems that TextPane and Document could fit my requirements. I've tried to find information about the two but they seem to be two very scarsely documented systems.

Ideally I'd be able to force my documents into very strict structures. Much like XML documents can be forced into very strict structure.
<Book>
  <Title>
  <Author>
  <Summary>
  <Section>
    <Summary>
    <Chapter>
       <Title>
       <Summary>
       <Body>

I'd like to be able to show and hide parts of the text, for example show only summaries when the user desires it. Or show only chapters 3 to 5. Preferably without removing the rest of the document.

Further I'd like to be able to add todo information and annotations to random spans of text. Preferably overlapping each other and spanning the elements above, but not being able to do so is something I'd be able to live with. Of course those spans should remain anchored to the relevant text, additions and removals should not cause problems.

I looked into the pivot code and it seems to me that while document with some subclassed nodes would be very able to represent the information I want to put into it, Textpane has some very clear assumptions on how to work with them. And clearly did not have my unusal document structure in mind.

I'm hoping someone could give me some advice on how to proceed. Can I use TextPane and somehow inject my rules on how to work with a document there? Or should I build my own TextPaneish control? I've tried to do this but got stuck on the skin the function of which isn't apparent to me just now. Is there some tutorial on how to build your own widget available?

Kind regards



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: TextPane and Document, how do I work with them?

Roger Whitcomb-2

Hi Wouter,

                I was thinking you could actually use a combination of Rollup and TextPane components.  The Rollups would be your outline section headings, and the TextPane would contain each section’s text (and/or images, or other components).  The Rollup would do the show/hide functionality, and you can annotate things (to some extent) in TextPane.  There might be some things missing that would help with indenting and such, but perhaps one of us could be persuaded to make some of those additions for you… ;)

 

~Roger

 

From: Wouter Schaart [mailto:[hidden email]]
Sent: Thursday, October 24, 2013 3:43 PM
To: [hidden email]
Subject: Re: TextPane and Document, how do I work with them?

 

Thanks Roger,

 

The textpane control neatly delegates some of it's behavior to the org.apache.pivot.wtk.text.Node subclasses. But TextPane hard links to those subclasses. If I insert my own type there TextPane complains about an "Unsupported node type" I'm not going to be able to do any of that without subclassing textpane, but unfortunately the skin won't let me do that.

 

I admit that by now I'm suffering that incurable common cold for the programmer the "I'll roll my own." syndrome. ;) However documentation isnt' common on that subject either. Do you know a good resource on how to roll my own component? And if that fails, in your opinion, what's the absolute simplest control for me to replicate and experiment with? I thought Label would be simple, but it's got a lot of frills.

 

Kind regards

 

On Tue, Oct 22, 2013 at 5:24 PM, Roger Whitcomb <[hidden email]> wrote:

Hi Wouter,

I've been thinking about your idea/request, and I confess that I'm somewhat at a loss.

So, basically you would *probably* need to create subclasses of some of the org.apache.pivot.wtk.text.Node classes, and the skins that go along with them.  Although these *kind of* look like actual components (like Rollup) that can be inserted into TextPane directly (without creating any custom subclasses).  And/or you could put actual TextPane components underneath Rollup components.

 

HTH,

~Roger

 

On Oct 21, 2013, at 3:07 PM, Wouter Schaart <[hidden email]> wrote:



Hello again.

 

I hate to be a bother :) But I'm still not having a lot of luck in this area. Does anyone have any suggestion that might help me on my way?

 

Kind regards

 

On Fri, Oct 18, 2013 at 9:58 PM, Wouter Schaart <[hidden email]> wrote:

Hello,

 

I'm in the process of writing book authoring software, I'd like to use a rich text editor for this, and it seems that TextPane and Document could fit my requirements. I've tried to find information about the two but they seem to be two very scarsely documented systems.

 

Ideally I'd be able to force my documents into very strict structures. Much like XML documents can be forced into very strict structure.

<Book>

  <Title>

  <Author>

  <Summary>

  <Section>

    <Summary>

    <Chapter>

       <Title>

       <Summary>

       <Body>

 

I'd like to be able to show and hide parts of the text, for example show only summaries when the user desires it. Or show only chapters 3 to 5. Preferably without removing the rest of the document.

 

Further I'd like to be able to add todo information and annotations to random spans of text. Preferably overlapping each other and spanning the elements above, but not being able to do so is something I'd be able to live with. Of course those spans should remain anchored to the relevant text, additions and removals should not cause problems.

 

I looked into the pivot code and it seems to me that while document with some subclassed nodes would be very able to represent the information I want to put into it, Textpane has some very clear assumptions on how to work with them. And clearly did not have my unusal document structure in mind.

 

I'm hoping someone could give me some advice on how to proceed. Can I use TextPane and somehow inject my rules on how to work with a document there? Or should I build my own TextPaneish control? I've tried to do this but got stuck on the skin the function of which isn't apparent to me just now. Is there some tutorial on how to build your own widget available?

 

Kind regards

 

 

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TextPane and Document, how do I work with them?

Wouter Schaart
I appreciate the additional thought you've put into this topic Roger :) 

But one of the main attractions of my program is that you can annotate text with todo's and comments. Those annotations could overlap multiple chapters and thus would overlap the contents of rollups.

I've begun to experiment with rolling my own control. And it isn't very hard once you figure out the philosophy. I used HueControl and HueControlSkin as utterly simple examples that I could work from.

I've decided to change the document structure from a node based structure to an annotation based structure that we've experimented with at work. So I will be able to put any sort of annotation on the text without worrying about the document structure whilst still being able to enforce that structure. 

Who knows, the end result might even be something worth pushing upstream. ;) I've noticed over the past few months that there's an absolute shortage of good extendable rich text editors in Java. 

Kind regards


On Tue, Oct 29, 2013 at 6:15 PM, Roger L. Whitcomb <[hidden email]> wrote:

Hi Wouter,

                I was thinking you could actually use a combination of Rollup and TextPane components.  The Rollups would be your outline section headings, and the TextPane would contain each section’s text (and/or images, or other components).  The Rollup would do the show/hide functionality, and you can annotate things (to some extent) in TextPane.  There might be some things missing that would help with indenting and such, but perhaps one of us could be persuaded to make some of those additions for you… ;)

 

~Roger

 

From: Wouter Schaart [mailto:[hidden email]]
Sent: Thursday, October 24, 2013 3:43 PM
To: [hidden email]
Subject: Re: TextPane and Document, how do I work with them?

 

Thanks Roger,

 

The textpane control neatly delegates some of it's behavior to the org.apache.pivot.wtk.text.Node subclasses. But TextPane hard links to those subclasses. If I insert my own type there TextPane complains about an "Unsupported node type" I'm not going to be able to do any of that without subclassing textpane, but unfortunately the skin won't let me do that.

 

I admit that by now I'm suffering that incurable common cold for the programmer the "I'll roll my own." syndrome. ;) However documentation isnt' common on that subject either. Do you know a good resource on how to roll my own component? And if that fails, in your opinion, what's the absolute simplest control for me to replicate and experiment with? I thought Label would be simple, but it's got a lot of frills.

 

Kind regards

 

On Tue, Oct 22, 2013 at 5:24 PM, Roger Whitcomb <[hidden email]> wrote:

Hi Wouter,

I've been thinking about your idea/request, and I confess that I'm somewhat at a loss.

So, basically you would *probably* need to create subclasses of some of the org.apache.pivot.wtk.text.Node classes, and the skins that go along with them.  Although these *kind of* look like actual components (like Rollup) that can be inserted into TextPane directly (without creating any custom subclasses).  And/or you could put actual TextPane components underneath Rollup components.

 

HTH,

~Roger

 

On Oct 21, 2013, at 3:07 PM, Wouter Schaart <[hidden email]> wrote:



Hello again.

 

I hate to be a bother :) But I'm still not having a lot of luck in this area. Does anyone have any suggestion that might help me on my way?

 

Kind regards

 

On Fri, Oct 18, 2013 at 9:58 PM, Wouter Schaart <[hidden email]> wrote:

Hello,

 

I'm in the process of writing book authoring software, I'd like to use a rich text editor for this, and it seems that TextPane and Document could fit my requirements. I've tried to find information about the two but they seem to be two very scarsely documented systems.

 

Ideally I'd be able to force my documents into very strict structures. Much like XML documents can be forced into very strict structure.

<Book>

  <Title>

  <Author>

  <Summary>

  <Section>

    <Summary>

    <Chapter>

       <Title>

       <Summary>

       <Body>

 

I'd like to be able to show and hide parts of the text, for example show only summaries when the user desires it. Or show only chapters 3 to 5. Preferably without removing the rest of the document.

 

Further I'd like to be able to add todo information and annotations to random spans of text. Preferably overlapping each other and spanning the elements above, but not being able to do so is something I'd be able to live with. Of course those spans should remain anchored to the relevant text, additions and removals should not cause problems.

 

I looked into the pivot code and it seems to me that while document with some subclassed nodes would be very able to represent the information I want to put into it, Textpane has some very clear assumptions on how to work with them. And clearly did not have my unusal document structure in mind.

 

I'm hoping someone could give me some advice on how to proceed. Can I use TextPane and somehow inject my rules on how to work with a document there? Or should I build my own TextPaneish control? I've tried to do this but got stuck on the skin the function of which isn't apparent to me just now. Is there some tutorial on how to build your own widget available?

 

Kind regards

 

 

 


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: TextPane and Document, how do I work with them?

Roger Whitcomb-2

Well, that sounds awesome, and I would love to have this pushed upstream into Pivot …. Yes, I’ve noticed a lack of rich text editors in Java …. L  So, have fun, and I wish you success.  And please let us know how we can help…

 

~Roger

 

From: Wouter Schaart [mailto:[hidden email]]
Sent: Tuesday, October 29, 2013 10:43 AM
To: [hidden email]
Subject: Re: TextPane and Document, how do I work with them?

 

I appreciate the additional thought you've put into this topic Roger :) 

 

But one of the main attractions of my program is that you can annotate text with todo's and comments. Those annotations could overlap multiple chapters and thus would overlap the contents of rollups.

 

I've begun to experiment with rolling my own control. And it isn't very hard once you figure out the philosophy. I used HueControl and HueControlSkin as utterly simple examples that I could work from.

 

I've decided to change the document structure from a node based structure to an annotation based structure that we've experimented with at work. So I will be able to put any sort of annotation on the text without worrying about the document structure whilst still being able to enforce that structure. 

 

Who knows, the end result might even be something worth pushing upstream. ;) I've noticed over the past few months that there's an absolute shortage of good extendable rich text editors in Java. 

 

Kind regards

 

On Tue, Oct 29, 2013 at 6:15 PM, Roger L. Whitcomb <[hidden email]> wrote:

Hi Wouter,

                I was thinking you could actually use a combination of Rollup and TextPane components.  The Rollups would be your outline section headings, and the TextPane would contain each section’s text (and/or images, or other components).  The Rollup would do the show/hide functionality, and you can annotate things (to some extent) in TextPane.  There might be some things missing that would help with indenting and such, but perhaps one of us could be persuaded to make some of those additions for you… ;)

 

~Roger

 

From: Wouter Schaart [mailto:[hidden email]]
Sent: Thursday, October 24, 2013 3:43 PM
To: [hidden email]
Subject: Re: TextPane and Document, how do I work with them?

 

Thanks Roger,

 

The textpane control neatly delegates some of it's behavior to the org.apache.pivot.wtk.text.Node subclasses. But TextPane hard links to those subclasses. If I insert my own type there TextPane complains about an "Unsupported node type" I'm not going to be able to do any of that without subclassing textpane, but unfortunately the skin won't let me do that.

 

I admit that by now I'm suffering that incurable common cold for the programmer the "I'll roll my own." syndrome. ;) However documentation isnt' common on that subject either. Do you know a good resource on how to roll my own component? And if that fails, in your opinion, what's the absolute simplest control for me to replicate and experiment with? I thought Label would be simple, but it's got a lot of frills.

 

Kind regards

 

On Tue, Oct 22, 2013 at 5:24 PM, Roger Whitcomb <[hidden email]> wrote:

Hi Wouter,

I've been thinking about your idea/request, and I confess that I'm somewhat at a loss.

So, basically you would *probably* need to create subclasses of some of the org.apache.pivot.wtk.text.Node classes, and the skins that go along with them.  Although these *kind of* look like actual components (like Rollup) that can be inserted into TextPane directly (without creating any custom subclasses).  And/or you could put actual TextPane components underneath Rollup components.

 

HTH,

~Roger

 

On Oct 21, 2013, at 3:07 PM, Wouter Schaart <[hidden email]> wrote:

 

Hello again.

 

I hate to be a bother :) But I'm still not having a lot of luck in this area. Does anyone have any suggestion that might help me on my way?

 

Kind regards

 

On Fri, Oct 18, 2013 at 9:58 PM, Wouter Schaart <[hidden email]> wrote:

Hello,

 

I'm in the process of writing book authoring software, I'd like to use a rich text editor for this, and it seems that TextPane and Document could fit my requirements. I've tried to find information about the two but they seem to be two very scarsely documented systems.

 

Ideally I'd be able to force my documents into very strict structures. Much like XML documents can be forced into very strict structure.

<Book>

  <Title>

  <Author>

  <Summary>

  <Section>

    <Summary>

    <Chapter>

       <Title>

       <Summary>

       <Body>

 

I'd like to be able to show and hide parts of the text, for example show only summaries when the user desires it. Or show only chapters 3 to 5. Preferably without removing the rest of the document.

 

Further I'd like to be able to add todo information and annotations to random spans of text. Preferably overlapping each other and spanning the elements above, but not being able to do so is something I'd be able to live with. Of course those spans should remain anchored to the relevant text, additions and removals should not cause problems.

 

I looked into the pivot code and it seems to me that while document with some subclassed nodes would be very able to represent the information I want to put into it, Textpane has some very clear assumptions on how to work with them. And clearly did not have my unusal document structure in mind.

 

I'm hoping someone could give me some advice on how to proceed. Can I use TextPane and somehow inject my rules on how to work with a document there? Or should I build my own TextPaneish control? I've tried to do this but got stuck on the skin the function of which isn't apparent to me just now. Is there some tutorial on how to build your own widget available?

 

Kind regards

 

 

 

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TextPane and Document, how do I work with them?

Sandro Martini
Hi all,
did you tried to see if a Stack Pane (
http://pivot.apache.org/tutorials/stack-panes.html ) could help to
layer different elements ?
Maybe triyng to link (in some way) a bottom component and another over
(semi-transparent) for your overlays ?

Just as idea, don't know if this really apply to your needs ...

Bye,
Sandro
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: TextPane and Document, how do I work with them?

Wouter Schaart
Thank you Sandro, 

I'm not looking to layer elements. I have some specific wishes for a text editor. I'm afraid I don't quite see how to apply your suggestion to my problem.

As said, I am trying to roll my own component. Only time will tell what kind of victory or fiasco will come from that.. But for now I'm happily tinkering.

Kind regards

On Wed, Oct 30, 2013 at 10:10 AM, Sandro Martini <[hidden email]> wrote:
Hi all,
did you tried to see if a Stack Pane (
http://pivot.apache.org/tutorials/stack-panes.html ) could help to
layer different elements ?
Maybe triyng to link (in some way) a bottom component and another over
(semi-transparent) for your overlays ?

Just as idea, don't know if this really apply to your needs ...

Bye,
Sandro

Loading...