[jboss-svn-commits] JBL Code SVN: r35096 - in labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor: client/modeldriven/ui and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Sep 10 03:36:17 EDT 2010


Author: Rikkola
Date: 2010-09-10 03:36:16 -0400 (Fri, 10 Sep 2010)
New Revision: 35096

Added:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.ui.xml
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor_DecoratedPopupPanel.css
Modified:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ErrorPopup.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStyleLayout.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStylePopup.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ImageButton.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleTemplateEditor.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/PackageBuilderWidget.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/VersionBrowser.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.html
Log:
GUVNOR-599 : Replace gwtext codes used by Popup related widgets
-Formstyle popup

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ErrorPopup.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ErrorPopup.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ErrorPopup.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -1,20 +1,3 @@
-/**
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.guvnor.client.common;
 /*
  * Copyright 2005 JBoss Inc
  *
@@ -31,8 +14,8 @@
  * limitations under the License.
  */
 
+package org.drools.guvnor.client.common;
 
-
 import org.drools.guvnor.client.messages.Constants;
 import org.drools.guvnor.client.rpc.DetailedSerializationException;
 
@@ -50,58 +33,44 @@
 import com.gwtext.client.widgets.event.WindowListenerAdapter;
 import com.gwtext.client.widgets.layout.VerticalLayout;
 
-
 /**
  * Generic error dialog popup.
  */
