Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » where is the code that put presentation properties in the flow example
where is the code that put presentation properties in the flow example [message #166767] Thu, 03 February 2005 02:02 Go to next message
Eclipse UserFriend
Originally posted by: jianminjin.msn.com

i just find how it creates the model, but i can't find any code that is
related with the apperance , why are the activities in those position,
how does it know where to draw the transition lines?
gef is a big project , i'm totally lost when i read the source code,
any good suggestion about how to read the source code? like reading
C code , i can start with the main(), but how can i read gef project?
even i have the source code now , i still have no idea how it works,
what's the main step to construct a graphic editor. if u know the answer,
please let me know, any help from u will be greatly appreciated.
private ActivityDiagram createWakeupModel() {
ActivityDiagram diagram = new ActivityDiagram();
SequentialActivity wakeup = new SequentialActivity();
Activity backToSleep = new Activity("Go back to sleep");
Activity turnOff = new Activity("Turn off alarm");
wakeup.setName("Wake up");
wakeup.addChild(new Activity("Hit snooze button"));
wakeup.addChild(backToSleep);
wakeup.addChild(turnOff);
wakeup.addChild(new Activity("Get out of bed"));
diagram.addChild(wakeup);

SequentialActivity bathroom = new SequentialActivity();
bathroom.addChild(new Activity("Brush teeth"));
bathroom.addChild(new Activity("Take shower"));
bathroom.addChild(new Activity("Comb hair"));
bathroom.setName("Bathroom activities");
diagram.addChild(bathroom);

ParallelActivity relaxation = new ParallelActivity();
relaxation.addChild(new Activity("Watch cartoons"));
relaxation.addChild(new Activity("Power Yoga"));
relaxation.setName("Morning relaxation ritual");
diagram.addChild(relaxation);

Activity sleep, alarm, alarm2, clothes, spare, no, yes, drive;
diagram.addChild(sleep = new Activity("Sleep....."));
diagram.addChild(alarm = new Activity("Alarm!!!"));
diagram.addChild(alarm2 = new Activity("Alarm!!!"));
diagram.addChild(clothes = new Activity("Put on clothes"));
diagram.addChild(spare = new Activity("Is there time to spare?"));
diagram.addChild(yes = new Activity("YES"));
diagram.addChild(no = new Activity("NO"));
diagram.addChild(drive = new Activity("Drive to work"));

new Transition(sleep, alarm);
new Transition(alarm, wakeup);
new Transition(backToSleep,alarm2);
new Transition(alarm2,turnOff);
new Transition(wakeup, bathroom);
new Transition(bathroom, clothes);
new Transition(clothes, spare);
new Transition(spare, yes);
new Transition(spare, no);
new Transition(yes, relaxation);
new Transition(no, drive);
new Transition(relaxation, drive);
return diagram;
}
Re: where is the code that put presentation properties in the flow example [message #167137 is a reply to message #166767] Sun, 06 February 2005 06:25 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Look at DirectedGraph and DirectedGraphLayout.

"jin" <jianminjin@msn.com> wrote in message
news:cts0nu$vqa$1@www.eclipse.org...
> i just find how it creates the model, but i can't find any code that is
> related with the apperance , why are the activities in those position,
> how does it know where to draw the transition lines?
> gef is a big project , i'm totally lost when i read the source code,
> any good suggestion about how to read the source code? like reading
> C code , i can start with the main(), but how can i read gef project?
> even i have the source code now , i still have no idea how it works,
> what's the main step to construct a graphic editor. if u know the answer,
> please let me know, any help from u will be greatly appreciated.
> private ActivityDiagram createWakeupModel() {
> ActivityDiagram diagram = new ActivityDiagram();
> SequentialActivity wakeup = new SequentialActivity();
> Activity backToSleep = new Activity("Go back to sleep");
> Activity turnOff = new Activity("Turn off alarm");
> wakeup.setName("Wake up");
> wakeup.addChild(new Activity("Hit snooze button"));
> wakeup.addChild(backToSleep);
> wakeup.addChild(turnOff);
> wakeup.addChild(new Activity("Get out of bed"));
> diagram.addChild(wakeup);
>
> SequentialActivity bathroom = new SequentialActivity();
> bathroom.addChild(new Activity("Brush teeth"));
> bathroom.addChild(new Activity("Take shower"));
> bathroom.addChild(new Activity("Comb hair"));
> bathroom.setName("Bathroom activities");
> diagram.addChild(bathroom);
>
> ParallelActivity relaxation = new ParallelActivity();
> relaxation.addChild(new Activity("Watch cartoons"));
> relaxation.addChild(new Activity("Power Yoga"));
> relaxation.setName("Morning relaxation ritual");
> diagram.addChild(relaxation);
>
> Activity sleep, alarm, alarm2, clothes, spare, no, yes, drive;
> diagram.addChild(sleep = new Activity("Sleep....."));
> diagram.addChild(alarm = new Activity("Alarm!!!"));
> diagram.addChild(alarm2 = new Activity("Alarm!!!"));
> diagram.addChild(clothes = new Activity("Put on clothes"));
> diagram.addChild(spare = new Activity("Is there time to spare?"));
> diagram.addChild(yes = new Activity("YES"));
> diagram.addChild(no = new Activity("NO"));
> diagram.addChild(drive = new Activity("Drive to work"));
>
> new Transition(sleep, alarm);
> new Transition(alarm, wakeup);
> new Transition(backToSleep,alarm2);
> new Transition(alarm2,turnOff);
> new Transition(wakeup, bathroom);
> new Transition(bathroom, clothes);
> new Transition(clothes, spare);
> new Transition(spare, yes);
> new Transition(spare, no);
> new Transition(yes, relaxation);
> new Transition(no, drive);
> new Transition(relaxation, drive);
> return diagram;
> }
>
>
Previous Topic:How to paint all Figures at once?
Next Topic:Layout managers
Goto Forum:
  


Current Time: Thu Sep 26 11:18:31 GMT 2024

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

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

Back to the top