Revision 08cc5916 src/gr/grnet/pithos/web/client/PithosDisclosurePanel.java
b/src/gr/grnet/pithos/web/client/PithosDisclosurePanel.java | ||
---|---|---|
52 | 52 |
import com.google.gwt.user.client.ui.Composite; |
53 | 53 |
import com.google.gwt.user.client.ui.DisclosurePanel; |
54 | 54 |
import com.google.gwt.user.client.ui.HTML; |
55 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
|
56 |
import com.google.gwt.user.client.ui.HasVerticalAlignment; |
|
57 |
import com.google.gwt.user.client.ui.HorizontalPanel; |
|
58 |
import com.google.gwt.user.client.ui.Image; |
|
55 | 59 |
import com.google.gwt.user.client.ui.IsWidget; |
60 |
import com.google.gwt.user.client.ui.Widget; |
|
56 | 61 |
|
57 | 62 |
public class PithosDisclosurePanel extends Composite { |
58 | 63 |
|
... | ... | |
61 | 66 |
|
62 | 67 |
String header(); |
63 | 68 |
|
69 |
String arrow(); |
|
70 |
|
|
64 | 71 |
String content(); |
65 | 72 |
} |
66 | 73 |
|
... | ... | |
108 | 115 |
initWidget(panel); |
109 | 116 |
} |
110 | 117 |
|
111 |
HTML createHeader(Resources resources, String title, boolean open) { |
|
112 |
SafeHtmlBuilder sb = new SafeHtmlBuilder(); |
|
113 |
sb.appendHtmlConstant(AbstractImagePrototype.create(resources.icon()).getHTML()); |
|
114 |
sb.append(Templates.INSTANCE.nameSpan(title)); |
|
115 |
sb.appendHtmlConstant(AbstractImagePrototype.create(open ? resources.open() : resources.closed()).getHTML()); |
|
116 |
HTML header = new HTML(sb.toSafeHtml()); |
|
117 |
header.addStyleName(resources.pithosDisclosurePanelCss().header()); |
|
118 |
return header; |
|
118 |
Widget createHeader(Resources resources, String title, boolean open) { |
|
119 |
HorizontalPanel header = new HorizontalPanel(); |
|
120 |
|
|
121 |
Image img = new Image(resources.icon()); |
|
122 |
header.add(img); |
|
123 |
header.setCellVerticalAlignment(img, HasVerticalAlignment.ALIGN_MIDDLE); |
|
124 |
header.setCellWidth(img, "32px"); |
|
125 |
HTML titleHtml = new HTML(title); |
|
126 |
header.add(titleHtml); |
|
127 |
header.setCellVerticalAlignment(titleHtml, HasVerticalAlignment.ALIGN_MIDDLE); |
|
128 |
Image arrow = new Image(open ? resources.open() : resources.closed()); |
|
129 |
arrow.addStyleName(resources.pithosDisclosurePanelCss().arrow()); |
|
130 |
header.add(arrow); |
|
131 |
header.setCellHorizontalAlignment(arrow, HasHorizontalAlignment.ALIGN_RIGHT); |
|
132 |
header.setCellVerticalAlignment(arrow, HasVerticalAlignment.ALIGN_MIDDLE); |
|
133 |
|
|
134 |
header.addStyleName(resources.pithosDisclosurePanelCss().header()); |
|
135 |
return header; |
|
119 | 136 |
} |
120 | 137 |
|
121 | 138 |
public void add(IsWidget widget) { |
Also available in: Unified diff