List Info

Thread: Re: Transient menu changes are too transient




Re: Transient menu changes are too transient
user name
2007-09-11 09:28:07
Tobias Krais wrote:
> Hi together,
> 
> one year ago I implemented some additional menu items
for OOo menus in
> Java. I added these items transient. But now we
discovered that they are
> too transient for us: when opening a document, the menu
items are added.
> When changing the document into "Page view"
mode (German:
> "Seitenansicht") the transient menu items are
gone and discover no more
> until starting the same procedure again.
> 
> My question: is this behaviour a bug? Shouldn't the
transient menu item
> remain when switching the view?
> 
> If this is not a bug, how can I discover when I have to
re-add the item?
> 
Hi Tobias,

This is not a bug but how the OpenOffice.org framework
works. The 
controller will be removed from the frame and another
controller is 
attached. The layout manager which controls the user
interface elements 
has to destroy all element when a controller is detached.
Your transient 
changes are only stored within this user interface element
(menu bar), 
which gets destroyed.
Solution: You have to implement a 
com.sun.star.frame.XFrameActionListener which must be
registered at the 
frame. Whenever you receive the event
FrameAction_COMPONENT_ATTACHED you 
have to make the transient changes again. Please be aware
that the frame 
can be recycled and another document (even from another
application 
module) can be associated with the frame. So you should
verify that you 
want to make changes to this frame.

Regards,
Carsten

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Transient menu changes are too transient
user name
2007-09-11 09:45:21
Hi Carsten,

> This is not a bug but how the OpenOffice.org framework
works. The
> controller will be removed from the frame and another
controller is
> attached. The layout manager which controls the user
interface elements
> has to destroy all element when a controller is
detached. Your transient
> changes are only stored within this user interface
element (menu bar),
> which gets destroyed.
> Solution: You have to implement a
> com.sun.star.frame.XFrameActionListener which must be
registered at the
> frame. Whenever you receive the event
FrameAction_COMPONENT_ATTACHED you
> have to make the transient changes again. Please be
aware that the frame
> can be recycled and another document (even from another
application
> module) can be associated with the frame. So you should
verify that you
> want to make changes to this frame.

thank you for your explanation. I have to think about it.
May be we give
up the transient idea.

Greetings, Tobias

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Transient menu changes are too transient
user name
2007-09-18 07:14:03
Hi Carsten,

at the moment I am implementing you solution:

> Solution: You have to implement a
> com.sun.star.frame.XFrameActionListener which must be
registered at the
> frame. Whenever you receive the event
FrameAction_COMPONENT_ATTACHED you
> have to make the transient changes again.

Changing to Page view mode gives me the following actions:
COMPONENT_DETACHING
COMPONENT_REATTACHED
CONTEXT_CHANGED

Changing back these actions:
CONTEXT_CHANGED
COMPONENT_DETACHING
COMPONENT_REATTACHED

I think the COMPONENT_REATTACHED is the proper place to
change the menus
again.

> Please be aware that the frame
> can be recycled and another document (even from another
application
> module) can be associated with the frame. So you should
verify that you
> want to make changes to this frame.

Is this still necessary, if the component is just
reattached? If yes,
how can I verify that this is the proper frame?

Greetings, Tobias

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )