Ignore:
Timestamp:
05/01/08 17:02:40 (16 years ago)
Author:
ra33
Message:

Added Interactive Widget Items

File:
1 edited

Legend:

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

    r7 r10  
    22
    33import java.awt.Color;
     4import java.awt.Component;
     5import java.awt.Container;
    46import java.awt.Dimension;
    57import java.awt.Font;
     
    79import java.awt.Graphics2D;
    810import java.awt.GraphicsEnvironment;
     11import java.awt.Point;
    912import java.awt.RenderingHints;
    1013import java.awt.image.VolatileImage;
     
    1215import java.util.List;
    1316
     17import javax.swing.JPopupMenu;
     18import javax.swing.SwingUtilities;
     19
    1420import org.expeditee.actions.Misc;
    1521import org.expeditee.items.Dot;
     22import org.expeditee.items.InteractiveWidget;
    1623import org.expeditee.items.Item;
    1724import org.expeditee.items.Line;
    1825import org.expeditee.items.Picture;
    1926import org.expeditee.items.Text;
     27import org.expeditee.items.WidgetEdge;
    2028
    2129public class FrameGraphics {
     
    247255                                paintItems.addAll(toPaint.getItems());
    248256                        }
     257                        // FIRST: Paint widgets swing gui (not expeditee gui) .
     258                        // Note that these are the ancored widgets
     259                        for (InteractiveWidget iw : toPaint.getInteractiveWidgets()) {
     260                                iw.paint(bg);
     261                        }
     262                       
    249263                        PaintPictures(bg, paintItems);
    250264
     
    300314                                PaintLines(bg, Frame.FreeItems);
    301315                        }
     316                       
    302317                        if (paintOverlay) {
    303318                                PaintItem(bg, toPaint.getFrameNameItem());
    304319                        }
     320                       
     321                        // BROOK: Ensure popups are repainted
     322                        if (Browser._theBrowser != null)
     323                                repaintPopups(Browser._theBrowser.getLayeredPane(), bg);
     324
    305325                        bg.dispose();
    306326                }
     
    388408                g.drawImage(_MessageBuffer, 0, _MaxSize.height, null);
    389409                g.dispose();
    390         }
     410               
     411        }
     412       
     413
    391414
    392415        private static void paintMessage(Graphics2D g, Color background) {
     
    481504                                        FrameMouseActions.MouseX, FrameMouseActions.MouseY);
    482505
    483                         if (toDisconnect != null) {
    484                                 if (Frame.itemAttachedToCursor())
     506                        // Brook: Widget Edges do not have such a context
     507                        if (toDisconnect != null && !(i instanceof WidgetEdge)) {
     508                                if(Frame.itemAttachedToCursor())
    485509                                        return;
    486 
    487                                 // unhighlight all the other dots
     510                               
     511                                //unhighlight all the other dots
    488512                                for (Item conn : toDisconnect.getAllConnected()) {
    489513                                        conn.showHighlight(false);
    490514                                }
    491                                 // highlight the dot that will be in disconnect mode
     515                                //highlight the dot that will be in disconnect mode
    492516                                toDisconnect.showDisconnectHighlight(val);
    493517                                toDisconnect.setFilledHighlight(true);
     
    724748                _SupressErrors = val;
    725749        }
     750       
     751
     752        private static void repaintPopups(Container parent, Graphics g) {
     753                for (Component c : parent.getComponents()) {
     754                        if (c instanceof JPopupMenu && ((JPopupMenu)c).isVisible()) {
     755                               
     756                                Point p = SwingUtilities.convertPoint(c, c.getLocation(), Browser._theBrowser.getContentPane());
     757                               
     758                                g.translate(p.x, p.y);
     759                                c.paint(g);
     760                                g.translate(-p.x, -p.y);
     761                        } else if (c instanceof Container &&
     762                                        c != Browser._theBrowser.getContentPane()) {
     763                                repaintPopups((Container)c, g);
     764                        }
     765                }
     766        }
    726767}
Note: See TracChangeset for help on using the changeset viewer.