01: package org.drools.brms.client.rpc;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import com.google.gwt.user.client.rpc.IsSerializable;
20:
21: /**
22: * This is a row of data from a table.
23: * @author michael neale
24: *
25: */
26: public class TableDataRow implements IsSerializable {
27:
28: /**
29: * The unique ID for the resource.
30: * Most likely a UUID
31: */
32: public String id;
33:
34: /**
35: * The type of resource (eg DRL rule, business rule etc).
36: * This will determine what sort of editor opens it.
37: */
38: public String format;
39:
40: /**
41: * The actual values to display
42: * We will assume that the first one is the display name when opening.
43: */
44: public String[] values;
45:
46: public String getDisplayName() {
47: return values[0];
48: }
49:
50: /**
51: * Returns a key that can be used to drive an "open" event.
52: * Use getId and getType to break it apart.
53: */
54: public String getKeyValue() {
55: return id + "," + format;
56: }
57:
58: /**
59: * Gets the ID from the key value.
60: */
61: public static String getId(String key) {
62: return key.split("\\,")[0];
63: }
64:
65: /**
66: * Gets the format from the keyvalue
67: */
68: public static String getFormat(String key) {
69: return key.split("\\,")[1];
70: }
71:
72: }
|