Skip to main content



      Home
Home » Modeling » EMF » Reading data stored in model objects and displaying the data
Reading data stored in model objects and displaying the data [message #1071527] Sat, 20 July 2013 07:00 Go to next message
Eclipse UserFriend
hello, I have a scenario. I created the ecore model and I have an class named Reports. This contains certain field like date, some strings.

Is there a possibility to read the contents of the Reports (Model Object)and display the contents (in the client environment)

Its like Reports-> Right click -> a menu is generated and a sub item is like (read this report). On click this should read the contents of the model object(Reading logic resides in some class).

I skimmed through the book and it suggests to create wizards and wizard pages for the UI.

P.S: I can export it as a xmi file and read through the data. but I want it to be done like this.

Any suggestions.

Thanks

[Updated on: Sat, 20 July 2013 07:08] by Moderator

Re: Reading data stored in model objects and displaying the data [message #1071533 is a reply to message #1071527] Sat, 20 July 2013 07:21 Go to previous messageGo to next message
Eclipse UserFriend
Bim,

Comments below.

On 20/07/2013 1:00 PM, bim boh wrote:
> hello, I have a scenario. I created the ecore model and I have an
> class named Reports. This contains certain field like date, some strings.
>
> Is there a possibility to read the contents of the Reports (Model
> Object)and display the contents (in the client environment)
Yes.
>
> Its like Reports-> Right click -> a menu is generated and a sub item
> is like (read this report). On click this should read the contents of
> the model object.
>
> I skimmed through the book and it suggests to create wizards and
> wizard pages for the UI.
Reading the model is trivial and as you can see in the generated editor,
displaying it is also easy.

So it's mostly a question of how/what you want to display, and that's
entirely unclear from your question. How is what you want to achieve
different from just opening the editor for your model?
>
> Any suggestions.
>
> Thanks
Re: Reading data stored in model objects and displaying the data [message #1071538 is a reply to message #1071533] Sat, 20 July 2013 07:41 Go to previous messageGo to next message
Eclipse UserFriend
Ed,

So it's mostly a question of how/what you want to display, and that's
entirely unclear from your question. > This is how my model element looks like:

<?xml version="1.0" encoding="ASCII"?>
<ReportModel:ReportContainer xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI">
  <Reports xsi:type="SampleReportModel:Report"  Date=10:01:2013, ReportName = SampleReport>
  </Reports>
</ReportModel:ReportContainer>


How is what you want to achieve different from just opening the editor for your model?

Sorry I did not understand this.

[Updated on: Sat, 20 July 2013 07:42] by Moderator

Re: Reading data stored in model objects and displaying the data [message #1071542 is a reply to message #1071538] Sat, 20 July 2013 07:58 Go to previous messageGo to next message
Eclipse UserFriend
Bim,

Comments below.

On 20/07/2013 1:41 PM, bim boh wrote:
> Ed,
> So it's mostly a question of how/what you want to display, and that's
> entirely unclear from your question. > This is how my model element
> looks like:
>
> <?xml version="1.0" encoding="ASCII"?>
> <ReportModel:Reports xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI">
> <Reports xsi:type="SampleReportModel:Report" Date=10:01:2013,
> ReportName = SampleReport>
> </Reports>
> </ReportModel:ReportContainer>
And is that what you want to display?
>
> How is what you want to achieve different from just opening the editor
> for your model?
>
> Sorry I did not understand this.
There's a generated editor for the model that you can use to open a file
and display its contents in an outline view and then see the properties
in the properties view. Why don't you just use the editor?
Re: Reading data stored in model objects and displaying the data [message #1071545 is a reply to message #1071542] Sat, 20 July 2013 08:07 Go to previous messageGo to next message
Eclipse UserFriend
Ed,

<?xml version="1.0" encoding="ASCII"?>
<ReportModel:ReportContainer xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI">
  <Reports xsi:type="SampleReportModel:Report"  Date=10:01:2013, ReportName = SampleReport>
  </Reports>
</ReportModel:ReportContainer>


And is that what you want to display?
> yes this is what I want to display.

There's a generated editor for the model that you can use to open a file
and display its contents in an outline view and then see the properties
in the properties view. Why don't you just use the editor?

> yes I know this properties view, but actually I am using an extension on EMF called EMFTrace. I do not get data in the properties view Sad.
Re: Reading data stored in model objects and displaying the data [message #1071556 is a reply to message #1071545] Sat, 20 July 2013 08:51 Go to previous message
Eclipse UserFriend
Bim,

Comments below.

On 20/07/2013 2:07 PM, bim boh wrote:
> Ed,
>
> <?xml version="1.0" encoding="ASCII"?>
> <ReportModel:ReportContainer xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI">
> <Reports xsi:type="SampleReportModel:Report" Date=10:01:2013,
> ReportName = SampleReport>
> </Reports>
> </ReportModel:ReportContainer>
>
>
> And is that what you want to display?
> > yes this is what I want to display.
So you load the model into a resource and use something like to write it
to a string representation:

StringWriter writer = new StringWriter();
OutputStream out = new
URIConverter.WriteableOutputStream(writer, "UTF-8");
resource.save(out, null);
System.err.println(writer.toString());

You can invoke Generate Test Code to generate an XyzExample.java in the
*.tests project showing how to load a resource in a stand alone
application. If you're running in the Eclipse IDE, you don't need any
of the registration code, just a resource set to load the resource. Or
if you already have the model loaded, you can use eObject.eResource() to
get at the resource and use the code I show above write the whole thing
to a string.

>
> There's a generated editor for the model that you can use to open a
> file and display its contents in an outline view and then see the
> properties in the properties view. Why don't you just use the editor?
>> yes I know this properties view, but actually I am using an extension
>> on EMF called EMFTrace. I do not get data in the properties view :(.
Previous Topic:How to annotate HTML?
Next Topic:[Xcore] How to define/constrain a class when it is referenced in two containers
Goto Forum:
  


Current Time: Mon Jul 14 02:48:45 EDT 2025

Powered by FUDForum. Page generated in 0.31147 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top