Emulate Tab Panel in GEF [message #58065] |
Sat, 25 January 2003 16:21  |
Eclipse User |
|
|
|
Originally posted by: truenoto.yahoo.com
I am trying to emulate a tab panel in GEF. So I create a Figure based on
CircuitFigure in the Logic Editor Example. In that figure, it has a button
and 2 scroll Panes, when you click the button, it removes the current
visiblePane and add the invisiblePane.
I am able to add figure (e.g. or gate/and gate) to the inital visible Pane,
but after I click the button (which switch the visible pane), I can't add
figure to new visible pane.
Could someone please tell me I am missing anything? I don't think I can use
the SWT's TabFolder because I want to drag my draw2d Figures to my "tab"
panel.
Thank you for any help.
============================================================ ==
private ScrollPane visiblePane;
private ScrollPane invisiblePane;
public MyFigure() {
pane = new FreeformLayer();
pane.setLayoutManager(new FreeformLayout());
setLayoutManager(new FlowLayout());
ScrollPane scrollpane1 = new MyScrollPane();
scrollpane1.setViewport(new FreeformViewport());
scrollpane1.setView(pane);
visiblePane = scrollpane1;
ScrollPane scrollpane2 = new MyScrollPane();
scrollpane2.setViewport(new FreeformViewport());
scrollpane2.setView(pane);
invisiblePane = scrollpane2;
setBackgroundColor(ColorConstants.buttonLightest);
setOpaque(true);
Clickable button = new Button("switch");
button.setBounds(new Rectangle(30, 250, 140, 35));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
switchPanel();
}
});
add(visiblePane);
add(button);
}
private void switchPanel() {
remove(visiblePane);
ScrollPane temp = visiblePane;
visiblePane = invisiblePane;
invisiblePane = temp;
add(visiblePane);
}
|
|
|
Re: Emulate Tab Panel in GEF [message #58091 is a reply to message #58065] |
Sat, 25 January 2003 18:00  |
Eclipse User |
|
|
|
Originally posted by: truenoto.yahoo.com
another thing I try is switch to use StackLayout to layout the 2 panels and
the button on top of each other and then when the button is clicked, I
changed the order of the children so that the original invisible panel will
appear on top of the visible panel. But that does not work either. I still
can't add figures to the panel with it becomes visible.
Basically here is what I want to do:
have 2 panels, both I can add draw2d figures to it (by drag/drop), however,
only 1 is visible at a time, so I can stack them up together (kind of like a
tab panel). And there is a button which whenever it is clicked, the
"visible/active" panel will swtich.
I appreciate if anyone can help me.
public MyFigure() {
pane = new FreeformLayer();
pane.setLayoutManager(new FreeformLayout());
setLayoutManager(new MyStackLayout());
ScrollPane scrollpane1 = new MyScrollPane();
scrollpane1.setViewport(new FreeformViewport());
scrollpane1.setView(pane);
scrollpane1.setOpaque(false);
visiblePane = scrollpane1;
ScrollPane scrollpane2 = new MyScrollPane();
scrollpane2.setViewport(new FreeformViewport());
scrollpane2.setView(pane);
scrollpane1.setOpaque(false);
invisiblePane = scrollpane2;
button = new Button("switch");
button.setBounds(new Rectangle(0, 10, 10, 15));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
switchPanel();
}
});
add(button);
add(visiblePane);
}
private void switchPanel() {
remove(button);
remove(visiblePane);
ScrollPane temp = visiblePane;
visiblePane = invisiblePane;
invisiblePane = temp;
add(button);
add(visiblePane);
}
"Takumi Fujiwara" <truenoto@yahoo.com> wrote in message
news:b0utvo$v0r$1@rogue.oti.com...
> I am trying to emulate a tab panel in GEF. So I create a Figure based on
> CircuitFigure in the Logic Editor Example. In that figure, it has a button
> and 2 scroll Panes, when you click the button, it removes the current
> visiblePane and add the invisiblePane.
>
> I am able to add figure (e.g. or gate/and gate) to the inital visible
Pane,
> but after I click the button (which switch the visible pane), I can't add
> figure to new visible pane.
>
> Could someone please tell me I am missing anything? I don't think I can
use
> the SWT's TabFolder because I want to drag my draw2d Figures to my "tab"
> panel.
>
> Thank you for any help.
>
> ============================================================ ==
>
> private ScrollPane visiblePane;
>
> private ScrollPane invisiblePane;
>
> public MyFigure() {
>
> pane = new FreeformLayer();
>
> pane.setLayoutManager(new FreeformLayout());
>
> setLayoutManager(new FlowLayout());
>
> ScrollPane scrollpane1 = new MyScrollPane();
>
> scrollpane1.setViewport(new FreeformViewport());
>
> scrollpane1.setView(pane);
>
> visiblePane = scrollpane1;
>
> ScrollPane scrollpane2 = new MyScrollPane();
>
> scrollpane2.setViewport(new FreeformViewport());
>
> scrollpane2.setView(pane);
>
> invisiblePane = scrollpane2;
>
> setBackgroundColor(ColorConstants.buttonLightest);
>
> setOpaque(true);
>
> Clickable button = new Button("switch");
>
> button.setBounds(new Rectangle(30, 250, 140, 35));
>
> button.addActionListener(new ActionListener() {
>
> public void actionPerformed(ActionEvent e) {
>
> switchPanel();
>
> }
>
> });
>
> add(visiblePane);
>
> add(button);
>
> }
>
> private void switchPanel() {
>
> remove(visiblePane);
>
> ScrollPane temp = visiblePane;
>
> visiblePane = invisiblePane;
>
> invisiblePane = temp;
>
> add(visiblePane);
>
> }
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03722 seconds