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