Archivo para julio 2006

SoC biweek report #1

1 julio 2006

Things I’ve done

DesktopEntry interface

This interface defines methods to obtain some parameters that are common to all the possible file types the system must handle (.desktop files, directories and MIME based files). This interface defines methods to get the name of the entry, a name for the icon of the file and an actionPerformed method. More info on the three possible types follow (all this classes implement the DesktopEntry interface):

.desktop file support (FileDesktopEntry)
I’ve created a class that can load a .desktop file, identifying the possible categories it can hold and storing all the keys stored in the file within the corresponding category.As some keys in the file can be interniotalized using “[locale]” suffixes, so the methods that retrieve values for keys in a desktop file can also receive a Locale parameter. This way, the getName method from DesktopEntry returns a localized name for the file and getIcon obtains it’s info from within the .desktop file, as actionPerformed does.
directory support (DirectoryDesktopEntry)
For directories we don’t have to care about localization, just return directory name on getName and “directory” for the icon name. I tried to invoke fm3d to open the folder from the actionPerformed method but it didn’t work (I have it in my TODO list)
MIME support (MimeDesktopEntry)
This one has been challenging as there doesn’t seem to be a reliable way to obtain mime types in Java. I searched all over the net and all I found or was incomplete and buggy (dieyng with some file types) or just didn’t identify most file types. So, i’ve been forced to go down freedesktop MIME database specification and do my own implementation that for now works quite well (but still resides in my TODO list). The disadvantage is that it needs to access some files that are only present on linux, enoguh for now, but i’ll have to work on this issue at least for Solaris sometime (another TODO). Also the name isn’t localized for this files, just file name, and the icon name is set to the mime type.

Icon theme support

All that DesktopEntryInterface files return a name for the icon that doesn’t contain any path (except forr the FileDesktopEntry that can eventually return an absolute path) in it, and no file extension. There is another specification that defines how to locate icons in the system. Based on this specs i’ve also created an IconTheme class and an IconFinder one, with the later using the former to find an icon for a requested name and size. The IconFinder provides methods to find the icon for a name or for a mime type.

DesktopIcon class

Once we can create a DesktopEntry for any file and obtain an URL for the icon of that file, we can create a Container3D derived class that just needs a Pseudo3DIcon to have 3d icon and a DesktopIconLabel to show the name (TODO: Make icon label readable in all contexts). I also add some event listeners to highlight the label on mouse hover and to execute the DesktopEntry#actionPerformed() method on double click.

DesktopPlugin class

The objective of this stage in my SoC2006 experience is to build a “pluggable” SceneManagerPlugin (SMP) to handle the user ~/Desktop folder (and other ones at user pleasure) and keep it at hand. With this objective I created DesktopPlugin, an SMP that handles classes implementing another interface called DesktopPluginInterface (DPI). This DPI defines methods to populate the desktop, fit it to screen and obtain the plugin root (Maybe I should make DPI extend SMP and add those methods to it, this way the desktop plugin can be selected directly from the lgcfg file… or add a new property like “lg3d.desktop.pluginclass”…or…).

MatrixReorderableLayout class

This LayoutManager3D is supposed to lay the components it receives in a number of rows and columns with a given spacing, and also allow them to be moved within a limited region (never out of rows or columns). Well, it does that things, but is incomplete and doesn’t support more elements than nrows*ncols (really it neither constrain the movement to a limited space).(BIG_TODO: Substitute this layout manager by InfinityScrollableLayout:+info, down in the TODO section)


This is the first desktop plugin i’ve created. The idea is simple, put the folders selected by the user in a classical tabbed panel. This panel is scaled down and moved to the corner of the screen to avoid disturbing user workflow, and when the user moves the moves over it, it grows to 90% of screen size (TODO: and should move opened apps back) so user can select any icon on it (TODO:after an actionPerformed on some icon, the panel should shrink to the corner again). In this plugin there are three main components (Container3D):

  1. panelComp: This container holds the common backpanel for all the tabs. Tha backpanel is wrapped by a detachable BranchGroup so I can substitute it on fitScreen.
  2. iconsContainer: For each tab to show one Container3D is added to iconsContainer after filling it with DesktopIcon(s). Each of them uses the MatrixReorderableLayout (to be substituted).
  3. shortcutsContainer: Using the HorizontalReorderableLayout, this Container3D is filled with TabShortcut objects (one for each tab) which are linked to the corresponding tab in the iconsContainer through a Hashtable. That TabShortcut class has a method to highllight it, and has a listener on MouseClickedEvent so it can notify the TabbedDesktopPlugin that it has gained the focus so it can highlight the correct one and show only the icons of it (whose container is taken from the named hashtable).

TODO next 2weeks

  • code cleanup
  • invoke some file manager on directory actionPerformed
  • after an actionPerformed on some icon, the panel should shrink to the corner again
  • refine MIME detection
  • refine icon search
  • Make icon label readable in all contexts
  • Substitute MatrixReorderableLayout by InfinityScrollableLayout (this new layout will receive rowspacing, colspacing, heightlimit and widthlimit and will hide elements outside the limits. When this happens (icons out of limits) it should add scrolling buttons to let the user see icons outside).
  • code cleanup (wops, it seems I must do a lot of code cleanup)

TODO later

(This doesn’t include work I haven’t started yet)

  • boost performance on load
  • resolve issue with classpath when moved on incubator (+info)
  • work on Solaris MIME detection
  • When TabbedDesktopPlugin is scaled up it should move pre-opened applications back in the Z axis to avoid intersections, just like normal Frame3D apps do.(possible?)

I’m probably forgeting something but I must stop digressing now ;)