...

 

 SCREEN SECTION.

 

 ...

 

 05  Frame

     col 38

     line 6.5

     lines 7, size 45

     title "File Upload"

     . 

 05  Java-Bean

     clsid          "org.zkoss.zul.Fileupload"

     event-list     ( "onUpload" )

     init-params    ( "upload")

     line 9

     col  40

     lines 2 cells

     size  5 cells

     id 701

     object  jb-fileupload

     event EV-FILEUP

     .  

 05  Frame

     col 38

     line 15

     lines 7, size 45

     title "Color Picker"

     .

 05  Java-Bean

     clsid "org.zkoss.zkex.zul.Colorbox" 

     col  40

     line 17.5

     lines 3 cells

     size  5 cells

     object  jb-colorbox

     . 

  05 push-button

     col 47

     line 17.5

     size 10 cells

     title "Test RGB"

     exception-value 671

     .

 05  lb-result

     Label

     col 58

     line 17.5

     title "result"

     center

     size 20 cells

     foreground-color rgb x#FFFFFF

     background-color rgb x#000000

     .

 05  label

     col 48

     line 19.5

     title "red"

     size 5 cells

     .

 05  ef-red

     entry-field

     center

     foreground-color rgb x#FF0000

     line 19.5

     col 52

     size 4 cells

     value red-disp

     .

 05  Label

     col 58

     line 19.5

     title "Green"

     size 5 cells

     .

 05  ef-green

     entry-field

     center

     foreground-color rgb x#00CC33

     line 19.5

     col 63

     size 4 cells

     value green-disp

     .

 05  label

     col 68

     line 19.5

     title "blue"

     size 5 cells

     .

 05  ef-blue

     entry-field

     center

     foreground-color rgb x#0000FF

     line 19.5

     col 73

     size 4 cells

     value blue-disp

     .

 

 ...

 

 PROCEDURE DIVISION.

 

 ...

 

 EV-FILEUP.

     if event-type = msg-jb-event

        if event-data-2 = ZK-EVT-ONUPLOAD

           accept upload-position from environment "upload.prefix"

           try

              set w-zk-upload-event

                  to j-evt:>getSource as zk-upload-event

              set w-zk-media to w-zk-upload-event:>getMedia

              set w-zk-media-name to w-zk-media:>getName

              if w-zk-media-name not = null

                 set w-zk-media-url

                     to j-string:>new(upload-position)

                 set w-j-fileoutput

                     to j-fileoutput:>new(w-zk-media-url

                                    :>concat("/")

                                    :>concat(w-zk-media-name));;

                 w-j-fileoutput:>write(w-zk-media:>getByteData)

                 w-j-fileoutput:>close

                 display message '"'w-zk-media-name '" UPLOADED'

              end-if

           catch exception

              exception-object:>printStackTrace

           end-try

        end-if

     end-if

     .

 

 SHOW-PICKER-RGB.

     set picker-color to jb-colorbox:>callMethod("getValue").

 

     move function hex2dec(function upper-case(red-val))

                                                     to red-disp.

     move function hex2dec(function upper-case(green-val))

                                                     to green-disp

     move function hex2dec(function upper-case(blue-val))

                                                     to blue-disp.

 

     modify ef-red     value red-disp

     modify ef-green   value green-disp

     modify ef-blue    value blue-disp

     compute buffer-bk = (red-disp * 65536 +

                          green-disp * 256 +

                          blue-disp) * -1

     modify LB-RESULT background-color buffer-bk.