Home » Eclipse Projects » GEF » show/hide all editparts of a given type
|
Re: show/hide all editparts of a given type [message #187930 is a reply to message #187905] |
Mon, 18 July 2005 05:21 |
Dazhen Gao Messages: 21 Registered: July 2009 |
Junior Member |
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0040_01C58B9B.8BCEE130
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You have a base class extends Figure?
if you don't have, I suggest you set up it.
The you can extends the paintChildren(Graphics graphics) method
protected void paintChildren(Graphics graphics) {
IFigure child;
=20
Rectangle clip =3D Rectangle.SINGLETON;
for (int i =3D 0; i < children.size(); i++) {
child =3D (IFigure)children.get(i);
if (child.isVisible() && child.intersects(graphics.getClip(clip))) {
graphics.clipRect(child.getBounds());
child.paint(graphics);
graphics.restoreState();
}
}
modify the condition ( if (child.isVisible() && =
child.intersects(graphics.getClip(clip))) ) add your logic.
=20
Is it doable?
"Jason Grant" <junk@logular.com> wrote in message =
news:pan.2005.07.17.12.17.51.14151@logular.com...
> I'd like to introduce an action that allows the user to hide all =
EditParts
> of a particular type. To do this, the action will manipulate a single
> boolean field in my model.
>=20
> I'm unsure of the best way to make the corresponding figures =
invisible,
> based on this field. One technique that comes to mind is to affect =
the
> parent/child EditPart relationship, based on the status of the field.
> When the parts are invisible, they would not appear as children of the
> parent part. That seems like a hack to me.
>=20
> Another approach would be to iterate over all relevant EditParts
> when the field is altered, and call =
part.getFigure().setVisible(false).=20
> Not sure how well this will work in my UI, since I anticipate that =
there
> will be hundreds of EditParts in the diagram.
>=20
> I'm wondering if there might be a better alternative: e.g. would it be
> better (possible) to put the figures on a custom layer whose =
visibility
> could be toggled easily?
>=20
> Suggestions appreciated.
>=20
> Jason.
------=_NextPart_000_0040_01C58B9B.8BCEE130
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">You have a base class =
extends=20
Figure?<?xml:namespace prefix =3D o ns =3D =
"urn:schemas-microsoft-com:office:office"=20
/><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">if you don't have, I=20
suggest you set up it.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">The you can extends =
the=20
paintChildren(Graphics graphics) method<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">protected void=20
paintChildren(Graphics graphics) {<BR> IFigure =
child;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"> Rectangle clip =
=3D=20
Rectangle.SINGLETON;<BR> for (int i =3D 0; i < children.size(); =
i++)=20
{<BR> child =3D (IFigure)children.get(i);<BR> if=20
(child.isVisible() && child.intersects(graphics.getClip(clip)))=20
{<BR> graphics.clipRect(child.getBou nds()); <BR> &nb=
sp; child.paint(graphics);<BR> graphics.restoreStat=
e();<BR> }<BR> }<o:p></o:p ></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">modify the condition =
( if=20
(child.isVisible() && child.intersects(graphics.getClip(clip))) =
) add=20
your logic.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Is it =
doable?<o:p></o:p></P><FONT=20
face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3></FONT></DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>"Jason Grant" <<A=20
href=3D"mailto:junk@logular.com">junk@logular.com</A>> wrote in =
message <A=20
href=3D"news:pan.2005.07.17.12.17.51.14151@logular.com">news:pan.2005.07.=
17.12.17.51.14151@logular.com</A>...</DIV>>=20
I'd like to introduce an action that allows the user to hide all=20
EditParts<BR>> of a particular type. To do this, the action =
will=20
manipulate a single<BR>> boolean field in my model.<BR>> <BR>> =
I'm=20
unsure of the best way to make the corresponding figures =
invisible,<BR>>=20
based on this field. One technique that comes to mind is to affect =
the<BR>> parent/child EditPart relationship, based on the status of =
the=20
field.<BR>> When the parts are invisible, they would not appear as =
children=20
of the<BR>> parent part. That seems like a hack to me.<BR>> =
<BR>>=20
Another approach would be to iterate over all relevant EditParts<BR>> =
when=20
the field is altered, and call part.getFigure().setVisible(false). =
<BR>> Not=20
sure how well this will work in my UI, since I anticipate that =
there<BR>>=20
will be hundreds of EditParts in the diagram.<BR>> <BR>> I'm =
wondering if=20
there might be a better alternative: e.g. would it be<BR>> better =
(possible)=20
to put the figures on a custom layer whose visibility<BR>> could be =
toggled=20
easily?<BR>> <BR>> Suggestions appreciated.<BR>> <BR>>=20
Jason.</BODY></HTML>
------=_NextPart_000_0040_01C58B9B.8BCEE130--
|
|
|
Re: show/hide all editparts of a given type [message #187977 is a reply to message #187905] |
Mon, 18 July 2005 14:26 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
Layers are figures, so a separate layers for the figures of those editparts
is not feasible. The other two approaches that you mentioned are both fine.
Keep in mind that if you go the route of modifying the parent-child
relationship, editparts will be deactivated and junked. When they're made
visible again, brand new parts will be created. That could get expensive if
you have a lot of parts, and the visibility is toggled often.
"Jason Grant" <junk@logular.com> wrote in message
news:pan.2005.07.17.12.17.51.14151@logular.com...
> I'd like to introduce an action that allows the user to hide all EditParts
> of a particular type. To do this, the action will manipulate a single
> boolean field in my model.
>
> I'm unsure of the best way to make the corresponding figures invisible,
> based on this field. One technique that comes to mind is to affect the
> parent/child EditPart relationship, based on the status of the field.
> When the parts are invisible, they would not appear as children of the
> parent part. That seems like a hack to me.
>
> Another approach would be to iterate over all relevant EditParts
> when the field is altered, and call part.getFigure().setVisible(false).
> Not sure how well this will work in my UI, since I anticipate that there
> will be hundreds of EditParts in the diagram.
>
> I'm wondering if there might be a better alternative: e.g. would it be
> better (possible) to put the figures on a custom layer whose visibility
> could be toggled easily?
>
> Suggestions appreciated.
>
> Jason.
|
|
|
Re: show/hide all editparts of a given type [message #188110 is a reply to message #187930] |
Tue, 19 July 2005 01:54 |
Dazhen Gao Messages: 21 Registered: July 2009 |
Junior Member |
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0119_01C58C47.EC9E9670
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
My way has a problem:
Thought the figure don't paint but they can select by mouse.<S>
But it can resolved (two method
1: overwrite the ScrollingGraphicalViewer method =
findObjectAtExcluding(Point pt,
Collection exclude,
final Conditional condition), in this method have a inner class =
ConditionalTreeSearch, rewrite it.
2: overwrite the figure isVisible()(dangers?)
=20
Is it doable?
"gao" <dgao@actuate.com> wrote in message =
news:dbfe85$g9b$1@news.eclipse.org...
You have a base class extends Figure?
if you don't have, I suggest you set up it.
The you can extends the paintChildren(Graphics graphics) method
protected void paintChildren(Graphics graphics) {
IFigure child;
=20
Rectangle clip =3D Rectangle.SINGLETON;
for (int i =3D 0; i < children.size(); i++) {
child =3D (IFigure)children.get(i);
if (child.isVisible() && child.intersects(graphics.getClip(clip))) {
graphics.clipRect(child.getBounds());
child.paint(graphics);
graphics.restoreState();
}
}
modify the condition ( if (child.isVisible() && =
child.intersects(graphics.getClip(clip))) ) add your logic.
=20
Is it doable?
"Jason Grant" <junk@logular.com> wrote in message =
news:pan.2005.07.17.12.17.51.14151@logular.com...
> I'd like to introduce an action that allows the user to hide all =
EditParts
> of a particular type. To do this, the action will manipulate a =
single
> boolean field in my model.
>=20
> I'm unsure of the best way to make the corresponding figures =
invisible,
> based on this field. One technique that comes to mind is to affect =
the
> parent/child EditPart relationship, based on the status of the =
field.
> When the parts are invisible, they would not appear as children of =
the
> parent part. That seems like a hack to me.
>=20
> Another approach would be to iterate over all relevant EditParts
> when the field is altered, and call =
part.getFigure().setVisible(false).=20
> Not sure how well this will work in my UI, since I anticipate that =
there
> will be hundreds of EditParts in the diagram.
>=20
> I'm wondering if there might be a better alternative: e.g. would it =
be
> better (possible) to put the figures on a custom layer whose =
visibility
> could be toggled easily?
>=20
> Suggestions appreciated.
>=20
> Jason.
------=_NextPart_000_0119_01C58C47.EC9E9670
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o =3D "urn:schemas-microsoft-com:office:office"><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">My way has a=20
problem:</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thought the figure don't =
paint but=20
they can select by mouse.<S></SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">But it can resolved =
(two=20
method</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">1: overwrite=20
the ScrollingGraphicalViewer method findObjectAtExcluding(Point=20
pt,<BR> Collection exclude,<BR> final Conditional =
condition), in=20
this method have a inner class ConditionalTreeSearch, rewrite=20
it.</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">2: overwrite the figure=20
isVisible()(dangers?)</SPAN><o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><FONT size=3D3><FONT=20
face=3D"Times New Roman"> <o:p></o:p></FONT></FONT></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Is it=20
doable?</SPAN><o:p></o:p></P></FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"gao" <<A =
href=3D"mailto:dgao@actuate.com">dgao@actuate.com</A>>=20
wrote in message <A=20
=
href=3D"news:dbfe85$g9b$1@news.eclipse.org">news:dbfe85$g9b$1@news.eclips=
e.org</A>...</DIV>
<DIV>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">You have a base =
class extends=20
Figure?<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">if you don't have, =
I=20
suggest you set up it.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">The you can extends =
the=20
paintChildren(Graphics graphics) method<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">protected void=20
paintChildren(Graphics graphics) {<BR> IFigure =
child;<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in =
0pt"> <o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"> Rectangle =
clip =3D=20
Rectangle.SINGLETON;<BR> for (int i =3D 0; i < =
children.size(); i++)=20
{<BR> child =3D (IFigure)children.get(i);<BR> if =
(child.isVisible() && =
child.intersects(graphics.getClip(clip)))=20
=
{<BR> graphics.clipRect(child.getBou nds()); <BR> &nb=
sp; child.paint(graphics);<BR> graphics.restoreStat=
e();<BR> }<BR> }<o:p></o:p ></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">modify the =
condition ( if=20
(child.isVisible() && =
child.intersects(graphics.getClip(clip))) ) add=20
your logic.<o:p></o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in =
0pt"><o:p> </o:p></P>
<P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt">Is it=20
doable?<o:p></o:p></P><FONT face=3DArial size=3D2><FONT face=3D"Times =
New Roman"=20
size=3D3></FONT></DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>"Jason Grant" <<A=20
href=3D"mailto:junk@logular.com">junk@logular.com</A>> wrote in =
message <A=20
=
href=3D"news:pan.2005.07.17.12.17.51.14151@logular.com">news:pan.2005.07.=
17.12.17.51.14151@logular.com</A>...</DIV>>=20
I'd like to introduce an action that allows the user to hide all=20
EditParts<BR>> of a particular type. To do this, the action =
will=20
manipulate a single<BR>> boolean field in my model.<BR>> =
<BR>> I'm=20
unsure of the best way to make the corresponding figures =
invisible,<BR>>=20
based on this field. One technique that comes to mind is to =
affect=20
the<BR>> parent/child EditPart relationship, based on the status of =
the=20
field.<BR>> When the parts are invisible, they would not appear as =
children=20
of the<BR>> parent part. That seems like a hack to =
me.<BR>>=20
<BR>> Another approach would be to iterate over all relevant=20
EditParts<BR>> when the field is altered, and call=20
part.getFigure().setVisible(false). <BR>> Not sure how well this =
will work=20
in my UI, since I anticipate that there<BR>> will be hundreds of =
EditParts=20
in the diagram.<BR>> <BR>> I'm wondering if there might be a =
better=20
alternative: e.g. would it be<BR>> better (possible) to put the =
figures on=20
a custom layer whose visibility<BR>> could be toggled =
easily?<BR>>=20
<BR>> Suggestions appreciated.<BR>> <BR>> Jason.=20
</BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0119_01C58C47.EC9E9670--
|
|
|
Goto Forum:
Current Time: Tue Dec 10 16:06:21 GMT 2024
Powered by FUDForum. Page generated in 0.04844 seconds
|