1 | |
package org.kuali.student.common.ui.client.configurable.mvc; |
2 | |
|
3 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
4 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo; |
5 | |
import org.kuali.student.core.assembly.data.Metadata; |
6 | |
|
7 | |
import com.google.gwt.user.client.ui.Widget; |
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
public class FieldDescriptorReadOnly extends FieldDescriptor{ |
16 | |
|
17 | |
public FieldDescriptorReadOnly(String fieldKey, MessageKeyInfo messageKey, |
18 | |
Metadata metadata) { |
19 | 0 | super(fieldKey, messageKey, metadata); |
20 | 0 | } |
21 | |
|
22 | |
public FieldDescriptorReadOnly(String fieldKey, MessageKeyInfo messageKey, |
23 | |
Metadata metadata, Widget widget) { |
24 | 0 | super(fieldKey, messageKey, metadata, widget); |
25 | 0 | } |
26 | |
|
27 | |
|
28 | |
@Override |
29 | |
protected Widget createFieldWidget() { |
30 | 0 | if (metadata == null) { |
31 | 0 | Widget result = new KSLabel(); |
32 | 0 | addStyleToWidget(result); |
33 | 0 | return result; |
34 | |
} else { |
35 | 0 | Widget result = DefaultWidgetFactory.getInstance().getReadOnlyWidget(metadata); |
36 | 0 | addStyleToWidget(result); |
37 | 0 | return result; |
38 | |
} |
39 | |
} |
40 | |
|
41 | |
@Override |
42 | |
protected void addStyleToWidget(Widget w) { |
43 | 0 | if(fieldKey != null && !fieldKey.isEmpty()){ |
44 | 0 | String style = this.fieldKey.replaceAll("/", "-"); |
45 | 0 | style = style + "readOnly"; |
46 | 0 | w.addStyleName(style); |
47 | |
} |
48 | 0 | } |
49 | |
|
50 | |
@Override |
51 | |
protected void setupField() { |
52 | |
|
53 | 0 | } |
54 | |
} |