Board index » jbuilder » CustomTab in MessageView

CustomTab in MessageView


2003-11-13 08:10:23 AM
jbuilder0
Hi there:
I create my own class extended from JComponent, this class has a
BorderLayout. At the north i put a JLabel, at the south a JButton and int
the center a JScrollPane + MessageViewTree (generated by
messageView.createMessageViewTree( ... )). Then I implement all the method
of the interface MessageViewTree.
For example:
...
public void addMessages(Message[] messageArray, boolean boolean1) {
mvt.addMessages(messageArray, boolean1);
// where mvt is the MessageViewTree generaded by
messageView.createMessageViewTree( ... )
}
...
Then i do the following:
MyCustomTab mct = new MyCustomTab();
messageView.addCustomTab( messageCategory, mct );
mct.addMessage(..., ...);
This work perfect... but if I do the following:
MyCustomTab mct = new MyCustomTab();
messageView.addCustomTab( messageCategory, mct );
messageView.addMessage(..., ...);
This replace my custom tab with the general tab of the messageView...
Why the messageView.addMessage(..., ...) method do this if my class
implements the MessageViewTree interface?
What I am doing wrong?
THANKS
TMM
 
 

Re:CustomTab in MessageView

Call the addMessage() through the MessageViewTree interface,
not indirectly through MessageView.
I suppose when you add a custom component, MessageView could
run through the component hierarchy (probably your tree is
inside a JScrollPane, right?) and remember the first
instance (if any) of MessageViewTree it runs across. Then
later it could redirect calls to addMessage() through that
interface.
However it does not do that currently. If it is a custom
component then you need to mantain it yourself.
"Teimatini Marin" < XXXX@XXXXX.COM >wrote in
message news:3fb2cca8$ XXXX@XXXXX.COM ...
Hi there:
I create my own class extended from JComponent, this class
has a
BorderLayout. At the north i put a JLabel, at the south a
JButton and int
the center a JScrollPane + MessageViewTree (generated by
messageView.createMessageViewTree( ... )). Then I implement
all the method
of the interface MessageViewTree.
For example:
...
public void addMessages(Message[] messageArray, boolean
boolean1) {
mvt.addMessages(messageArray, boolean1);
// where mvt is the MessageViewTree generaded by
messageView.createMessageViewTree( ... )
}
...
Then i do the following:
MyCustomTab mct = new MyCustomTab();
messageView.addCustomTab( messageCategory, mct );
mct.addMessage(..., ...);
This work perfect... but if I do the following:
MyCustomTab mct = new MyCustomTab();
messageView.addCustomTab( messageCategory, mct );
messageView.addMessage(..., ...);
This replace my custom tab with the general tab of the
messageView...
Why the messageView.addMessage(..., ...) method do this if
my class
implements the MessageViewTree interface?
What I am doing wrong?
THANKS
TMM