-public class ErrorPopup  {
+public class ErrorPopup {
 
-    public static ErrorPopup instance = null;
-    private Constants constants = ((Constants) GWT.create(Constants.class));
-    private VerticalPanel body;
-    //new Image("images/error_dialog.png")
+    public static ErrorPopup instance  = null;
+    private Constants        constants = ((Constants) GWT.create( Constants.class ));
+    private VerticalPanel    body;
 
+    private ErrorPopup(String message,
+                       String longMessage) {
 
+        Window w = new Window();
+        w.setTitle( constants.Error() );
+        w.setWidth( 400 );
+        w.setModal( true );
+        w.setShadow( true );
+        w.setClosable( true );
+        w.setPlain( true );
 
-    private ErrorPopup(String message, String longMessage) {
-
-    	Window w = new Window();
-    	w.setTitle(constants.Error());
-    	w.setWidth(400);
-    	//w.setHeight((longMessage != null) ? 300 : 150);
-    	w.setModal(true);
-    	w.setShadow(true);
-    	w.setClosable(true);
-    	w.setPlain(true);
-
-    	w.setLayout(new VerticalLayout());
+        w.setLayout( new VerticalLayout() );
         body = new VerticalPanel();
 
+        addMessage( message,
+                    longMessage );
 
-        addMessage(message, longMessage);
+        body.setWidth( "100%" );
+        w.add( body );
 
-        body.setWidth("100%");
-        w.add(body);
-
-
-        
-
         w.show();
 
-
-        w.addListener(new WindowListenerAdapter() {
+        w.addListener( new WindowListenerAdapter() {
             @Override
             public void onDeactivate(Window window) {
                 instance = null;
             }
-        });
+        } );
 
-
-
-        
-
-
-
     }
 
     private void addMessage(String message, String longMessage) {
@@ -114,42 +83,43 @@
         final String longDescription = longMessage;
 
         HorizontalPanel hp = new HorizontalPanel();
-        hp.add(new Image("images/validation_error.gif"));
-        Label msg = new Label(message);
-        msg.setStyleName("error-title");
-        hp.add(msg);
-        body.add(hp);
+        hp.add( new Image( "images/validation_error.gif" ) );
+        Label msg = new Label( message );
+        msg.setStyleName( "error-title" );
+        hp.add( msg );
+        body.add( hp );
 
-
         final SimplePanel detailPanel = new SimplePanel();
-        if (longMessage != null && !"".equals(longMessage)) {
-	        Button showD = new Button(constants.ShowDetail());
-	        showD.addListener(new ButtonListenerAdapter() {
-				public void onClick(Button button, EventObject e) {
-					detailPanel.clear();
+        if ( longMessage != null && !"".equals( longMessage ) ) {
+            Button showD = new Button( constants.ShowDetail() );
+            showD.addListener( new ButtonListenerAdapter() {
+                public void onClick(Button button,
+                                    EventObject e) {
+                    detailPanel.clear();
                     VerticalPanel vp = new VerticalPanel();
-                    vp.add(new HTML("<hr/>"));
+                    vp.add( new HTML( "<hr/>" ) );
 
-                    Label lng = new Label(longDescription);
-                    lng.setStyleName("error-long-message");
-                    vp.add(lng);
-                    detailPanel.add(vp);
-				}
-	        });
-	        detailPanel.add(showD);
+                    Label lng = new Label( longDescription );
+                    lng.setStyleName( "error-long-message" );
+                    vp.add( lng );
+                    detailPanel.add( vp );
+                }
+            } );
+            detailPanel.add( showD );
         }
 
-        detailPanel.setWidth("100%");
-        body.add(detailPanel);
+        detailPanel.setWidth( "100%" );
+        body.add( detailPanel );
     }
 
-
     /** Convenience method to popup the message. */
     public static void showMessage(String message) {
-        if (instance != null) {
-            instance.addMessage(message, null);
+        if ( instance != null ) {
+            instance.addMessage( message,
+                                 null );
         } else {
-            instance = new ErrorPopup(message, null);
+            instance = new ErrorPopup( message,
+                                       null );
         }
 
         LoadingPopup.close();
@@ -160,18 +130,15 @@
      */
     public static void showMessage(DetailedSerializationException exception) {
 
-        if (instance != null) {
-            instance.addMessage(exception.getMessage(), exception.getLongDescription());
+        if ( instance != null ) {
+            instance.addMessage( exception.getMessage(),
+                                 exception.getLongDescription() );
         } else {
-            instance = new ErrorPopup(exception.getMessage(), exception.getLongDescription());    
+            instance = new ErrorPopup( exception.getMessage(),
+                                       exception.getLongDescription() );
         }
 
         LoadingPopup.close();
     }
 
-
-
-
-
-
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStyleLayout.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStyleLayout.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStyleLayout.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -1,20 +1,3 @@
-/**
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.guvnor.client.common;
 /*
  * Copyright 2005 JBoss Inc
  *
@@ -31,8 +14,8 @@
  * limitations under the License.
  */
 
+package org.drools.guvnor.client.common;
 
-
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.FlexTable;
 import com.google.gwt.user.client.ui.HTML;
@@ -51,15 +34,17 @@
  */
 public class FormStyleLayout extends Composite {
 
-    private FlexTable layout = new FlexTable();
-    private FlexCellFormatter formatter = layout.getFlexCellFormatter();
-    private int numInLayout = 0;
+    private FlexTable         layout      = new FlexTable();
+    private FlexCellFormatter formatter   = layout.getFlexCellFormatter();
+    private int               numInLayout = 0;
 
     /**
      * Create a new layout with a header and and icon.
      */
-    public FormStyleLayout(String image, String title) {
-        addHeader( image, title );
+    public FormStyleLayout(String image,
+                           String title) {
+        addHeader( image,
+                   title );
         initWidget( layout );
     }
 
@@ -81,60 +66,85 @@
      */
     public void addAttribute(String lbl,
                              Widget editor) {
-        HTML label = new HTML("<div class='x-form-field'>" + lbl + "</div>");
-        layout.setWidget( numInLayout, 0, label );
-        formatter.setAlignment( numInLayout, 0, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_TOP );
-        layout.setWidget( numInLayout, 1, editor );
-        formatter.setAlignment( numInLayout, 1, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP );
+        HTML label = new HTML( "<div class='x-form-field'>" + lbl + "</div>" );
+        layout.setWidget( numInLayout,
+                          0,
+                          label );
+        formatter.setAlignment( numInLayout,
+                                0,
+                                HasHorizontalAlignment.ALIGN_RIGHT,
+                                HasVerticalAlignment.ALIGN_TOP );
+        layout.setWidget( numInLayout,
+                          1,
+                          editor );
+        formatter.setAlignment( numInLayout,
+                                1,
+                                HasHorizontalAlignment.ALIGN_LEFT,
+                                HasVerticalAlignment.ALIGN_TOP );
 
         numInLayout++;
     }
 
-
     /** Adds a widget that takes up a whole row. */
     public void addRow(Widget w) {
-        layout.setWidget( numInLayout, 0, w);
-        formatter.setColSpan( numInLayout, 0, 2 );
+        layout.setWidget( numInLayout,
+                          0,
+                          w );
+        formatter.setColSpan( numInLayout,
+                              0,
+                              2 );
         numInLayout++;
     }
 
     /**
      * Adds a header at the top.
      */
-    protected void addHeader(String image, String title) {
-        HTML name = new HTML("<div class='x-form-field'><b>" + title + "</b></div>");
+    protected void addHeader(String image,
+                             String title) {
+        HTML name = new HTML( "<div class='x-form-field'><b>" + title + "</b></div>" );
         name.setStyleName( "resource-name-Label" );
-        doHeader( image, name );
+        doHeader( image,
+                  name );
     }
 
-    private void doHeader(String image, Widget title) {
-        layout.setWidget( 0, 0, new Image(image) );
-        formatter.setAlignment( 0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP );
-        layout.setWidget( 0, 1, title );
+    private void doHeader(String image,
+                          Widget title) {
+        layout.setWidget( 0,
+                          0,
+                          new Image( image ) );
+        formatter.setAlignment( 0,
+                                0,
+                                HasHorizontalAlignment.ALIGN_LEFT,
+                                HasVerticalAlignment.ALIGN_TOP );
+        layout.setWidget( 0,
+                          1,
+                          title );
         numInLayout++;
     }
 
-
-
-    protected void addHeader(String image, String title, Widget titleIcon) {
-    	HTML name = new HTML("<div class='x-form-field'><b>" + title + "</b></div>");
+    protected void addHeader(String image,
+                             String title,
+                             Widget titleIcon) {
+        HTML name = new HTML( "<div class='x-form-field'><b>" + title + "</b></div>" );
         name.setStyleName( "resource-name-Label" );
         HorizontalPanel horiz = new HorizontalPanel();
         horiz.add( name );
         horiz.add( titleIcon );
-        doHeader( image, horiz );
+        doHeader( image,
+                  horiz );
 
     }
 
-    public void setFlexTableWidget(int row, int col, Widget widget){
-        layout.setWidget( row, col, widget );
+    public void setFlexTableWidget(int row,
+                                   int col,
+                                   Widget widget) {
+        layout.setWidget( row,
+                          col,
+                          widget );
     }
 
-
-
     public int getNumAttributes() {
-    	return numInLayout;
+        return numInLayout;
     }
 
-
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStylePopup.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStylePopup.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/FormStylePopup.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -1,5 +1,5 @@
-/**
- * Copyright 2010 JBoss Inc
+/*
+ * Copyright 2005 JBoss Inc
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,29 +16,20 @@
 
 package org.drools.guvnor.client.common;
 
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
 import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.widgets.BoxComponent;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.Window;
-import com.gwtext.client.widgets.event.WindowListenerAdapter;
-import com.gwtext.client.widgets.layout.FitLayout;
 
 /**
  * This builds on the FormStyleLayout for providing common popup features in a
@@ -49,22 +40,26 @@
 public class FormStylePopup {
 
     private FormStyleLayout form;
-    private Window          dialog;
+    private Popup           dialog;
     private String          title;
 
-    private Boolean         shadow;
     private Integer         width;
-    private Integer			height;
+    private Integer         height;
     private boolean         modal   = true;
     private int             popLeft = -1;
     private int             popTop;
     private Command         afterShowEvent;
 
+    private boolean         dragged = false;
+    private int             dragStartX;
+    private int             dragStartY;
+
     public FormStylePopup(String image,
                           final String title) {
 
         form = new FormStyleLayout( image,
                                     title );
+
         this.title = title;
 
     }
@@ -75,11 +70,9 @@
 
     public FormStylePopup(String image,
                           final String title,
-                          Integer width,
-                          Boolean shadow) {
+                          Integer width) {
         this( image,
               title );
-        this.shadow = shadow;
         this.width = width;
     }
 
@@ -100,7 +93,6 @@
     public void hide() {
         if ( dialog != null ) {
             this.dialog.hide();
-            this.dialog.destroy();
         }
     }
 
@@ -116,59 +108,81 @@
 
     public void show() {
 
-        dialog = new Window();
-        dialog.setAutoScroll( true );
+        dialog = new Popup();
+
+        if ( title != null ) {
+            dialog.setTitle( title );
+        }
         dialog.setModal( modal );
-        dialog.setPlain( true );
-        dialog.setConstrainHeader( true );
-        dialog.setBodyBorder( false );
-        dialog.setBorder( false );
         if ( width == null ) {
-            dialog.setWidth( 430 );
+            dialog.setWidth( 430 + "px" );
         } else if ( width != -1 ) {
-            dialog.setWidth( width );
+            dialog.setWidth( width + "px" );
         }
-        dialog.setShadow( (shadow == null) ? true : shadow.booleanValue() );
-        dialog.setResizable( true );
-        dialog.setClosable( true );
-        dialog.setTitle( title );
-        if ( popLeft > -1 ) {
-            dialog.setPosition( popLeft,
-                                popTop );
-        }
 
-        Panel p = new Panel();
-        p.setLayout( new FitLayout() );
+        VerticalPanel p = new VerticalPanel();
+        p.setHorizontalAlignment( VerticalPanel.ALIGN_RIGHT );
+
+        final PopupTitleBar titleBar = new PopupTitleBar( this.title );
+
+        titleBar.closeButton.addClickHandler( new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                dialog.hide();
+            }
+        } );
+        titleBar.addMouseDownHandler( new MouseDownHandler() {
+
+            public void onMouseDown(MouseDownEvent event) {
+                dragged = true;
+                dragStartX = event.getRelativeX( dialog.getElement() );
+                dragStartY = event.getRelativeY( dialog.getElement() );
+                DOM.setCapture( titleBar.getElement() );
+            }
+        } );
+        titleBar.addMouseMoveHandler( new MouseMoveHandler() {
+
+            public void onMouseMove(MouseMoveEvent event) {
+                if ( dragged ) {
+                    dialog.setPopupPosition( event.getClientX() - dragStartX,
+                                             event.getClientY() - dragStartY );
+                }
+            }
+        } );
+        titleBar.addMouseUpHandler( new MouseUpHandler() {
+
+            public void onMouseUp(MouseUpEvent event) {
+                dragged = false;
+                DOM.releaseCapture( titleBar.getElement() );
+            }
+        } );
+
+        p.add( titleBar );
+
         p.add( form );
         dialog.add( p );
-        p.setBodyBorder( false );
-        p.setPaddings( 0 );
 
-        if ( this.afterShowEvent != null ) {
-            this.dialog.addListener( new WindowListenerAdapter() {
-                @Override
-                public void onActivate(Panel panel) {
-                    afterShowEvent.execute();
-                }
-            } );
+        if ( getHeight() != null ) {
+            this.dialog.setHeight( getHeight() + "px" );
         }
 
-        dialog.addListener( new WindowListenerAdapter() {
+        if ( popLeft > -1 ) {
+            dialog.setPopupPosition( popLeft,
+                                     popTop );
+            this.dialog.show();
+        } else {
+            dialog.setPopupPosition( 100,
+                                     100 );
+            this.dialog.show();
 
-            public void onResize(BoxComponent component,
-                                 int adjWidth,
-                                 int adjHeight,
-                                 int rawWidth,
-                                 int rawHeight) {
-                dialog.doLayout();
-            }
-        } );
+            dialog.center();
 
-        if (getHeight() != null) {
-        	this.dialog.setHeight(getHeight());
+            int left = (Window.getClientWidth() - dialog.getOffsetWidth()) >> 1;
+            int top = (Window.getClientHeight() - dialog.getOffsetHeight()) >> 1;
+            setPopupPosition( Math.max( Window.getScrollLeft() + left,
+                                        0 ),
+                              Math.max( Window.getScrollTop() + top,
+                                        0 ) );
         }
-        
-        this.dialog.show();
 
     }
 
@@ -189,12 +203,26 @@
         this.width = new Integer( i );
     }
 
-	public Integer getHeight() {
-		return height;
-	}
+    public Integer getHeight() {
+        return height;
+    }
 
-	public void setHeight(Integer height) {
-		this.height = height;
-	}
+    public void setHeight(Integer height) {
+        this.height = height;
+    }
 
+    class Popup extends PopupPanel {
+
+        @Override
+        public void show() {
+            super.show();
+
+            if ( afterShowEvent != null ) {
+                afterShowEvent.execute();
+            }
+
+        }
+
+    }
+
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ImageButton.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ImageButton.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/ImageButton.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -15,6 +15,7 @@
  */
 
 package org.drools.guvnor.client.common;
+
 /*
  * Copyright 2005 JBoss Inc
  *
@@ -31,8 +32,7 @@
  * limitations under the License.
  */
 
-
-
+import com.google.gwt.uibinder.client.UiConstructor;
 import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.Image;
 
@@ -43,20 +43,25 @@
  */
 public class ImageButton extends Image {
 
-    public ImageButton(String img) {
-        super(img);
+    public @UiConstructor
+    ImageButton(String img) {
+        super( img );
         setStyleName( "image-Button" );
     }
 
-    public ImageButton(String img, String tooltip) {
-        super(img);
+    public ImageButton(String img,
+                       String tooltip) {
+        super( img );
         setStyleName( "image-Button" );
         setTitle( tooltip );
     }
 
-    public ImageButton(String img, String tooltip, ClickListener action) {
-    	this(img, tooltip);
-    	this.addClickListener(action);
+    public ImageButton(String img,
+                       String tooltip,
+                       ClickListener action) {
+        this( img,
+              tooltip );
+        this.addClickListener( action );
     }
 
 }
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.guvnor.client.common;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.HasAllMouseHandlers;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.dom.client.MouseWheelEvent;
+import com.google.gwt.event.dom.client.MouseWheelHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+/**
+ * 
+ * @author Toni Rikkola
+ *
+ */
+public class PopupTitleBar extends Composite
+    implements
+    HasAllMouseHandlers {
+
+    interface PopupTitleBarBinder
+        extends
+        UiBinder<Widget, PopupTitleBar> {
+    }
+
+    private static PopupTitleBarBinder uiBinder = GWT.create( PopupTitleBarBinder.class );
+
+    @UiField
+    Label                              titleLabel;
+
+    @UiField
+    ImageButton                        closeButton;
+
+    public PopupTitleBar(String title) {
+
+        initWidget( uiBinder.createAndBindUi( this ) );
+
+        //        HTMLPanel htmlPanel = (HTMLPanel) getWidget();
+
+        titleLabel.setText( title );
+
+    }
+
+    public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
+        return addDomHandler( handler,
+                              MouseMoveEvent.getType() );
+    }
+
+    public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
+        return addDomHandler( handler,
+                              MouseOutEvent.getType() );
+    }
+
+    public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
+        return addDomHandler( handler,
+                              MouseOverEvent.getType() );
+    }
+
+    public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
+        return addDomHandler( handler,
+                              MouseUpEvent.getType() );
+    }
+
+    public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
+        return addDomHandler( handler,
+                              MouseWheelEvent.getType() );
+    }
+
+    public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
+        return addDomHandler( handler,
+                              MouseDownEvent.getType() );
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.ui.xml
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.ui.xml	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/common/PopupTitleBar.ui.xml	2010-09-10 07:36:16 UTC (rev 35096)
@@ -0,0 +1,32 @@
+<!--
+  Copyright 2010 JBoss Inc
+ 
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+ 
+       http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+	xmlns:gwt='urn:import:com.google.gwt.user.client.ui' xmlns:guvnor='urn:import:org.drools.guvnor.client.common'>
+
+	<gwt:HTMLPanel>
+		<div id="titleBar" class='guvnor-PopupTitleBar-bar'>
+			<div style='float:left;' class='guvnor-PopupTitleBar-title'>
+				<gwt:Label ui:field="titleLabel"></gwt:Label>
+			</div>
+			<div class='guvnor-PopupTitleBar-close-button' style='float:right;'>
+				<guvnor:ImageButton ui:field="closeButton" img="images/close.gif"></guvnor:ImageButton>
+			</div>
+			<div style='clear:both;'></div>
+		</div>
+	</gwt:HTMLPanel>
+
+</ui:UiBinder>
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleTemplateEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleTemplateEditor.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleTemplateEditor.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -75,7 +75,7 @@
 		tPanel.add(new Button(constants.LoadTemplateData(), new ClickHandler() {
 			
 			public void onClick(ClickEvent event) {
-				final FormStylePopup popUp = new FormStylePopup(null, constants.TemplateData(), (int) (Window.getClientWidth() * 0.8), false);
+				final FormStylePopup popUp = new FormStylePopup(null, constants.TemplateData(), (int) (Window.getClientWidth() * 0.8) );
 				popUp.setHeight((int) (Window.getClientHeight() * 0.8));
 				popUp.addAttribute("", buildTemplateTable());
 				Button close = new Button(constants.Close(), new ClickHandler() {

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/PackageBuilderWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/PackageBuilderWidget.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/PackageBuilderWidget.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -252,7 +252,8 @@
         Button snap = new Button( constants.CreateSnapshotForDeployment() );
         snap.addClickListener( new ClickListener() {
             public void onClick(Widget w) {
-                showSnapshotDialog( conf.name, null);
+                showSnapshotDialog( conf.name,
+                                    null );
             }
         } );
         layout.addAttribute( constants.TakeSnapshot(),
@@ -357,8 +358,7 @@
         final FormStylePopup pop = new FormStylePopup( "images/view_source.gif", //NON-NLS
                                                        Format.format( constants.ViewingSourceFor0(),
                                                                       name ),
-                                                       new Integer( 600 ),
-                                                       Boolean.FALSE );
+                                                       new Integer( 600 ) );
 
         String[] rows = content.split( "\n" );
 
@@ -574,7 +574,8 @@
     /**
      * This will display a dialog for creating a snapshot.
      */
-    public static void showSnapshotDialog(final String packageName, final Command refreshCmd) {
+    public static void showSnapshotDialog(final String packageName,
+                                          final Command refreshCmd) {
         LoadingPopup.showMessage( constants.LoadingExistingSnapshots() );
         final FormStylePopup form = new FormStylePopup( "images/snapshot.png", //NON-NLS
                                                         constants.CreateASnapshotForDeployment() );
@@ -660,7 +661,7 @@
                                                                                      Window.alert( Format.format( constants.TheSnapshotCalled0WasSuccessfullyCreated(),
                                                                                                                   name ) );
                                                                                      form.hide();
-                                                                                     if(refreshCmd != null) {
+                                                                                     if ( refreshCmd != null ) {
                                                                                          refreshCmd.execute();
                                                                                      }
                                                                                      LoadingPopup.close();

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -100,7 +100,7 @@
 
 		try {
 			FormStylePopup pop = new FormStylePopup("images/view_source.gif", // NON-NLS
-					constants.ViewingDiagram(), new Integer(800), Boolean.FALSE);
+					constants.ViewingDiagram(), new Integer(800));
 
 			pop.addRow(new ScrollPanel(ruleFlowViewer));
 			pop.addRow(parameterPanel);

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/VersionBrowser.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/VersionBrowser.java	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/VersionBrowser.java	2010-09-10 07:36:16 UTC (rev 35096)
@@ -216,7 +216,7 @@
                 asset.isreadonly = true;
                 asset.metaData.name = metaData.name;
                 final FormStylePopup pop = new FormStylePopup("images/snapshot.png", Format.format(constants.VersionNumber0Of1(), "" + asset.metaData.versionNumber, asset.metaData.name),
-                		new Integer(800), new Boolean(false));
+                		new Integer(800));
 
                 Button restore = new Button(constants.RestoreThisVersion());
                 restore.addClickListener( new ClickListener() {

Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.html
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.html	2010-09-10 06:24:53 UTC (rev 35095)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.html	2010-09-10 07:36:16 UTC (rev 35096)
@@ -42,6 +42,7 @@
 		    </style>
 
 		<link rel="stylesheet" href="Guvnor.css">
+		<link rel="stylesheet" href="Guvnor_DecoratedPopupPanel.css">
 		<link rel="stylesheet" href="ruleflow.css">
 		<link rel="stylesheet" href="header.css">
    </head>

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor_DecoratedPopupPanel.css
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor_DecoratedPopupPanel.css	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor_DecoratedPopupPanel.css	2010-09-10 07:36:16 UTC (rev 35096)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.guvnor-PopupTitleBar-bar {
+	background-color: #E3E3E3;
+	width: 100%;
+}
+
+.guvnor-PopupTitleBar-title {
+	padding: 2px 0px 0px 4px;
+}
+
+.guvnor-PopupTitleBar-close-button {
+	padding: 2px 4px 0px 0px;
+}
\ No newline at end of file



More information about the jboss-svn-commits mailing list