http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0bf8c5a1/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
----------------------------------------------------------------------
diff --git 
a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
 
b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
index 8a6068b..3bc43fd 100644
--- 
a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
+++ 
b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/FramebufferUpdatePacket.java
@@ -29,75 +29,74 @@ import com.cloud.consoleproxy.vnc.packet.server.Rect;
 
 public class FramebufferUpdatePacket {
 
-  private final VncScreenDescription screen;
-  private final BufferedImageCanvas canvas;
-  private final ConsoleProxyClientListener clientListener;
-
-  public FramebufferUpdatePacket(BufferedImageCanvas canvas, 
VncScreenDescription screen, DataInputStream is, 
-    ConsoleProxyClientListener clientListener) throws IOException {
-         
-    this.screen = screen;
-    this.canvas = canvas;
-    this.clientListener = clientListener;
-    readPacketData(is);
-  }
-
-  private void readPacketData(DataInputStream is) throws IOException {
-    is.skipBytes(1);// Skip padding
-
-    // Read number of rectangles
-    int numberOfRectangles = is.readUnsignedShort();
-
-    // For all rectangles
-    for (int i = 0; i < numberOfRectangles; i++) {
-
-      // Read coordinate of rectangle
-      int x = is.readUnsignedShort();
-      int y = is.readUnsignedShort();
-      int width = is.readUnsignedShort();
-      int height = is.readUnsignedShort();
-
-      int encodingType = is.readInt();
-
-      // Process rectangle
-      Rect rect;
-      switch (encodingType) {
-
-      case RfbConstants.ENCODING_RAW: {
-        rect = new RawRect(screen, x, y, width, height, is);
-        break;
-      }
-
-      case RfbConstants.ENCODING_COPY_RECT: {
-        rect = new CopyRect(x, y, width, height, is);
-        break;
-      }
-
-      case RfbConstants.ENCODING_DESKTOP_SIZE: {
-        rect = new FrameBufferSizeChangeRequest(canvas, width, height);
-        if(this.clientListener != null)
-          this.clientListener.onFramebufferSizeChange(width, height);
-        break;
-      }
-
-      default:
-        throw new RuntimeException("Unsupported ecnoding: " + encodingType);
-      }
-
-      paint(rect, canvas);
-      
-      if(this.clientListener != null)
-         this.clientListener.onFramebufferUpdate(rect.getX(), rect.getY(), 
rect.getWidth(), rect.getHeight());
+    private final VncScreenDescription screen;
+    private final BufferedImageCanvas canvas;
+    private final ConsoleProxyClientListener clientListener;
+
+    public FramebufferUpdatePacket(BufferedImageCanvas canvas, 
VncScreenDescription screen, DataInputStream is, ConsoleProxyClientListener 
clientListener) throws IOException {
+
+        this.screen = screen;
+        this.canvas = canvas;
+        this.clientListener = clientListener;
+        readPacketData(is);
     }
 
-  }
+    private void readPacketData(DataInputStream is) throws IOException {
+        is.skipBytes(1);// Skip padding
+
+        // Read number of rectangles
+        int numberOfRectangles = is.readUnsignedShort();
+
+        // For all rectangles
+        for (int i = 0; i < numberOfRectangles; i++) {
+
+            // Read coordinate of rectangle
+            int x = is.readUnsignedShort();
+            int y = is.readUnsignedShort();
+            int width = is.readUnsignedShort();
+            int height = is.readUnsignedShort();
+
+            int encodingType = is.readInt();
+
+            // Process rectangle
+            Rect rect;
+            switch (encodingType) {
+
+            case RfbConstants.ENCODING_RAW: {
+                rect = new RawRect(screen, x, y, width, height, is);
+                break;
+            }
+
+            case RfbConstants.ENCODING_COPY_RECT: {
+                rect = new CopyRect(x, y, width, height, is);
+                break;
+            }
 
-  public void paint(Rect rect, BufferedImageCanvas canvas) {
-    // Draw rectangle on offline buffer
-    rect.paint(canvas.getOfflineImage(), canvas.getOfflineGraphics());
-    
-    // Request update of repainted area
-    canvas.repaint(rect.getX(), rect.getY(), rect.getWidth(), 
rect.getHeight());
-  }
+            case RfbConstants.ENCODING_DESKTOP_SIZE: {
+                rect = new FrameBufferSizeChangeRequest(canvas, width, height);
+                if (this.clientListener != null)
+                    this.clientListener.onFramebufferSizeChange(width, height);
+                break;
+            }
+
+            default:
+                throw new RuntimeException("Unsupported ecnoding: " + 
encodingType);
+            }
+
+            paint(rect, canvas);
+
+            if (this.clientListener != null)
+                this.clientListener.onFramebufferUpdate(rect.getX(), 
rect.getY(), rect.getWidth(), rect.getHeight());
+        }
+
+    }
+
+    public void paint(Rect rect, BufferedImageCanvas canvas) {
+        // Draw rectangle on offline buffer
+        rect.paint(canvas.getOfflineImage(), canvas.getOfflineGraphics());
+
+        // Request update of repainted area
+        canvas.repaint(rect.getX(), rect.getY(), rect.getWidth(), 
rect.getHeight());
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0bf8c5a1/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/RawRect.java
----------------------------------------------------------------------
diff --git 
a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/RawRect.java 
b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/RawRect.java
index 2cb4a93..978a4c2 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/RawRect.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/RawRect.java
@@ -26,51 +26,50 @@ import java.io.IOException;
 import com.cloud.consoleproxy.vnc.VncScreenDescription;
 
 public class RawRect extends AbstractRect {
-  private final int[] buf;
+    private final int[] buf;
 
-  public RawRect(VncScreenDescription screen, int x, int y, int width, int 
height, DataInputStream is) throws IOException {
-    super(x, y, width, height);
+    public RawRect(VncScreenDescription screen, int x, int y, int width, int 
height, DataInputStream is) throws IOException {
+        super(x, y, width, height);
 
-    byte[] bbuf = new byte[width * height * screen.getBytesPerPixel()];
-    is.readFully(bbuf);
+        byte[] bbuf = new byte[width * height * screen.getBytesPerPixel()];
+        is.readFully(bbuf);
 
-    // Convert array of bytes to array of int
-    int size = width * height;
-    buf = new int[size];
-    for (int i = 0, j = 0; i < size; i++, j += 4) {
-      buf[i] = (bbuf[j + 0] & 0xFF) | ((bbuf[j + 1] & 0xFF) << 8) | ((bbuf[j + 
2] & 0xFF) << 16) | ((bbuf[j + 3] & 0xFF) << 24);
-    }
+        // Convert array of bytes to array of int
+        int size = width * height;
+        buf = new int[size];
+        for (int i = 0, j = 0; i < size; i++, j += 4) {
+            buf[i] = (bbuf[j + 0] & 0xFF) | ((bbuf[j + 1] & 0xFF) << 8) | 
((bbuf[j + 2] & 0xFF) << 16) | ((bbuf[j + 3] & 0xFF) << 24);
+        }
 
-  }
+    }
 
-  @Override
-  public void paint(BufferedImage image, Graphics2D graphics) {
+    @Override
+    public void paint(BufferedImage image, Graphics2D graphics) {
 
-    DataBuffer dataBuf = image.getRaster().getDataBuffer();
+        DataBuffer dataBuf = image.getRaster().getDataBuffer();
 
-    switch (dataBuf.getDataType()) {
+        switch (dataBuf.getDataType()) {
 
-    case DataBuffer.TYPE_INT: {
-      // We chose RGB888 model, so Raster will use DataBufferInt type
-      DataBufferInt dataBuffer = (DataBufferInt) dataBuf;
+        case DataBuffer.TYPE_INT: {
+            // We chose RGB888 model, so Raster will use DataBufferInt type
+            DataBufferInt dataBuffer = (DataBufferInt) dataBuf;
 
-      int imageWidth = image.getWidth();
-      int imageHeight = image.getHeight();
+            int imageWidth = image.getWidth();
+            int imageHeight = image.getHeight();
 
-      // Paint rectangle directly on buffer, line by line
-      int[] imageBuffer = dataBuffer.getData();
-      for (int srcLine = 0, dstLine = y; srcLine < height && dstLine < 
imageHeight; srcLine++, dstLine++) {
-        try {
-          System.arraycopy(buf, srcLine * width, imageBuffer, x + dstLine * 
imageWidth, width);
-        } catch (IndexOutOfBoundsException e) {
+            // Paint rectangle directly on buffer, line by line
+            int[] imageBuffer = dataBuffer.getData();
+            for (int srcLine = 0, dstLine = y; srcLine < height && dstLine < 
imageHeight; srcLine++, dstLine++) {
+                try {
+                    System.arraycopy(buf, srcLine * width, imageBuffer, x + 
dstLine * imageWidth, width);
+                } catch (IndexOutOfBoundsException e) {
+                }
+            }
+            break;
         }
-      }
-      break;
-    }
 
-    default:
-      throw new RuntimeException("Unsupported data buffer in buffered image: 
expected data buffer of type int (DataBufferInt). Actual data buffer type: "
-          + dataBuf.getClass().getSimpleName());
+        default:
+            throw new RuntimeException("Unsupported data buffer in buffered 
image: expected data buffer of type int (DataBufferInt). Actual data buffer 
type: " + dataBuf.getClass().getSimpleName());
+        }
     }
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0bf8c5a1/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/Rect.java
----------------------------------------------------------------------
diff --git 
a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/Rect.java 
b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/Rect.java
index 697fd24..51edf12 100644
--- a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/Rect.java
+++ b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/Rect.java
@@ -20,11 +20,14 @@ import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
 
 public interface Rect {
-  
-  void paint(BufferedImage offlineImage, Graphics2D graphics);
 
-  int getX();
-  int getY();
-  int getWidth();
-  int getHeight();
+    void paint(BufferedImage offlineImage, Graphics2D graphics);
+
+    int getX();
+
+    int getY();
+
+    int getWidth();
+
+    int getHeight();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0bf8c5a1/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/ServerCutText.java
----------------------------------------------------------------------
diff --git 
a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/ServerCutText.java 
b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/ServerCutText.java
index bb00bd1..044f958 100644
--- 
a/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/ServerCutText.java
+++ 
b/console-proxy/src/com/cloud/consoleproxy/vnc/packet/server/ServerCutText.java
@@ -23,27 +23,27 @@ import com.cloud.consoleproxy.util.Logger;
 import com.cloud.consoleproxy.vnc.RfbConstants;
 
 public class ServerCutText {
-  private static final Logger s_logger = Logger.getLogger(ServerCutText.class);
+    private static final Logger s_logger = 
Logger.getLogger(ServerCutText.class);
 
-  private String content;
+    private String content;
 
-  public String getContent() {
-    return content;
-  }
+    public String getContent() {
+        return content;
+    }
 
-  public ServerCutText(DataInputStream is) throws IOException {
-    readPacketData(is);
-  }
+    public ServerCutText(DataInputStream is) throws IOException {
+        readPacketData(is);
+    }
 
-  private void readPacketData(DataInputStream is) throws IOException {
-    is.skipBytes(3);// Skip padding
-    int length = is.readInt();
-    byte buf[] = new byte[length];
-    is.readFully(buf);
+    private void readPacketData(DataInputStream is) throws IOException {
+        is.skipBytes(3);// Skip padding
+        int length = is.readInt();
+        byte buf[] = new byte[length];
+        is.readFully(buf);
 
-    content = new String(buf, RfbConstants.CHARSET);
+        content = new String(buf, RfbConstants.CHARSET);
 
-    /* LOG */s_logger.info("Clippboard content: " + content);
-  }
+        /* LOG */s_logger.info("Clippboard content: " + content);
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0bf8c5a1/console-proxy/ui/viewer-update.ftl
----------------------------------------------------------------------
diff --git a/console-proxy/ui/viewer-update.ftl 
b/console-proxy/ui/viewer-update.ftl
index ab3d4d1..6bf9ab3 100644
--- a/console-proxy/ui/viewer-update.ftl
+++ b/console-proxy/ui/viewer-update.ftl
@@ -1,24 +1,24 @@
-<#--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-tileMap = [ ${tileSequence} ];
-<#if resized == true>
-       ajaxViewer.resize('main_panel', ${width}, ${height}, ${tileWidth}, 
${tileHeight}); 
-</#if>
-ajaxViewer.refresh('${imgUrl}', tileMap, false);
- 
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+tileMap = [ ${tileSequence} ];
+<#if resized == true>
+       ajaxViewer.resize('main_panel', ${width}, ${height}, ${tileWidth}, 
${tileHeight}); 
+</#if>
+ajaxViewer.refresh('${imgUrl}', tileMap, false);
+ 

Reply via email to