Re: XulManager createInternalWindow(String) method

denis cardon <[email protected]>
Newsgroups gmane.comp.java.luxor-xul.user
Message-ID <[email protected]>
Hi Gerald,

>   Of course, I'm more than interested in adding your
> stuff for MDI apps.

You'll find the patch in attachment (created using
luxor b8 with diff -aur).
In fact I made the change while creating a small GUI
front end for luxilla in order to help a friend
getting to know xul. I'll post the changes as soon as
I'll get time to package it.
 
>   I'm currently finishing up the next release (Beta
> 9). 

great!
 
>   To make it easier to contribute I will use Beta 9
> as
> a base and upload it into the cvs repository so you
> can commit your changes directly without going
> through
> me.
>   I hope to get the cvs repository up and running in
> about two weeks.

cool! There will surely be much more contributions
since they will quickly be available in the main
branch (AFAIA concerned I am reluctant at making
patches if there is no CVS for I hate branching and
merging...)
 
> PS: Sorry for dragging out the CVS stuff for so
> long,
> but I had hoped to use Subversion/HTTP-WEBDAV
> instead.

I also wanted to set up a subversion versioning system
in house but eclipse integration with CVS is too
great, so I gave up...

Cheers,

Denis


=====
=========================
|Denis Cardon, Tranquil I.T. Systems 
|10 rue du Docteur Bouchard, 49400 Saumur
|Tel: +33(0)2.41.67.56.99
|Web: http://www.tranquil-it-systems.fr
=========================

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
internalframe.patch (application/octet-stream, 3.7 KB)
Seulement dans .: build.properties
Seulement dans .: build.xml
Seulement dans .: internalframe.patch
Seulement dans .: lib.properties
diff -aur ./luxor/core/window/WindowDef.java ../../../../projects/luxilla/src-luxor/luxor/core/window/WindowDef.java
--- ./luxor/core/window/WindowDef.java	2003-01-08 14:47:42.000000000 +0100
+++ ../../../../projects/luxilla/src-luxor/luxor/core/window/WindowDef.java	2003-06-12 18:12:37.000000000 +0200
@@ -142,4 +142,76 @@
 
       return frame;
    }
+   
+   public JInternalFrame createInternalWindow( XulContext ctx )
+   {
+	  JInternalFrame frame = new JInternalFrame();
+	  frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
+
+	  int width = getWidth( 640 );
+	  int height = getHeight( 400 );
+
+	  frame.setSize( width, height );
+
+	  String title = getAttribute( Xul.Attribute.TITLE );
+	  if( title != null )
+		 frame.setTitle( title );
+
+	  ImageIcon icon = getIcon( ctx );
+	  if( icon != null ){}
+		 //frame.setIconImage( icon.getImage() );
+	  if( _menuBarDef != null )
+	  {
+		 JMenuBar menuBar = _menuBarDef.createMenuBar( ctx );
+		 frame.setJMenuBar( menuBar );
+	  }
+
+	  Container content;
+
+	  if( _statusBarDef != null )
+	  {
+		 content = new JPanel();
+
+		 frame.getContentPane().setLayout( new BorderLayout() );
+		 frame.getContentPane().add( content, BorderLayout.CENTER );
+		 frame.getContentPane().add( _statusBarDef.createStatusBar( ctx ), BorderLayout.SOUTH );
+	  }
+	  else
+		 content = frame.getContentPane();
+
+	  content.setLayout( new BoxLayout( content, BoxLayout.Y_AXIS ) );
+
+	  for( Iterator it = _componentDef.iterator(); it.hasNext();  )
+	  {
+		 NComponentFactory compFactory = ( NComponentFactory ) it.next();
+		 NComponent comp = compFactory.createNComponent( XulManager.NULL_JCOMPONENT_RESOLVER, ctx );
+
+		 content.add( comp.getJComponent() );
+	  }
+
+	  String sizemode = getAttribute( Xul.Attribute.SIZEMODE );
+	  if( sizemode != null )
+	  {
+		 if( sizemode.equals( "maximized" ) )
+		 {
+			T.debug( "set window sizemode to maximized" );
+			//frame.setExtendedState( Frame.MAXIMIZED_BOTH );
+		 }
+		 else if( sizemode.equals( "minimized" ) )
+		 {
+			T.debug( "set window sizemode to minimized" );
+			//frame.setExtendedState( Frame.ICONIFIED );
+		 }
+		 else if( sizemode.equals( "normal" ) )
+		 {
+			// do nothing; normal is default
+		 }
+		 else
+		 {
+			Xul.SyntaxError.UNKNOWN_ATTRIBUTE_VALUE( sizemode, Xul.Attribute.SIZEMODE );
+		 }
+	  }
+
+	  return frame;
+   }
 }
diff -aur ./luxor/XulManager.java ../../../../projects/luxilla/src-luxor/luxor/XulManager.java
--- ./luxor/XulManager.java	2003-01-08 14:48:06.000000000 +0100
+++ ../../../../projects/luxilla/src-luxor/luxor/XulManager.java	2003-06-12 15:06:15.000000000 +0200
@@ -375,6 +375,16 @@
       // todo: throw exception if frame is null
       return frame;
    }
+   
+   public JInternalFrame createInternalWindow( String key )
+   {
+	  // todo: as a convention createXXX throws an exception
+	  //        lookupXXX returns null, but throws no exceptions
+
+	  JInternalFrame frame = lookupInternalWindow( key );
+	  // todo: throw exception if frame is null
+	  return frame;
+   }
 
    public void load()
    {
@@ -646,6 +656,18 @@
 
       return def.createWindow( this );
    }
+   
+   public JInternalFrame lookupInternalWindow( String key )
+   {
+	  WindowDef def = _defMap.lookupWindowDef( key );
+	  if( def == null )
+	  {
+		 Xul.Error.REFERENCE_NOT_FOUND( "window", key );
+		 return null;
+	  }
+
+	  return def.createInternalWindow( this );
+   }
 
    public static class NullJComponentResolver implements JComponentResolver
    {
Seulement dans .: VM_global_library.vm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.