fife.common.jar

Questions on using RText should go here.

Moderator: robert

fife.common.jar

Postby groggy » Tue Apr 30, 2013 5:22 pm

I decided to use your small framework for my project. I created a class which extends AbstracePluggableGUIApplication and I was ttrying to add a dockable window at startup but I don't no how to do that. I tried to call in the predisplazinit method ((DockableWindowPanel)mainContentPanel).addDockableWindow() but it doesn't changed anything. The dockable window which I gives the method as parameter has not been showed. Could you tell me how to add a window to the application?

Also I don't no how to write the code for savings ccommon properties of the window llike location and so oon. I subclassed GUIApllicationPreferences and I put the path into the getPreferencesClassName method of the aapplication but eac. Time I load the application it uses the default ones. Is that a bug?
groggy
 
Posts: 34
Joined: Sun Feb 17, 2013 1:11 am

Re: fife.common.jar

Postby groggy » Tue Apr 30, 2013 5:34 pm

I solved the dockable problem. Forgot to set active^^ the preferences are working also. But how I can resiz. The content in a DockableWindow Webb the user stretch it with the divider?
groggy
 
Posts: 34
Joined: Sun Feb 17, 2013 1:11 am

Re: fife.common.jar

Postby robert » Sat May 04, 2013 4:10 am

Awesome, it's very cool that you're using this stuff! I'm not sure many people actually use the library framework in fife.common.jar besides me. Because of that, I'm sure it's way more difficult to use than it needs to be. :)

Glad you figured out how to add dockable windows. The AbstractPluggableGUIApplication only exposes an addPlugin() method, so you had to do some ugly casting to add just a dockable window. There's one example of something that should be doable via a simple method. Also I suppose DockableWindows should default to "active"?

As for the size of the docked windows, use app.setSplitPaneDividerLocation(int side, int pos). The "side" parameter is one of the DockableWindowConstants.TOP/LEFT/BOTTOM/RIGHT values.

Loading and saving preferences is one of the worst parts of the library. The loading of preferences is automatic, and the setting of all the built-in fields of GUIApplicationPreferences is also automatic - window location & size, LookAndFeel, etc. But any app-specific preferences you define in your GUIApplicationPreferences subclass must be set yourself, usually from your preDisplayInit override (cast the GUIApplicationPreferences to your concrete type and use it).

Saving of the preference values is not automatic, however. You have to create an instance of your concrete GUIApplicationPreferences subclass yourself and call its savePreferences() method. Probably the best thing to do is look at how RText does it:

  • Override the doExit() method and save your preferences there.
  • Have some sort of way to generate the preferences object, and use the Java Preferences API to actually save the stuff (see the RTextPreferences class, particularly the savePreferences() method)

The preferences are stored wherever the Java Preferences APi saves them; on Windows it's the registry (yuck), everywhere else it's an XML file in your home directory.

Honestly though, I'd suggest forgoing this route and using the simpler org.fife.ui.app.Prefs class instead. It's what the RText plugins use (see e.g. SourceBrowserPlugin#loadPrefs()/savePreferences() and SourceBrowserPrefs). It's better (in my opinion) because it's simpler than the Java Preferences API, and loads/saves to a simple properties file (doesn't use the registry on Windows). I'm probably going to redo AbstractGUIApplication to use this class instead of what it currently does in the future because it's so much simpler.
User avatar
robert
 
Posts: 788
Joined: Sat May 10, 2008 5:16 pm

Re: fife.common.jar

Postby groggy » Mon May 06, 2013 8:22 pm

I thought: I can use RCP, buts that'. To heavy for a <5MB project. So I just started RText(nice work^^) and tried the dockable window stuff and I was surprised how good it was working. So I decided to use that framework. Sure, it took a while to figure out how to use it but if you know it, it isn't as much complicated as thought.
It's a good coded framework, not to heavy and it contains all needed things for a small application.

If you want I could improve the save mechanism, so it will do that automatically, probably I would than also redo the preferences part in AbstractGUIApplication


was working on a similar framework, but I could not create dockable windows, so i stopped working on it.

you ever worked with maven? I'm curious how user think about it... Is it easy to use? Or should I do not work with it?

How I wrote some lines before, if you want, I can improve the library for you. Just reply :D
groggy
 
Posts: 34
Joined: Sun Feb 17, 2013 1:11 am

Re: fife.common.jar

Postby robert » Tue May 07, 2013 3:50 am

Patches for features are always welcome; feel free to drop a patch in the Feature Request section of RText's SourceForge page (select Tracker -> Patches).

As for Maven, I haven't really used it, and I have someone else update RSyntaxTextArea in Maven since I'm too lazy to learn. :) I'm sure it's worthwhile, especially if you typically work on projects with lots of dependencies, but my personal projects usually aren't large enough to warrant the effort, and at work we use a different (internal) dependency manager.
User avatar
robert
 
Posts: 788
Joined: Sat May 10, 2008 5:16 pm

Re: fife.common.jar

Postby groggy » Tue May 07, 2013 7:51 am

Ok thanks I will try to improve it :D
groggy
 
Posts: 34
Joined: Sun Feb 17, 2013 1:11 am

Re: fife.common.jar

Postby groggy » Tue May 07, 2013 4:06 pm

Also im curious how you are adding syntax highlighting ro a jtextarea. I was looking into the source code but sis not understand much(probably the problem comes from my side).

understand that you create with jflex a parse, that parses the actual line fore you. The parser splittes the line into the the defined tokens. Ok but how are you highlighting them? Does this happen in the rsyntaxsocument with some plaindocument stuff?

ao I could not find the code were rsta knows which parser he should use.

Could you help me?
groggy
 
Posts: 34
Joined: Sun Feb 17, 2013 1:11 am

Re: fife.common.jar

Postby groggy » Tue May 07, 2013 5:31 pm

For which target platform should I write the patch? 1.4? Or 1.5 or 1.7?
groggy
 
Posts: 34
Joined: Sun Feb 17, 2013 1:11 am

Re: fife.common.jar

Postby robert » Wed May 08, 2013 2:05 am

Everything is still 1.4 for the time being.
User avatar
robert
 
Posts: 788
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest