1 package autotest.tko; 2 3 import com.google.gwt.user.client.Event; 4 5 import autotest.common.ui.TabView; 6 7 import java.util.Map; 8 9 abstract class ConditionTabView extends TabView { 10 protected static CommonPanel commonPanel = CommonPanel.getPanel(); 11 private boolean needsRefresh; 12 13 protected void checkForHistoryChanges(Map<String, String> newParameters) { 14 if (!getHistoryArguments().equals(newParameters)) { 15 needsRefresh = true; 16 } 17 } 18 19 protected abstract boolean hasFirstQueryOccurred(); 20 21 @Override 22 public void display() { 23 ensureInitialized(); 24 commonPanel.setConditionVisible(true); 25 if (needsRefresh) { 26 commonPanel.updateStateFromView(); 27 refresh(); 28 needsRefresh = false; 29 } 30 visible = true; 31 } 32 33 @Override 34 public void handleHistoryArguments(Map<String, String> arguments) { 35 if (!hasFirstQueryOccurred()) { 36 needsRefresh = true; 37 } 38 commonPanel.fillDefaultHistoryValues(arguments); 39 fillDefaultHistoryValues(arguments); 40 checkForHistoryChanges(arguments); 41 commonPanel.handleHistoryArguments(arguments); 42 } 43 44 protected abstract void fillDefaultHistoryValues(Map<String, String> arguments); 45 46 static boolean isSelectEvent(Event event) { 47 return event.getShiftKey(); 48 } 49 50 protected abstract void doQuery(); 51 52 protected void doQueryWithCommonPanelCheck() { 53 if (!commonPanel.isViewReadyForQuery()) { 54 return; 55 } 56 57 doQuery(); 58 } 59 } 60