Changeset 6921 for lang/scala

Show
Ignore:
Timestamp:
02/19/08 17:32:50 (9 months ago)
Author:
kmizu
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/scala/sandbox/src/jp/gr/java_conf/mizu/gui/GUIBuilder.scala

    r6919 r6921  
    1313 
    1414trait GUIBuilder { 
    15   val context :DynamicVariable[AnyRef] = new DynamicVariable[AnyRef](null) 
     15  private val _context :DynamicVariable[AnyRef] = new DynamicVariable[AnyRef](null) 
     16  def context :AnyRef = _context.value 
     17  def context_=(value :AnyRef) { _context.value = value } 
     18  def withContext(value :AnyRef)(thunk : => Unit) { 
     19    _context.withValue(value)(thunk) 
     20  } 
    1621        def setProperty(target :AnyRef, property :Symbol, value :Any) { 
    1722          invoke(target, "set" + property.name.capitalize, value) 
     
    2126        } 
    2227        def asContainer :Container = { 
    23                 context.value match { 
     28                context match { 
    2429                case frame:JFrame => frame.getContentPane 
    2530                case container:Container => container 
     
    3237    case (property:Symbol, value:Any) => setProperty(frame, property, value) 
    3338    } 
    34     context.withValue(frame)(thunk) 
     39    withContext(frame)(thunk) 
    3540    frame 
    3641  } 
     
    5560          asContainer.setLayout(layoutManager) 
    5661        } 
     62  def pack { 
     63    context match { case frame:JFrame => frame.pack } 
     64  } 
    5765}