Merge branch 'stable-2.6'
* stable-2.6: Reduce DOM nodes when updating reviewed status Fix PatchScreen leak when moving between files Use try/finally to ensure oldValue is cleared Remove unused HasValueChangeHandlers from PatchScriptSettingsPanel Make ListenableAccountDiffPreference final in PatchScriptSettingsPanel Remove unused setPreferences method on PatchTable init: Guess JDBC driver class if not configured
This commit is contained in:
@@ -118,6 +118,7 @@ public abstract class PatchScreen extends Screen implements
|
||||
/** The index of the file we are currently looking at among the fileList */
|
||||
private int patchIndex;
|
||||
private ListenableAccountDiffPreference prefs;
|
||||
private HandlerRegistration prefsHandler;
|
||||
|
||||
/** Keys that cause an action on this screen */
|
||||
private KeyCommandSet keysNavigation;
|
||||
@@ -146,19 +147,12 @@ public abstract class PatchScreen extends Screen implements
|
||||
idSideB = id.getParentKey();
|
||||
this.patchIndex = patchIndex;
|
||||
|
||||
prefs = fileList != null ? fileList.getPreferences() :
|
||||
new ListenableAccountDiffPreference();
|
||||
prefs = fileList != null
|
||||
? fileList.getPreferences()
|
||||
: new ListenableAccountDiffPreference();
|
||||
if (Gerrit.isSignedIn()) {
|
||||
prefs.reset();
|
||||
}
|
||||
prefs.addValueChangeHandler(
|
||||
new ValueChangeHandler<AccountDiffPreference>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<AccountDiffPreference> event) {
|
||||
update(event.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
reviewedPanels = new ReviewedPanels();
|
||||
settingsPanel = new PatchScriptSettingsPanel(prefs);
|
||||
}
|
||||
@@ -306,6 +300,10 @@ public abstract class PatchScreen extends Screen implements
|
||||
|
||||
@Override
|
||||
protected void onUnload() {
|
||||
if (prefsHandler != null) {
|
||||
prefsHandler.removeHandler();
|
||||
prefsHandler = null;
|
||||
}
|
||||
if (regNavigation != null) {
|
||||
regNavigation.removeHandler();
|
||||
regNavigation = null;
|
||||
@@ -500,6 +498,15 @@ public abstract class PatchScreen extends Screen implements
|
||||
@Override
|
||||
public void onShowView() {
|
||||
super.onShowView();
|
||||
if (prefsHandler == null) {
|
||||
prefsHandler = prefs.addValueChangeHandler(
|
||||
new ValueChangeHandler<AccountDiffPreference>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<AccountDiffPreference> event) {
|
||||
update(event.getValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
if (intralineFailure) {
|
||||
intralineFailure = false;
|
||||
new ErrorDialog(PatchUtil.C.intralineFailure()).show();
|
||||
|
@@ -27,10 +27,6 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||
import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
@@ -43,14 +39,13 @@ import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwtjsonrpc.common.VoidResult;
|
||||
|
||||
public class PatchScriptSettingsPanel extends Composite implements
|
||||
HasValueChangeHandlers<AccountDiffPreference> {
|
||||
public class PatchScriptSettingsPanel extends Composite {
|
||||
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
|
||||
|
||||
interface MyUiBinder extends UiBinder<Widget, PatchScriptSettingsPanel> {
|
||||
}
|
||||
|
||||
private ListenableAccountDiffPreference listenablePrefs;
|
||||
private final ListenableAccountDiffPreference listenablePrefs;
|
||||
private boolean enableIntralineDifference = true;
|
||||
private boolean enableSmallFileFeatures = true;
|
||||
|
||||
@@ -139,12 +134,6 @@ public class PatchScriptSettingsPanel extends Composite implements
|
||||
display();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerRegistration addValueChangeHandler(
|
||||
ValueChangeHandler<AccountDiffPreference> handler) {
|
||||
return super.addHandler(handler, ValueChangeEvent.getType());
|
||||
}
|
||||
|
||||
public void setEnabled(final boolean on) {
|
||||
if (on) {
|
||||
setEnabledCounter++;
|
||||
|
Reference in New Issue
Block a user