-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tabulation and gaps #271
Comments
Oh, indeed it does (my request is more simple since I do not need text to be editable). Missed that issue (strange, I've searched for "tabstop" ). In fact it is not that complicated to implement. You do not need to introduce tables. All you need to store a list of observable integer tabstop values and replace all |
The issue there is the "resizeable gaps". It sounds to me like you're suggesting that we replace all I'm also assuming that this change would be incorporated into |
Maybe a |
@altavir I think your goal of having resizeable gaps via nodes can now be done. Custom object support was added and you can design your own version of |
Thanks, I will check it shortly and report. |
I tried to work with 0.7 API but it seems to be unusable or at least overwhelmingly confusing. There are these new |
To say the least, it might help you to read through the Wiki. We've written some pages that explain some things to help people get started.
Unfortunately, it is confusing to a degree. I don't know if I'd say it's unusable.
Actually, the
Perhaps it would, but that would then restrict developers. Generics allow them full flexibility as to what a segment is.
If you read through the wiki, implementing such a thing shouldn't be too hard. Still, providing a plain text |
I wrote the post only after I've read through the wiki. I finally found a way to generate I managed to make my old code work in 0.7. Still found a lot of confusing things. For example necessity to use paragraph style. Event though I've read through the wiki, I do not completely understand how this object support is working. In fact the only thing I need is ability to place resizeable gaps that would be copied as |
Oh.
Mm... looks like we need to still write that part then. I'll add it to the todo list in #403.
That tends to be the case with Tomas' projects because he believes in self-documenting code.
Yeah, just another reason to refactor the base area class to one without styles so that other can add only the styles they want into their area.
You'd need to ask @afester about that as he's the one who wrote it.
Perhaps what you really need is not custom object support at all, but an |
I believe that what I really will need is to change a view, not model. Meaning subclassing a By the way, I believe that text model presented in 0.7 is too complicated. Making everything generic is a good thing, but currently it is very hard to understand how it works. You need either write a very good documentation, or hide all the implementation details behind some convenient builders and utilities. |
Any updates on this @altavir The recent release |
Thanks for the heads up. Documentation is indeed better. I think it is good idea to link it against JDK using |
In due time, no sooner, no later. |
The documentation is still not very comprehensible. I am trying to migrate to |
With this general and rather vague statement, I am not sure whether it refers only to the issue you've just asked for help on (appending a read-only styled text fragment) or something else. Could you be more specific as to what about the documentation is not comprehensible and why? 😉 Otherwise I have no clear outcome to try to reach.
String text = //
S style = //
int position = area.getLength();
area.replace(position, position, text, style); Personally, I wonder whether we should remove all the |
So I have to first add text and the replace it by styled text? Or I must replace empty text with styled text? I am not sure I understand. As for documentation. If you are saying that is easier to use segments, could you point me to the place in documentation where they are described. I understand that writing good documentation is hard (my own project is much worse than yours), but currently I can't understand even basic concepts of your text model. |
I'll explain this first so you have a better understanding of the text model. If this seems very basic and "no duh..." it's because I'm trying to overcommunicate, not because I think you are dumb. In RichTextFX's original design (this has changed since then, and I'll get to that in a bit), a segment used to be nothing more than a
Since its a text area and not a text field, a Later on, someone wanted to be able to align the text to the right, so they added paragraph styles (the Later on, someone thought "But a rich text editor should be able to display more than just text! What if we wanted to render an image in-line with the text?" So, they introduced the idea of a segment (the
I recently introduced a change that makes But, coming back to your question, what exactly is
I'll now address the first part of your reply:
This code int position = area.getLength();
area.replace(position, position, text, style); specifies that you are not replacing anything in the document (because |
OK, it is much better. Maybe you should place this text into wiki along with some examples of basic operations? |
This is sort of already explained (but maybe not quite to the degree of clarity as above) in the model package's package-info.java and in the "Core Classes" wiki page, excluding the history part. When I was writing #630, the PS, SEG, and S generics appear in so many classes. So I put the better explanation in the model package and Still, I think it would be a good idea to add this to the wiki, perhaps in the "core classes" page? |
I think it should have its own entry, maybe between Text Styles and Implementing custom objects ? |
Would one of you two mind adding that then? |
Ok, I had a shot at it - see: What exactly is SEG ? |
Not bad. One thing that should be clarified (which I didn't mention in my response) was that Also, this issue is starting to get blurred with another one: explaining what |
I think that it has been addressed, so we can return to the main issue :-) As to "how one would render a BTW: In my own project when I implemented custom objects I created an AbstractSegment (as @altavir suggested above) that is basically a SEG wrapper, with Ops and node creator methods all wrapped up together. I think I mainly did it this way because I disliked the |
Adding that explanation makes a lot more sense to me. Could you update that in the wiki page, too, if you haven't already?
I can see why you would go that route as their are different pros/cons than the Either approach. |
Hello, I am trying to implement a text viewer (no editing so far) using RichTextFx with tab stops meaning that I need for text with the same number of tabulation symbols start at the same position in different lines. The only problem is that I do not understand how to insert a gap with variable with inside the text. In TextFlow, I solved this problem by inserting an invisible Box with variable width, and it worked quite fine, since it also allows to change tab stops dynamically (the only problem with TextFlow is that I cannot select and copy text from it). Is there a way to insert gaps in RichTextFX?
The text was updated successfully, but these errors were encountered: