Mike:

First:

The original purpose of table customizations was to allow the user in real-time 
to organize their table and persist these customizations for selection later.

Your use case, which is a good one also, is for the developer to provide a 
canned set of layouts to allow the user to select.  These can be provided 
through the same mechanism as the saving/loading of the user customizations.

To provide either case, you want to extend XViewerCustomizations and provide it 
to your XViewer through your XViewerFactory via the getXViewerCustomizations 
method.

See the example MyXViewerCustomizations and MyXViewerFactory classes.

MyXViewerCustomizations provides the two "canned" customizations through 
getSavedCustDatas().  Implementing the rest of the methods provides the other 
case where the user can create their own and persist to filesystem, database, 
workspace or wherever the developer wants to persist.

Second:

I have started some documentation at 
http://wiki.eclipse.org/Nebula_XViewer_Getting_Started, but it is certainly 
lacking.  I wouldn't mind you taking a crack at enhancing the information as 
you learn about XViewer.  It's definitely on my list to get done, but other 
things always seem to get in the way.  :>)

Regarding updates to the code.  The correct method is for interested parties to 
provide patches through bugzilla.  Time permitting, one of the XViewer 
committers can review and apply the patches.

Hope that helps,
Don

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Stapleton, Mike
Sent: Thursday, December 09, 2010 3:26 PM
To: Nebula Dev
Subject: Re: [nebula-dev] Ordering columns programmatically?

Donald,
Great stuff! I got it working with our project EMF model and created 4 
different ToolItems to represent my data groupings. I have two questions on the 
implementation. First, I fail to see the implementation that handles adding 
menu items to the dropdown list (your example has "Name Status" and "Name 
Description"). Second, as a result of the first (I'm assuming here) my 
CustomizeData objects don't show up in the Table Customization like yours did 
(again, the same two that were in the dropdown)? I fail to wee where I lost 
this? The only thing I removed was the refresh button because I am using EMF 
data binding instead. I tested that removal on your example and it had no 
effect on ToolItems in you dropdown nor did it remove them from the Table 
Customization so I'm confident that didn't affect anything? There is a lot of 
code and functionality in XViewer and yes examples certainly explain things. 
However, you can't provide examples for everything you can do with it and here 
is where documentation would be useful. If I could find time to add some Java 
Doc to the classes at least to get the process started, what would be the 
process of getting the classes promoted to the repository be? I've kind of been 
following some of the additions and changes that others have contributed that 
last couple of months. What would be nice is to maybe have omething like 
separate repository branches so changes could be committed without affecting 
anything else. Then the changes could be reviewed and accepted or rejected from 
the repository time permitting? What do you think?

Mike

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Dunne, Donald G
Sent: Wednesday, December 08, 2010 4:07 PM
To: Nebula Dev
Subject: Re: [nebula-dev] Ordering columns programmatically?

I've added an example of this to the example package withing the xviewer 
plugin.  Sync up the latest source code to see it.
You can run MyXViewerTest.java  (in Eclipse, right-click -> Run-As -> Java 
Application) to see it work.

The customization icon allows the user to easily toggle between the table 
default and their stored options.
Also added MyDefaultCustomizations to answer your question, Mike, on how to 
build a CustomizeData object to be sent in upon user selecting to change.  The 
example also has two items at the top to show how they can be used.

To also answer your question here:

   public static CustomizeData getCompletionCustomization() {
      CustomizeData data = new CustomizeData();
      data.setName("Name Status");
      data.setGuid(XViewerLib.generateGuidStr());
      data.setNameSpace(MyXViewerFactory.COLUMN_NAMESPACE);

      XViewerColumn nameColumn = MyXViewerFactory.Name_Col.copy();
      nameColumn.setSortForward(true);
      nameColumn.setWidth(175);
      nameColumn.setShow(true);
      data.getColumnData().getColumns().add(nameColumn);

      XViewerColumn percentCol = MyXViewerFactory.Completed_Col.copy();
      percentCol.setWidth(150);
      percentCol.setShow(true);

      data.getColumnData().getColumns().add(percentCol);
      return data;
   }
Hope that helps,
Don

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Stapleton, Mike
Sent: Tuesday, December 07, 2010 11:18 AM
To: Nebula Dev
Subject: Re: [nebula-dev] Ordering columns programmatically?
Thanks Donald,
I've been looking at the code for CustomizeManager, CustomizeData, 
XViewerColumn, and XViewerFactory to try and determine the best way to go about 
creating CustomizeData objects to represent my data groupings. Currently in the 
example code the columns are created and registered in the factory class. As 
well, what you see in the table are those columns created and registered from 
the factory class. Are you saying that I should create XViewerColumns and add 
then to a CustomizeData object along with any filters and sorters I might want 
and then just load a customization selected by the user as described below. I'm 
failing to see the connection between the columns defined in the XViewerFactory 
and those defined from a CustomizeData object? Do all columns need to be 
defined from the MyXViewerFactory up front and then added to a CustomizeData 
object to create the different data views? Could you elaborate a little on this 
process?

TIA,
Mike

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Dunne, Donald G
Sent: Friday, December 03, 2010 8:33 AM
To: Nebula Dev
Subject: Re: [nebula-dev] Ordering columns programmatically?

Since an XViewer customization includes width, sorting, filtering and etc, you 
can't just reorder the columns, you have to set a full CustomizationData 
object.  From XViewer class, you can 
getCustomizationMgr().loadCustomization(CustomizeData)

Your pulldown selection can just select the appropriate CustomizeData and set 
it.

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Stapleton, Mike
Sent: Wednesday, December 01, 2010 9:31 AM
To: Nebula Dev
Subject: [nebula-dev] Ordering columns programmatically?
Maybe someone can help me here? I want to be able to build different 
pre-defined data groupings. I have a dropdown which allows the user to select 
the group of data they want to see. In the process of doing this the order of 
the columns needs to change to match the new data and grouping. This requires 
me to add/delete some columns as well as reorder some columns. I provide 
content and label providers to define each data grouping and reset them and the 
input when the user makes a selection from the Group By dropdown menu. I added 
a function in my extension of the XViewer Factory that calls 
clearColumnRegistration and then I re-register the columns in the order I want. 
Problem is that the columns never reorder. The new content and label providers 
appear to get set and my data gets re-ordered but the column headers remain in 
the same position? So the headers don't match the column data? I now you can 
hide and reorder columns from the Customize Dialog and by just dragging columns 
to a different position but I'm interested in doing this programmatically to 
get the data the user really wants to see and the way they want to see it. I'm 
I going about this in the right way or am I missing something? Anyone try 
something like this yet? Any explanation of why I can't reorder the columns by 
clearing them from the registration and re-registering then would be helpful.

TIA,
Michael
_______________________________________________
nebula-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/nebula-dev

Reply via email to