|
3 | 3 | import com.google.gwt.core.client.GWT; |
4 | 4 | import com.google.gwt.event.dom.client.ClickEvent; |
5 | 5 | import com.google.gwt.event.dom.client.ClickHandler; |
| 6 | +import com.google.gwt.i18n.client.DateTimeFormat; |
6 | 7 | import com.google.gwt.safehtml.shared.SafeHtml; |
7 | 8 | import com.google.gwt.user.client.rpc.AsyncCallback; |
8 | 9 | import com.google.gwt.user.client.ui.Button; |
9 | 10 | import com.google.gwt.user.client.ui.DialogBox; |
10 | 11 | import com.google.gwt.user.client.ui.FlowPanel; |
| 12 | +import com.google.gwt.user.client.ui.Label; |
| 13 | +import com.google.gwt.user.client.ui.PasswordTextBox; |
| 14 | +import com.google.gwt.user.client.ui.TextBox; |
11 | 15 | import com.google.gwt.user.client.ui.Widget; |
| 16 | +import com.google.gwt.user.datepicker.client.DateBox; |
12 | 17 | import config.i18n.client.ClientMessages; |
| 18 | +import org.roda.core.data.v2.accessKey.CreateAccessKeyRequest; |
13 | 19 | import org.roda.core.data.v2.index.filter.Filter; |
14 | 20 | import org.roda.core.data.v2.index.select.SelectedItems; |
15 | 21 | import org.roda.core.data.v2.index.select.SelectedItemsList; |
|
21 | 27 | import org.roda.wui.client.common.lists.utils.ListBuilder; |
22 | 28 | import org.roda.wui.client.common.search.SearchWrapper; |
23 | 29 | import org.roda.wui.client.management.members.PasswordPanel; |
| 30 | +import org.roda.wui.client.management.members.data.panels.PasswordDataPanel; |
24 | 31 | import org.roda.wui.client.management.members.tabs.PermissionsPanel; |
| 32 | +import org.roda.wui.common.client.tools.StringUtils; |
25 | 33 |
|
| 34 | +import java.util.Date; |
26 | 35 | import java.util.List; |
27 | 36 |
|
28 | 37 | /** |
@@ -172,50 +181,67 @@ public void onSelectionChange(SelectedItems<RODAMember> selected) { |
172 | 181 | return container; |
173 | 182 | } |
174 | 183 |
|
175 | | - public static void showSetPasswordPanel() { |
176 | | - final DialogBox dialogBox = new DialogBox(true, true); |
177 | | - dialogBox.setGlassEnabled(true); |
| 184 | + public static void setUserPassword(String title, final AsyncCallback<String> callback) { |
| 185 | + final DialogBox dialogBox = new DialogBox(false, true); |
| 186 | + final Button cancelButton = new Button(messages.cancelButton()); |
| 187 | + final Button confirmButton = new Button(messages.confirmButton()); |
| 188 | + final FlowPanel layout = new FlowPanel(); |
| 189 | + final FlowPanel header = new FlowPanel(); |
| 190 | + final FlowPanel footer = new FlowPanel(); |
178 | 191 |
|
179 | | - final FlowPanel layout = new FlowPanel(); |
| 192 | + PasswordDataPanel passwordDataPanel = new PasswordDataPanel(true); |
180 | 193 |
|
181 | | - dialogBox.addStyleName("wui-dialog-prompt"); |
182 | | - layout.addStyleName("wui-dialog-layout"); |
| 194 | + dialogBox.setText(title); |
| 195 | + layout.add(header); |
| 196 | + layout.add(footer); |
| 197 | + header.add(passwordDataPanel); |
183 | 198 |
|
184 | | - final FlowPanel buttonPanel = new FlowPanel(); |
185 | | - buttonPanel.addStyleName("dialog-button-panel"); |
186 | | - final Button cancelButton = new Button(messages.cancelButton()); |
187 | | - final Button saveButton = new Button(messages.saveButton()); |
188 | | - buttonPanel.add(cancelButton); |
189 | | - buttonPanel.add(saveButton); |
| 199 | + footer.add(cancelButton); |
| 200 | + footer.add(confirmButton); |
190 | 201 |
|
191 | | - final FlowPanel content = new FlowPanel(); |
192 | | - content.addStyleName("content"); |
193 | | - content.add(new PasswordPanel(true)); |
194 | | - layout.add(content); |
195 | | - layout.add(buttonPanel); |
196 | | - dialogBox.setWidget(layout); |
| 202 | + confirmButton.addClickHandler(new ClickHandler() { |
| 203 | + @Override |
| 204 | + public void onClick(ClickEvent clickEvent) { |
| 205 | + if (passwordDataPanel.isValid()) { |
| 206 | + dialogBox.hide(); |
| 207 | + callback.onSuccess(passwordDataPanel.getValue()); |
| 208 | + } |
| 209 | + } |
| 210 | + }); |
197 | 211 |
|
198 | | - dialogBox.setGlassEnabled(true); |
199 | | - dialogBox.setAnimationEnabled(false); |
| 212 | + cancelButton.addClickHandler(new ClickHandler() { |
| 213 | + @Override |
| 214 | + public void onClick(ClickEvent clickEvent) { |
| 215 | + dialogBox.hide(); |
| 216 | + callback.onSuccess(null); |
| 217 | + } |
| 218 | + }); |
200 | 219 |
|
201 | | - cancelButton.addClickHandler(new ClickHandler() { |
202 | | - @Override |
203 | | - public void onClick(ClickEvent event) { |
204 | | - dialogBox.hide(); |
205 | | - } |
206 | | - }); |
| 220 | + dialogBox.setWidget(layout); |
| 221 | + dialogBox.setGlassEnabled(true); |
| 222 | + dialogBox.setAnimationEnabled(false); |
207 | 223 |
|
208 | | - saveButton.addClickHandler(new ClickHandler() { |
209 | | - @Override |
210 | | - public void onClick(ClickEvent event) { |
211 | | - dialogBox.hide(); |
212 | | - } |
213 | | - }); |
| 224 | + dialogBox.addStyleName("wui-dialog-prompt"); |
| 225 | + layout.addStyleName("wui-dialog-layout"); |
| 226 | + header.addStyleName("wui-dialog-message"); |
| 227 | + footer.addStyleName("wui-dialog-layout-footer"); |
214 | 228 |
|
215 | | - cancelButton.addStyleName("btn btn-link"); |
216 | | - saveButton.addStyleName("pull-right btn btn-play"); |
| 229 | + confirmButton.addStyleName("btn btn-play"); |
| 230 | + cancelButton.addStyleName("btn btn-link"); |
| 231 | + |
| 232 | + dialogBox.center(); |
| 233 | + dialogBox.show(); |
| 234 | + } |
| 235 | + |
| 236 | + private static FlowPanel createStackedFieldRow(Widget labelWidget, Widget inputWidget) { |
| 237 | + FlowPanel stackedField = new FlowPanel(); |
| 238 | + stackedField.addStyleName("generic-stacked-field"); |
| 239 | + |
| 240 | + // Assemble the DOM vertically |
| 241 | + stackedField.add(labelWidget); |
| 242 | + stackedField.add(inputWidget); |
| 243 | + |
| 244 | + return stackedField; |
| 245 | + } |
217 | 246 |
|
218 | | - dialogBox.center(); |
219 | | - dialogBox.show(); |
220 | | - } |
221 | 247 | } |
0 commit comments