Donald,
Thanks for the tips and new XViewer example.
Got it working using your examples and it works great. Now I get it. But now I have
to take it a step further and bind my EMF model to the data so I can get
updates when data changes. I’m now using an ObservableListTreeContentProvider
for my content provider supplying the factory and advisor code which is
somewhat similar to the label and content provider I was using before. My
question is does XViewer work with the Observable framework and has anyone tested
it before? I’m think I’m doing a pretty much generic (if you can call anything
about the Observable framework generic?) use of the framework.
I create a ObservableListTreeContentProvider
basically because XViewer extends TreeViewer and that is pretty much the norm
right?
ObservableListTreeContentProvider cp
=
new
ObservableListTreeContentProvider(new SignalTableTreeFactory(),
new SignalTableTreeStructureAdvisor());
Set my content and lableprovider
myXviewer.setContentProvider(cp);
myXviewer.setLabelProvider(new MyTableLabelProvider(rssmXviewer));
Create some simple attribute bindings...
List<IEMFValueProperty>
attributes = new ArrayList<IEMFValueProperty>();
attributes.add(EMFProperties.value(MyModelPackage.Literals.NETWORK__NAME));
attributes.add(EMFProperties.value(MyModelPackage.Literals.PTC__PTC_ID));
Get the EMF root object
rootObj = getRootModel();
Set up a property list and between the
root and the relationship with my network objects.
IEMFListProperty networks =
EMFProperties.list(MyModelPackage.Literals.ROOT__NETWORKS);
And finally, set the input to the root but
observe for network object changes.
myXviewer.setInput(networks.observe(rootObj));
I create some property list in my factory
clase
private IEMFListProperty
uplinkChildren = EMFProperties.list(MyModelPackage.Literals.UPLINK__PTCS);
private IEMFListProperty
networkChildren = EMFProperties.list(MyModelPackage.Literals.NETWORK__PTCS);
private IEMFListProperty siteChildren
= EMFProperties.list(MyModelPackage.Literals.ROOT__SITES);
private IEMFListProperty networks =
EMFProperties.list(MyModelPackage.Literals.ROOT__NETWORKS);
private IEMFListProperty uplinks =
EMFProperties.list(MyModelPackage.Literals.ROOT__UPLINKS);
and of course return an IObservable object
from the createObservable method using the proper IEMFListProperty observe call
above based on the object I receive. My Advisor now handles the getParent and
hasChildren methods as it should. My label provider is the same as before.
I’m getting a null pointer exception somewhere
in the Observable framework but I took it through the debugger once and it’s
not coming from my input of the root object. I will test it more tomorrow but
for now I just want to know if the Observable framework should work with
XViewer and if so, is there anything you would have to do different to use it?
Thanks to anyone who knows something about
this in advance, (maybe I’m the first?)
Mike
From:
nebula-dev-bounces@xxxxxxxxxxx [mailto:nebula-dev-bounces@xxxxxxxxxxx] 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 = "" 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:
nebula-dev-bounces@xxxxxxxxxxx [mailto:nebula-dev-bounces@xxxxxxxxxxx] 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: nebula-dev-bounces@xxxxxxxxxxx
[mailto:nebula-dev-bounces@xxxxxxxxxxx] 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:
nebula-dev-bounces@xxxxxxxxxxx [mailto:nebula-dev-bounces@xxxxxxxxxxx] 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