Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » No tabbed view with SWING
No tabbed view with SWING [message #1107493] Thu, 12 September 2013 13:40 Go to next message
daniele fochetti is currently offline daniele fochettiFriend
Messages: 22
Registered: August 2013
Junior Member
Hi all

Our application shows multiple forms within the main application window. See attachment.
The forms are defined with DISPLAY_HINT_VIEW.
The SWT client shows all forms with tabs so the user can switch between the showed forms.
The same works if the client is shown as RAP client.

Unfortunately this behavior is not reflected by SWING. The SWING client only shows one form, if 'opening' a new form, the former form will be coverd by the new one.

Does anyone have a hint, to get SWING presenting forms with DISPLAY_HINT_VIEW the same way as they are presented with SWT and RAP client?

THX
Daniele
Re: No tabbed view with SWING [message #1112380 is a reply to message #1107493] Thu, 19 September 2013 15:39 Go to previous messageGo to next message
Ken Lee is currently offline Ken LeeFriend
Messages: 97
Registered: March 2012
Member
Hi Daniele,

To give you a short answer to your question first, the current implementation does not support multiple tabbed views in Swing. However, I think it should be possible to add such an extension.

Background information:
The Scout desktop is divided into a 3x3 matrix, each cell in the matrix is able to display one (or more in SWT / RAP) view(s). The location of a view can be addressed with a view id like North, South, East, West, Center, North-East, etc.
In your SWT project the views are configured by default to allow multiple instances of a view (see plugin.xml -> extensions -> org.eclipse.ui.views).

In Swing however, the concepts are a bit different: The desktop is divided into a 3x3 matrix, too. If you configure your form to be displayed as a view (DISPLAY_HINT_VIEW), the AbstractSwingEnvironment will create a SwingScoutInternalFrame (cf. method AbstractSwingEnvironment.createInternalFrame) that allocates a JInternalFrame as a UI element. The JInternalFrame is then added to the JDesktopPane (see method SwingScoutInternalFrame.openView).

To be able to have multiple tabbed views, I suggest to introduce a new layer, i.e. instead of adding the JInternalFrame directly to the JDesktopPane, you should create a JTabbedPane first and add the JInternalFrame to the JTabbedPane. The JTabbedPane is then attached to the JDesktopPane.

A simple Swing example:

public class SwingTabbedPaneExample {
  public static void main( String[] arg ) {
    JDesktopPane desktop = new JDesktopPane();

    JInternalFrame internalFrame1 = new JInternalFrame( "Internal Frame 1", true, true, true, true );
    internalFrame1.setSize(200, 200);
    internalFrame1.setVisible(true);
    desktop.add(internalFrame1);

    JInternalFrame internalFrame2 = new JInternalFrame( "Internal Frame 2", true, true, true, true );
    internalFrame2.setSize(200, 200);
    internalFrame2.setVisible(true);
    desktop.add(internalFrame2);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("First Frame", internalFrame1);
    tabbedPane.add("Second Frame", internalFrame2);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(tabbedPane);
    frame.setSize(300, 300);
    frame.setVisible(true);
  }
}


This may only be done if another Scout form is already displayed in the same view / matrix cell. So you probably need keeping track of that.
Re: No tabbed view with SWING [message #1112907 is a reply to message #1112380] Fri, 20 September 2013 10:44 Go to previous message
daniele fochetti is currently offline daniele fochettiFriend
Messages: 22
Registered: August 2013
Junior Member
Hi Ken

Thank you very much for your explanation.

Best regards
Daniele
Previous Topic:scout - 3.9 - desktop node not showing
Next Topic:SWT setInitialSize has no effect
Goto Forum:
  


Current Time: Tue Apr 23 11:14:46 GMT 2024

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

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

Back to the top