Ok, I think I understand what you're trying to do.  Let me attempt to re-phrase 
so you can confirm.

You have multiple views (customizations) and each one you want a different set 
of parent/child tree relationships to show and potentially different 
text/images/colors?

I would probably consider just creating two different XViewers and toggling 
between them.  Seems like it would be much cleaner code.

Howevery, if you wanted to have the content provider and label providers know 
about some preference or setting, you could extend them and have them take a 
provider so they can "query" the preference and react accordingly.

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Stapleton, Mike
Sent: Sunday, January 16, 2011 5:31 PM
To: Nebula Dev
Cc: Stumbo, Josh
Subject: [nebula-dev] How about this idea?

Donald (and those who are interested),
>From my testing I can get the tree behavior to change the root node and the 
>underlying node relationship, in other words select predefined tree views for 
>the data available with out changing the ContentProvider and LabelProvider, if 
>I can let the my content and label providers know what the selection is from 
>the dropdown menu. Of course the content and label providers have to know 
>about the user's selection prior to myLabelProvider.getColumnText and 
>myContentProvider.getChildren being called so they will execute the correct 
>logic based on the menu selection. There looks like there are some places I 
>can add a listener however, this will do me no good if it can't update the 
>providers before they execute. So far this looks like the must logical way to 
>have multiple tree views. Am I attacking this problem the right way or am I 
>missing something in the XViewer architect? I know this is not your main 
>concern and you have plenty of other responsibilities, but any feedback you 
>could provide would be greatly appreciated.

Thank You,
Michael

________________________________
From: [email protected] [mailto:[email protected]] On 
Behalf Of Stapleton, Mike
Sent: Sunday, January 16, 2011 12:38 PM
To: Nebula Dev
Subject: Re: [nebula-dev] Ordering columns programmatically?

Donald (or anyone who would like to chime in),
I got switching between predefined tables working nicely using your example. 
However, I have a requirement to switch between tables and tree views in the 
same application. I can do one or the other from different applications but 
when I try to do both in the same application I have conflicts with the content 
and label providers that represent the 2 different structures as well as the 
way I structure the input to get it to layout properly. Also switching between 
different tree views is clumsy because it requires you to restructure your 
tree. I would think this is something others would find useful but can't find 
any examples or information on it. Is there a mechanism built into XViewer that 
that supports these types of different layouts dynamically? So far I'm back to 
resetting the content and label providers to as well as restructuring the 
input. Any guidance would be greatly appreciated.

Thanks to anyone who has time and knowledge to rrespond.
Michael

________________________________
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