Daniel Erez has posted comments on this change.

Change subject: webadmin: double click invokes default command
......................................................................


Patch Set 2: (9 inline comments)

....................................................
File 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/action/AbstractActionStackPanelItem.java
Line 42:     protected abstract W createDataDisplayWidget(M modelProvider);
Line 43: 
Line 44:     protected abstract AbstractActionPanel<T> createActionPanel(M 
modelProvider);
Line 45: 
Line 46:     void addDoubleClickHandler(final W widget, final M modelProvider) {
use formatter
Line 47:         if(modelProvider instanceof SearchableTableModelProvider<?, 
?>) {
Line 48:             widget.addDomHandler(new DoubleClickHandler() {
Line 49:                 @Override
Line 50:                 public void onDoubleClick(DoubleClickEvent event) {


Line 48:             widget.addDomHandler(new DoubleClickHandler() {
Line 49:                 @Override
Line 50:                 public void onDoubleClick(DoubleClickEvent event) {
Line 51:                     Model model = ((SearchableTableModelProvider<?, 
?>)modelProvider).getModel();
Line 52:                     UICommand defaultCommand = 
model.getDefaultCommand();
isn't it safer to get edit command using "Edit" string using something like 
'getCancelCommand' in Model.java (probably less neater though...)
Line 53:                     if(defaultCommand != null && 
defaultCommand.getIsExecutionAllowed()) {
Line 54:                         DeferredModelCommandInvoker invoker = new 
DeferredModelCommandInvoker(model);
Line 55:                         invoker.invokeDefaultCommand();
Line 56:                     }


....................................................
File 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/AbstractActionTable.java
Line 78: 
Line 79:     // Minimum width of a column used with column resizing, in pixels
Line 80:     private static final int RESIZE_MINIMUM_COLUMN_WIDTH = 30;
Line 81:     // Click event type
Line 82:     private static final String CLICK = "click";  //$NON-NLS-1$
use formatter
Line 83:     // Edit button id
Line 84:     private static final String EDIT = "Edit"; //$NON-NLS-1$
Line 85: 
Line 86:     @UiField


Line 80:     private static final int RESIZE_MINIMUM_COLUMN_WIDTH = 30;
Line 81:     // Click event type
Line 82:     private static final String CLICK = "click";  //$NON-NLS-1$
Line 83:     // Edit button id
Line 84:     private static final String EDIT = "Edit"; //$NON-NLS-1$
isn't used?
Line 85: 
Line 86:     @UiField
Line 87:     @WithElementId
Line 88:     public ButtonBase prevPageButton;


Line 191:             @Override
Line 192:             public void onDoubleClick(DoubleClickEvent event) {
Line 193:                 Model model = dataProvider.getModel();
Line 194:                 UICommand defaultCommand = model.getDefaultCommand();
Line 195:                 if(defaultCommand != null && 
defaultCommand.getIsExecutionAllowed()) {
use formatter
Line 196:                     DeferredModelCommandInvoker invoker = new 
DeferredModelCommandInvoker(model);
Line 197:                     invoker.invokeDefaultCommand();
Line 198:                 }
Line 199:             }


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
Line 109:         {
Line 110:             ArrayList<IVdcQueryable> items =
Line 111:                     getSelectedItems() != null ? Linq.<IVdcQueryable> 
Cast(getSelectedItems())
Line 112:                             : new ArrayList<IVdcQueryable>();
Line 113:                     UpdateReportCommandAvailability(reportCommand, 
items);
unneeded change (use formatter)
Line 114: 
Line 115:                     return reportCommand;
Line 116:         } else {
Line 117:             return null;


Line 594:         List<?> items =
Line 595:                 getSelectedItems() != null ? getSelectedItems()
Line 596:                         : Collections.emptyList();
Line 597: 
Line 598:                 for (ReportCommand reportCommand : openReportCommands)
same
Line 599:                 {
Line 600:                     UpdateReportCommandAvailability(reportCommand, 
items);
Line 601:                 }
Line 602:     }


Line 908:     /**
Line 909:      * Subclasses with an actual edit command will override this.
Line 910:      * @return An edit {@code UICommand}.
Line 911:      */
Line 912:     public UICommand getEditCommand() {
not sure it's the best option (comments in previous files...)
Line 913:         return null;
Line 914:     }
Line 915: 
Line 916:     @Override


Line 913:         return null;
Line 914:     }
Line 915: 
Line 916:     @Override
Line 917:     public UICommand getDefaultCommand() {
Why is it needed? Your verifying that it's instanceof 
SearchableTableModelProvider in the 'AbstractAction' classes.
Line 918:         return getEditCommand();
Line 919:     }


--
To view, visit http://gerrit.ovirt.org/10640
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I701036539547130a0c1581d179ad2f6de6519427
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
Gerrit-Reviewer: Alexander Wels <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Einav Cohen <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to