annotate src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java @ 12:66c06ebbced1

refactor
author YU
date Tue, 23 Sep 2014 16:13:23 +0900
parents aff2d0bb9c50
children f4ecd1f01f0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
1 package jp.ac.u_ryukyu.alicevnc;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
2
5
c05d3b89b446 Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents: 4
diff changeset
3 import java.util.ArrayList;
c05d3b89b446 Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents: 4
diff changeset
4
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
5 import com.glavsoft.exceptions.TransportException;
4
9a24e36d8ed7 use constructor for setting parms
YU
parents: 2
diff changeset
6 import com.glavsoft.rfb.encoding.EncodingType;
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
7 import com.glavsoft.rfb.encoding.decoder.AliceVNCMessage;
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
8 import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle;
12
66c06ebbced1 refactor
YU
parents: 11
diff changeset
9 import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder;
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
10 import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
11
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
12 import alice.codesegment.CodeSegment;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
13 import alice.datasegment.CommandType;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
14 import alice.datasegment.Receiver;
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
15
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
16 public class ReceiveUpdateRectangle extends CodeSegment{
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
17
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
18 private Receiver info = ids.create(CommandType.PEEK);
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
19 private Receiver info1 = ids.create(CommandType.TAKE);
12
66c06ebbced1 refactor
YU
parents: 11
diff changeset
20 private Receiver info2 = ids.create(CommandType.PEEK);
5
c05d3b89b446 Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents: 4
diff changeset
21
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
22 public ReceiveUpdateRectangle(){
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
23 info.setKey("Holder");
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
24 info1.setKey("aliceVNCMessage");
5
c05d3b89b446 Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents: 4
diff changeset
25 info2.setKey("_CLIST");
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
26 }
5
c05d3b89b446 Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents: 4
diff changeset
27
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
28 @Override
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
29 public void run() {
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
30 try {
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
31 RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class);
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
32 AliceVNCMessage message = info1.asClass(AliceVNCMessage.class);
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
33
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
34 if (message.getEncodingType() == EncodingType.ZRLE){
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
35 ZRLEDecoder decoder = new ZRLEDecoder();
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
36 FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle(
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
37 message.x, message.y, message.width, message.height);
12
66c06ebbced1 refactor
YU
parents: 11
diff changeset
38 rect.encodingType = message.getEncodingType();
66c06ebbced1 refactor
YU
parents: 11
diff changeset
39 byte[] buf = message.buf;
66c06ebbced1 refactor
YU
parents: 11
diff changeset
40 int offset = message.offset;
66c06ebbced1 refactor
YU
parents: 11
diff changeset
41
66c06ebbced1 refactor
YU
parents: 11
diff changeset
42 decoder.setColorDataOnRenderer(holder.getRenderer(), rect, buf, offset);
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
43 holder.getRepaintController().repaintBitmap(rect);
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
44
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
45
11
aff2d0bb9c50 Viewable multi display
YU
parents: 10
diff changeset
46 } else if (message.getEncodingType() == EncodingType.DESKTOP_SIZE) {
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
47 holder.setRenderer(
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
48 holder.getRepaintController().createRenderer(null ,message.width,
11
aff2d0bb9c50 Viewable multi display
YU
parents: 10
diff changeset
49 message.height, message.getPixelFormat())
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
50 );
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
51
12
66c06ebbced1 refactor
YU
parents: 11
diff changeset
52 } else if (message.getEncodingType() == EncodingType.RICH_CURSOR) {
66c06ebbced1 refactor
YU
parents: 11
diff changeset
53 RichCursorDecoder.getInstance().decode(holder.getRenderer(), message);
66c06ebbced1 refactor
YU
parents: 11
diff changeset
54 holder.getRepaintController().repaintCursor();
66c06ebbced1 refactor
YU
parents: 11
diff changeset
55 }
5
c05d3b89b446 Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents: 4
diff changeset
56
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
57 @SuppressWarnings("unchecked")
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
58 ArrayList<String> clist = info2.asClass(ArrayList.class);
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
59 for (String node : clist){
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
60 if (!"parent".equals(node))
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
61 ods.put(node, "aliceVNCMessage", info1.getVal());
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
62 }
12
66c06ebbced1 refactor
YU
parents: 11
diff changeset
63 this.recycle();
10
65d989192d63 change Protocol aliceVNCMessage
YU
parents: 5
diff changeset
64
2
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
65 } catch (TransportException e) {
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
66 e.printStackTrace();
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
67 }
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
68 }
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
69
e046eb8a3ac1 succeed to repaint another viewer
YU
parents:
diff changeset
70 }