Revision 32f17ab7 src/gr/grnet/pithos/web/client/InvitationsDialog.java
b/src/gr/grnet/pithos/web/client/InvitationsDialog.java | ||
---|---|---|
93 | 93 |
setGlassEnabled(true); |
94 | 94 |
setStyleName("pithos-DialogBox"); |
95 | 95 |
VerticalPanel outer = new VerticalPanel(); |
96 |
outer.add(close); |
|
96 |
outer.addStyleName("outer"); |
|
97 |
outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); |
|
97 | 98 |
|
98 | 99 |
VerticalPanel inner = new VerticalPanel(); |
99 | 100 |
inner.addStyleName("inner"); |
... | ... | |
103 | 104 |
inner.add(text); |
104 | 105 |
|
105 | 106 |
HorizontalPanel split = new HorizontalPanel(); |
107 |
split.addStyleName("pithos-invitationsSplitPanel"); |
|
106 | 108 |
|
107 | 109 |
VerticalPanel left = new VerticalPanel(); |
108 | 110 |
left.addStyleName("pithos-sendInvitationsPanel"); |
... | ... | |
122 | 124 |
left.add(messagesPanel); |
123 | 125 |
|
124 | 126 |
final FlexTable table = new FlexTable(); |
127 |
table.setCellSpacing(0); |
|
128 |
if (inv.getInvitationsLeft() > 0) { |
|
129 |
table.setHTML(0, 0, "Name <span class='eg'>e.g. John Smith</span>"); |
|
130 |
table.getFlexCellFormatter().setStyleName(0, 0, "props-labels"); |
|
131 |
table.setText(0, 1, "Email"); |
|
132 |
table.getFlexCellFormatter().setStyleName(0, 1, "props-labels"); |
|
133 |
rows = 1; |
|
134 |
addFormLine(table); |
|
135 |
} |
|
125 | 136 |
left.add(table); |
126 | 137 |
plus.addClickHandler(new ClickHandler() { |
127 | 138 |
|
... | ... | |
134 | 145 |
table.getFlexCellFormatter().setStyleName(0, 1, "props-labels"); |
135 | 146 |
rows++; |
136 | 147 |
} |
137 |
table.setWidget(rows, 0, new TextBox()); |
|
138 |
table.getFlexCellFormatter().setStyleName(1, 0, "props-values"); |
|
139 |
|
|
140 |
table.setWidget(rows, 1, new TextBox()); |
|
141 |
table.getFlexCellFormatter().setStyleName(1, 1, "props-values"); |
|
142 |
|
|
143 |
Image delete = new Image("images/delete.png"); |
|
144 |
delete.addStyleName("pithos-invitationDeleteImg"); |
|
145 |
delete.addClickHandler(new ClickHandler() { |
|
146 |
|
|
147 |
@Override |
|
148 |
public void onClick(ClickEvent event) { |
|
149 |
table.removeRow(table.getCellForEvent(event).getRowIndex()); |
|
150 |
} |
|
151 |
}); |
|
152 |
table.setWidget(rows, 2, delete); |
|
153 |
|
|
154 |
if (rows > 1) |
|
155 |
table.getRowFormatter().addStyleName(rows, "pithos-invitationFormRow"); |
|
156 |
|
|
157 |
rows++; |
|
148 |
addFormLine(table); |
|
158 | 149 |
} |
159 | 150 |
}); |
160 | 151 |
|
... | ... | |
175 | 166 |
left.add(send); |
176 | 167 |
|
177 | 168 |
split.add(left); |
178 |
|
|
169 |
split.setCellWidth(left, "50%"); |
|
170 |
|
|
179 | 171 |
VerticalPanel right = new VerticalPanel(); |
180 | 172 |
right.addStyleName("pithos-sentInvitationsPanel"); |
181 | 173 |
|
... | ... | |
184 | 176 |
right.add(sentLabel); |
185 | 177 |
|
186 | 178 |
sentInvitationsTable = new FlexTable(); |
179 |
sentInvitationsTable.setCellSpacing(0); |
|
180 |
sentInvitationsTable.addStyleName("pithos-sentInvitationsTable"); |
|
187 | 181 |
fillSentInvitationsTable(inv); |
188 | 182 |
right.add(sentInvitationsTable); |
189 | 183 |
|
... | ... | |
229 | 223 |
inner.add(split); |
230 | 224 |
|
231 | 225 |
outer.add(inner); |
226 |
outer.add(close); |
|
232 | 227 |
outer.setCellHorizontalAlignment(inner, HasHorizontalAlignment.ALIGN_CENTER); |
233 | 228 |
setWidget(outer); |
234 | 229 |
} |
235 | 230 |
|
231 |
private void addFormLine(final FlexTable table) { |
|
232 |
table.setWidget(rows, 0, new TextBox()); |
|
233 |
table.getFlexCellFormatter().setStyleName(1, 0, "props-values"); |
|
234 |
|
|
235 |
table.setWidget(rows, 1, new TextBox()); |
|
236 |
table.getFlexCellFormatter().setStyleName(1, 1, "props-values"); |
|
237 |
|
|
238 |
Image delete = new Image("images/delete.png"); |
|
239 |
delete.addStyleName("pithos-invitationDeleteImg"); |
|
240 |
delete.addClickHandler(new ClickHandler() { |
|
241 |
|
|
242 |
@Override |
|
243 |
public void onClick(ClickEvent event) { |
|
244 |
int rowIndex = table.getCellForEvent(event).getRowIndex(); |
|
245 |
table.removeRow(rowIndex); |
|
246 |
if (rowIndex == 1 && table.getRowCount() > 1) { |
|
247 |
table.getCellFormatter().removeStyleName(rowIndex, 0, "pithos-invitationFormRow"); |
|
248 |
table.getCellFormatter().removeStyleName(rowIndex, 1, "pithos-invitationFormRow"); |
|
249 |
table.getCellFormatter().removeStyleName(rowIndex, 2, "pithos-invitationFormRow"); |
|
250 |
} |
|
251 |
rows--; |
|
252 |
} |
|
253 |
}); |
|
254 |
table.setWidget(rows, 2, delete); |
|
255 |
|
|
256 |
if (rows > 1) { |
|
257 |
table.getCellFormatter().addStyleName(rows, 0, "pithos-invitationFormRow"); |
|
258 |
table.getCellFormatter().addStyleName(rows, 1, "pithos-invitationFormRow"); |
|
259 |
table.getCellFormatter().addStyleName(rows, 2, "pithos-invitationFormRow"); |
|
260 |
} |
|
261 |
rows++; |
|
262 |
} |
|
263 |
|
|
236 | 264 |
void sendInvitation(String email, final String realname) { |
237 | 265 |
PostRequest sendInvitation = new PostRequest("/im/", "", "invite", "uniq=" + email + "&realname=" + realname) { |
238 | 266 |
|
... | ... | |
264 | 292 |
for (int j=currentPage * INV_PER_PAGE + 0; j<inv.getSentInvitations().size() && j<(currentPage + 1)* INV_PER_PAGE; j++) { |
265 | 293 |
final Invitation i = inv.getSentInvitations().get(j); |
266 | 294 |
sentInvitationsTable.setText(row, 0, i.getRealname()); |
267 |
sentInvitationsTable.getFlexCellFormatter().addStyleName(row, 0, "pithos-invitedEmail"); |
|
268 | 295 |
if (i.isAccepted()) |
269 | 296 |
sentInvitationsTable.setWidget(row, 1, new Image("images/invitation_accepted.png")); |
270 | 297 |
else { |
... | ... | |
280 | 307 |
sentInvitationsTable.setWidget(row, 1, img); |
281 | 308 |
} |
282 | 309 |
sentInvitationsTable.getFlexCellFormatter().setRowSpan(row, 1, 2); |
310 |
sentInvitationsTable.getFlexCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_RIGHT); |
|
311 |
if (j < inv.getSentInvitations().size() - 1 && j < (currentPage + 1)* INV_PER_PAGE - 1) |
|
312 |
sentInvitationsTable.getFlexCellFormatter().addStyleName(row, 1, "pithos-invitedEmailBorder"); |
|
283 | 313 |
row++; |
284 | 314 |
sentInvitationsTable.setText(row, 0, i.getEmail()); |
315 |
sentInvitationsTable.getFlexCellFormatter().addStyleName(row, 0, "pithos-invitedEmail"); |
|
316 |
if (j < inv.getSentInvitations().size() - 1 && j < (currentPage + 1)* INV_PER_PAGE - 1) |
|
317 |
sentInvitationsTable.getFlexCellFormatter().addStyleName(row, 0, "pithos-invitedEmailBorder"); |
|
285 | 318 |
row++; |
286 | 319 |
} |
287 | 320 |
} |
Also available in: Unified diff