1  import org.aswing.Component;
     2  import org.aswing.geom.Dimension;
     3  import org.aswing.geom.Rectangle;
     4  import org.aswing.graphices.Graphics;
     5  import org.aswing.JTextComponent;
     6  import org.aswing.LookAndFeel;
     7  import org.aswing.plaf.TextUI;
     8  
     9  /**
    10   * @author Tomato, iiley
    11   */
    12  class org.aswing.plaf.basic.BasicTextComponentUI extends TextUI {
    13  	
    14  	public function BasicTextComponentUI(){
    15  		super();
    16  	}
    17  	
    18  	//override this to the sub component's prefix
    19      private function getPropertyPrefix():String {
    20          return "";
    21      }
    22  
    23      public function installUI(c:Component):Void{
    24      	super.installUI(c);
    25      	var b:JTextComponent = JTextComponent(c);
    26          installDefaults(b);
    27          installListeners(b);
    28      }
    29      
    30  	private function installDefaults(b:JTextComponent):Void{
    31          // load shared instance defaults
    32          var pp:String = getPropertyPrefix();
    33  
    34          LookAndFeel.installColorsAndFont(b, pp + "background", pp + "foreground", pp + "font");
    35          LookAndFeel.installBorder(b, pp + "border");
    36          LookAndFeel.installBasicProperties(b, getPropertyPrefix());
    37  	}
    38  	
    39  	private function installListeners(b:JTextComponent):Void{
    40  	}
    41  		
    42  	
    43      public function uninstallUI(c:Component):Void{
    44      	super.uninstallUI(c);
    45      	
    46      	var b:JTextComponent = JTextComponent(c);
    47          uninstallDefaults(b);
    48          uninstallListeners(b);
    49      }
    50      
    51      private function uninstallDefaults(b:JTextComponent):Void{
    52      	LookAndFeel.uninstallBorder(b);
    53      }
    54      
    55      private function uninstallListeners(b:JTextComponent):Void{
    56      }
    57  
    58  	public function paint(c:Component , g:Graphics , r:Rectangle):Void{
    59  		super.paint(c, g, r);
    60  	}
    61  	
    62      public function getMinimumSize(c:Component):Dimension{
    63      	return c.getInsets().roundsSize();
    64      }
    65  
    66      public function getMaximumSize(c:Component):Dimension{
    67  		return new Dimension(Number.MAX_VALUE, Number.MAX_VALUE);
    68      }	
    69  }