Ignore:
Timestamp:
10/05/08 13:22:16 (16 years ago)
Author:
bjn8
Message:

GUI Improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src_apollo/org/apollo/widgets/LinkedTrack.java

    r334 r343  
    850850                if (Browser._theBrowser == null) return;
    851851               
     852                // Ensure that load bar or any text doesn't spill over widgets invalidation area
     853                Area clip = FrameGraphics.getCurrentClip();
     854               
     855                Shape clipBackUp = g.getClip();
     856               
     857                Area tmpClip = (clip != null) ? clip :
     858                        new Area(new Rectangle(0, 0,
     859                                        Browser._theBrowser.getContentPane().getWidth(),
     860                                        Browser._theBrowser.getContentPane().getHeight()));
     861               
     862                tmpClip.intersect(new Area(getBounds()));
     863
     864                if (tmpClip.isEmpty()) return;
     865
     866                g.setClip(tmpClip);
     867               
    852868                // Paint backing
    853869                g.setColor(SampledTrackGraphView.DEFAULT_BACKGROUND_COLOR);
     
    977993                // Draw centralized message string
    978994                if (centralizedMessage != null) {
    979        
    980                         // Ensure that load bar and text doesn't spill over widgets invalidation area
    981                         Area clip = FrameGraphics.getCurrentClip();
    982                        
    983                         Shape clipBackUp = g.getClip();
    984                        
    985                         Area tmpClip = (clip != null) ? clip :
    986                                 new Area(new Rectangle(0, 0,
    987                                                 Browser._theBrowser.getContentPane().getWidth(),
    988                                                 Browser._theBrowser.getContentPane().getHeight()));
    989                        
    990                         tmpClip.intersect(new Area(getBounds()));
    991        
    992                         if (!tmpClip.isEmpty()) {
    993        
    994                                 g.setClip(tmpClip);
    995                                
    996                                 FontMetrics fm   = g.getFontMetrics(MESSAGE_FONT);
    997                                 Rectangle2D rect = fm.getStringBounds(centralizedMessage, g);
    998        
    999                                 // Calc centered position
    1000                                 int x = getX() + ((getWidth() / 2) - (int)(rect.getWidth() / 2));
    1001                                 int y = getY() + ((getHeight() / 2) + (int)(rect.getHeight() / 2) - 4);
    1002                                
    1003                                 // Draw text
    1004                                 g.setFont(MESSAGE_FONT);
    1005                                 g.drawString(centralizedMessage, x, y);
    1006                                
    1007                                 // Draw add icon if waiting for a link
    1008                                 if (getLink() == null) {
    1009                                         IconRepository.getIcon("goto.png").paintIcon(null,
    1010                                                         g,
    1011                                                         x - 34,
    1012                                                         getY() + (getHeight() / 2) - 12);
    1013                                 }
    1014                                
    1015                                 g.setClip(clipBackUp);
    1016                         }
     995
     996                        FontMetrics fm   = g.getFontMetrics(MESSAGE_FONT);
     997                        Rectangle2D rect = fm.getStringBounds(centralizedMessage, g);
     998
     999                        // Calc centered position
     1000                        int x = getX() + ((getWidth() / 2) - (int)(rect.getWidth() / 2));
     1001                        int y = getY() + ((getHeight() / 2) + (int)(rect.getHeight() / 2) - 4);
     1002                       
     1003                        // Draw text
     1004                        g.setFont(MESSAGE_FONT);
     1005                        g.drawString(centralizedMessage, x, y);
     1006                       
     1007                        // Draw add icon if waiting for a link
     1008                        if (getLink() == null) {
     1009                                IconRepository.getIcon("goto.png").paintIcon(null,
     1010                                                g,
     1011                                                x - 34,
     1012                                                getY() + (getHeight() / 2) - 12);
     1013                        }
     1014                               
    10171015                }
    10181016
     
    10201018                if (state != NOT_INITIALIZED && state != FAILED_STATE && state != EMPTY_STATE)
    10211019                        nameLabel.paint(g);
     1020               
     1021                g.setClip(clipBackUp);
    10221022               
    10231023                super.paintLink((Graphics2D)g);
     
    10421042                xoff += (getX() + track.area.x);
    10431043                yoff += (getY() + track.area.y);
     1044               
     1045                if (xoff < getX())
     1046                        xoff = getX();
     1047                else if ((xoff + rect.getWidth()) > (getX() + getWidth()))
     1048                        xoff = (int)(getX() + getWidth() - rect.getWidth());
    10441049               
    10451050                // Draw text
Note: See TracChangeset for help on using the changeset viewer.