<s> """<STR_LIT>""" <EOL> import pyjd <EOL> from pyjamas . ui . RootPanel import RootPanel <EOL> from pyjamas . ui . CaptionPanel import CaptionPanel <EOL> from pyjamas . ui . Label import Label <EOL> from pyjamas . ui . Controls import VerticalDemoSlider <EOL> from pyjamas . ui . Controls import VerticalDemoSlider2 <EOL> from pyjamas . ui . Controls import HorizontalDemoSlider <EOL> from pyjamas . ui . Controls import HorizontalDemoSlider2 <EOL> from pyjamas . ui . Controls import AreaDemoSlider <EOL> from pyjamas . ui . Controls import AreaDemoSlider2 <EOL> from pyjamas . ui . Controls import InputControl <EOL> from pyjamas . ui . MouseInputControl import MouseInputControl <EOL> from pyjamas . ui . HorizontalPanel import HorizontalPanel <EOL> from pyjamas . ui . VerticalPanel import VerticalPanel <EOL> from pyjamas . ui import HasAlignment <EOL> class SliderClass ( VerticalPanel ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , p2 ) : <EOL> VerticalPanel . __init__ ( self ) <EOL> self . setSpacing ( <NUM_LIT:10> ) <EOL> if p2 : <EOL> self . b = VerticalDemoSlider2 ( <NUM_LIT:0> , <NUM_LIT:100> ) <EOL> else : <EOL> self . b = VerticalDemoSlider ( <NUM_LIT:0> , <NUM_LIT:100> ) <EOL> self . add ( self . b ) <EOL> self . b . setWidth ( "<STR_LIT>" ) <EOL> self . b . setHeight ( "<STR_LIT>" ) <EOL> self . b . addControlValueListener ( self ) <EOL> self . label = InputControl ( <NUM_LIT:0> , <NUM_LIT:100> ) <EOL> self . add ( self . label ) <EOL> self . label . addControlValueListener ( self ) <EOL> def onControlValueChanged ( self , sender , old_value , new_value ) : <EOL> if sender == self . label : <EOL> self . b . setControlPos ( new_value ) <EOL> self . b . setValue ( new_value , <NUM_LIT:0> ) <EOL> if sender == self . b : <EOL> self . label . setControlPos ( new_value ) <EOL> self . label . setValue ( new_value , <NUM_LIT:0> ) <EOL> class HSliderClass ( VerticalPanel ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , p2 ) : <EOL> VerticalPanel . __init__ ( self ) <EOL> self . setSpacing ( <NUM_LIT:10> ) <EOL> if p2 : <EOL> self . b = HorizontalDemoSlider2 ( <NUM_LIT:0> , <NUM_LIT:100> ) <EOL> else : <EOL> self . b = HorizontalDemoSlider ( <NUM_LIT:0> , <NUM_LIT:100> ) <EOL> self . add ( self . b ) <EOL> self . b . setHeight ( "<STR_LIT>" ) <EOL> self . b . setWidth ( "<STR_LIT>" ) <EOL> self . b . addControlValueListener ( self ) <EOL> self . label = InputControl ( <NUM_LIT:0> , <NUM_LIT:100> ) <EOL> self . add ( self . label ) <EOL> self . label . addControlValueListener ( self ) <EOL> def onControlValueChanged ( self , sender , old_value , new_value ) : <EOL> if sender == self . label : <EOL> self . b . setControlPos ( new_value ) <EOL> self . b . setValue ( new_value , <NUM_LIT:0> ) <EOL> if sender == self . b : <EOL> self . label . setControlPos ( new_value ) <EOL> self . label . setValue ( new_value , <NUM_LIT:0> ) <EOL> class ASliderClass ( VerticalPanel ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , p2 ) : <EOL> VerticalPanel . __init__ ( self ) <EOL> self . setSpacing ( <NUM_LIT:10> ) <EOL> if p2 : <EOL> self . b = AreaDemoSlider2 ( [ <NUM_LIT:0> , <NUM_LIT:0> ] , [ <NUM_LIT:100> , <NUM_LIT:100> ] , [ <NUM_LIT> , <NUM_LIT> ] ) <EOL> else : <EOL> self . b = AreaDemoSlider ( [ <NUM_LIT:0> , <NUM_LIT:0> ] , [ <NUM_LIT:100> , <NUM_LIT:100> ] , [ <NUM_LIT> , <NUM_LIT> ] ) <EOL> self . add ( self . b ) <EOL> self . b . setHeight ( "<STR_LIT>" ) <EOL> self . b . setWidth ( "<STR_LIT>" ) <EOL> self . b . addControlValueListener ( self ) <EOL> self . label_x = MouseInputControl ( <NUM_LIT:0> , <NUM_LIT:100> , <NUM_LIT> ) <EOL> self . add ( self . label_x ) <EOL> self . label_x . addControlValueListener ( self ) <EOL> self . label_y = MouseInputControl ( <NUM_LIT:0> , <NUM_LIT:100> , <NUM_LIT> ) <EOL> self . add ( self . label_y ) <EOL> self . label_y . addControlValueListener ( self ) <EOL> def onControlValueChanged ( self , sender , old_value_xy , new_value_xy ) : <EOL> if ( sender == self . label_x ) : <EOL> self . b . setControlPos ( [ new_value_xy , self . b . value_y ] ) <EOL> self . b . setValue ( [ new_value_xy , self . b . value_y ] , <NUM_LIT:0> ) <EOL> elif ( sender == self . label_y ) : <EOL> self . b . setControlPos ( [ self . b . value_x , new_value_xy ] ) <EOL> self . b . setValue ( [ self . b . value_x , new_value_xy ] , <NUM_LIT:0> ) <EOL> elif ( sender == self . b ) : <EOL> ( new_value_x , new_value_y ) = new_value_xy <EOL> self . label_x . setControlPos ( new_value_x ) <EOL> self . label_x . setValue ( new_value_x , <NUM_LIT:0> ) <EOL> self . label_y . setControlPos ( new_value_y ) <EOL> self . label_y . setValue ( new_value_y , <NUM_LIT:0> ) <EOL> class ControlDemo : <EOL> def onModuleLoad ( self ) : <EOL> v = VerticalPanel ( Spacing = <NUM_LIT:10> ) <EOL> p = HorizontalPanel ( Spacing = <NUM_LIT:10> , <EOL> VerticalAlignment = HasAlignment . ALIGN_BOTTOM ) <EOL> sc = SliderClass ( False ) <EOL> p . add ( CaptionPanel ( "<STR_LIT>" , sc ) ) <EOL> sc = SliderClass ( True ) <EOL> p . add ( CaptionPanel ( "<STR_LIT>" , sc ) ) <EOL> sc = SliderClass ( True ) <EOL> p . add ( CaptionPanel ( "<STR_LIT>" , sc ) ) <EOL> v . add ( CaptionPanel ( "<STR_LIT>" , p ) ) <EOL> p = HorizontalPanel ( ) <EOL> p . setSpacing ( <NUM_LIT:10> ) <EOL> p . setVerticalAlignment ( HasAlignment . ALIGN_BOTTOM ) <EOL> sc = HSliderClass ( False ) <EOL> p . add ( CaptionPanel ( "<STR_LIT>" , sc ) ) <EOL> sc = HSliderClass ( True ) <EOL> p . add ( CaptionPanel ( "<STR_LIT>" , sc ) ) <EOL> v . add ( CaptionPanel ( "<STR_LIT>" , p ) ) <EOL> p = HorizontalPanel ( ) <EOL> p . setSpacing ( <NUM_LIT:10> ) <EOL> p . setVerticalAlignment ( HasAlignment . ALIGN_BOTTOM ) <EOL> sc = ASliderClass ( False ) <EOL> p . add ( CaptionPanel ( "<STR_LIT>" , sc ) ) <EOL> sc = ASliderClass ( True ) <EOL> p . add ( CaptionPanel ( "<STR_LIT>" , sc ) ) <EOL> v . add ( CaptionPanel ( "<STR_LIT>" , p ) ) <EOL> RootPanel ( ) . add ( v ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> pyjd . setup ( "<STR_LIT>" ) <EOL> app = ControlDemo ( ) <EOL> app . onModuleLoad ( ) <EOL> pyjd . run ( ) </s>
