Changeset 215


Ignore:
Timestamp:
08/11/08 18:47:14 (16 years ago)
Author:
bjn8
Message:

Fixed borders

Location:
trunk/src/org/expeditee/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Popup.java

    r189 r215  
    11package org.expeditee.gui;
    22
     3import java.awt.BasicStroke;
    34import java.awt.Component;
    45import java.awt.Container;
    56import java.awt.Graphics;
     7import java.awt.Graphics2D;
    68import java.awt.LayoutManager;
    79
     
    2325       
    2426        //Mike says: Can we get the border for the IW to which this popup corresponds?
    25         public static final float BORDER_THICKNESS = 1.0F;
    26 //      private static final Stroke _lineStroke = new BasicStroke(BORDER_THICKNESS);
     27        // Brook says: Would be nice - but popups are actually independant from widgets
     28        //   =>Now: It is up to the user of the popup to set the border thickness
     29        private static final BasicStroke DEFAULT_STROKE = new BasicStroke(2.0f);
     30       
     31        private BasicStroke _lineStroke = DEFAULT_STROKE;
    2732       
    2833        private boolean _isReadyToPaint = false;
     
    5358        public void paint(Graphics g) {
    5459                super.paint(g);
    55                 // Draw iwidget-like border for consistancy
    56 //              ((Graphics2D)g).setStroke(_lineStroke);
    57 //              g.drawRect(0, 0, getWidth(), getHeight());
     60               
     61                if (_lineStroke != null) {
     62                        // Draw iwidget-like border for consistancy
     63                        ((Graphics2D)g).setStroke(_lineStroke);
     64                        g.drawRect(0, 0, getWidth(), getHeight());
     65                }
    5866        }
    5967       
     
    140148        }
    141149       
     150        /**
     151         *
     152         * @param thickness
     153         *              The new thickness to set. Null for no border.
     154         */
     155        public void setBorderThickness(float thickness) {
     156                assert(thickness >= 0);
     157               
     158                if (thickness == 0) _lineStroke = null;
     159                else _lineStroke = new BasicStroke(thickness);
     160
     161        }
    142162       
    143        
     163        /**
     164         * @return
     165         *              The border thickness of this popup. Zero or more.
     166         */
     167        public float getBorderThickness() {
     168                if (_lineStroke == null) return 0.0f;
     169                return _lineStroke.getLineWidth();
     170        }
    144171       
    145172       
  • trunk/src/org/expeditee/gui/PopupManager.java

    r183 r215  
    309309               
    310310                // Invalidate the popup border
    311                 if (Popup.BORDER_THICKNESS > 0) {
     311                if (p.getBorderThickness() > 0.0f) {
    312312                        invalidatePopup(p);
    313313                }
     
    464464        private void invalidatePopup(Popup p) {
    465465                FrameGraphics.invalidateArea(ItemUtils.expandRectangle(p.getBounds(),
    466                                 (int)Math.ceil(Popup.BORDER_THICKNESS)));
     466                                (int)Math.ceil(p.getBorderThickness())));
    467467        }
    468468       
     
    599599                                               
    600600                                                // Invalidate the popup border
    601                                                 if (Popup.BORDER_THICKNESS > 0) {
     601                                                if (ap.popup.getBorderThickness() > 0.0f) {
    602602                                                        invalidatePopup(ap.popup);
    603603                                                }
Note: See TracChangeset for help on using the changeset viewer.