summaryrefslogtreecommitdiffstats
path: root/simple/simple-http/src/test/java/org/simpleframework/http/socket/table/WebSocketTableColumnStyle.java
blob: f514295f80198b4d9a0b00bfc8744ff9b241d211 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package org.simpleframework.http.socket.table;

public class WebSocketTableColumnStyle {

   private final String template;
   private final String caption;
   private final String name;
   private final boolean sortable;
   private final boolean resizable;
   
   public WebSocketTableColumnStyle(String name, String caption, String template, boolean resizable, boolean sortable) {
      this.name = name;
      this.caption = caption;
      this.template = template;
      this.resizable = resizable;
      this.sortable = sortable;
   }
   
   public String createStyle() {
      StringBuilder builder = new StringBuilder();
      WebSocketValueEncoder encoder = new WebSocketValueEncoder();
      
      builder.append(name);
      builder.append(",");
      builder.append(encoder.encode(caption));
      builder.append(",");      
      builder.append(encoder.encode(template));
      builder.append(",");
      builder.append(resizable);
      builder.append(",");
      builder.append(sortable);
      
      return builder.toString();
   }
}