()
| 794 | } |
| 795 | |
| 796 | private void refreshFromQueryString() { |
| 797 | final QueryString qs = getQueryString(URL.decode(History.getToken())); |
| 798 | |
| 799 | maybeSetTextbox(qs, "start", start_datebox.getTextBox()); |
| 800 | maybeSetTextbox(qs, "end", end_datebox.getTextBox()); |
| 801 | setTextbox(qs, "wxh", wxh); |
| 802 | global_annotations.setValue(qs.containsKey("global_annotations")); |
| 803 | autoreload.setValue(qs.containsKey("autoreload"), true); |
| 804 | maybeSetTextbox(qs, "autoreload", autoreoload_interval); |
| 805 | |
| 806 | show_global_annotations = qs.containsKey("global_annotations") ? true : false; |
| 807 | hide_annotations = qs.containsKey("no_annotations") ? true : false; |
| 808 | |
| 809 | //get the tz param value |
| 810 | final ArrayList<String> tzvalues = qs.get("tz"); |
| 811 | if (tzvalues == null) |
| 812 | timezone = ""; |
| 813 | else |
| 814 | timezone = tzvalues.get(0); |
| 815 | |
| 816 | final ArrayList<String> newmetrics = qs.get("m"); |
| 817 | if (newmetrics == null) { // Clear all metric forms. |
| 818 | final int toremove = metrics.getWidgetCount() - 1; |
| 819 | addMetricForm("metric 1", 0); |
| 820 | metrics.selectTab(0); |
| 821 | for (int i = 0; i < toremove; i++) { |
| 822 | metrics.remove(1); |
| 823 | } |
| 824 | return; |
| 825 | } |
| 826 | final int n = newmetrics.size(); // We want this many metrics. |
| 827 | ArrayList<String> options = qs.get("o"); |
| 828 | if (options == null) { |
| 829 | options = new ArrayList<String>(n); |
| 830 | } |
| 831 | for (int i = options.size(); i < n; i++) { // Make both arrays equal size. |
| 832 | options.add(""); // Add missing o's. |
| 833 | } |
| 834 | |
| 835 | for (int i = 0; i < newmetrics.size(); ++i) { |
| 836 | if (i == metrics.getWidgetCount() - 1) { |
| 837 | addMetricForm("", i); |
| 838 | } |
| 839 | |
| 840 | final MetricForm metric = (MetricForm) metrics.getWidget(i); |
| 841 | metric.updateFromQueryString(newmetrics.get(i), options.get(i)); |
| 842 | } |
| 843 | // Remove extra metric forms. |
| 844 | final int m = metrics.getWidgetCount() - 1; // We have this many metrics. |
| 845 | int showing = metrics.getTabBar().getSelectedTab(); // Currently selected. |
| 846 | for (int i = m - 1; i >= n; i--) { |
| 847 | if (showing == i) { // If we're about to remove the currently selected, |
| 848 | metrics.selectTab(--showing); // fix focus to not wind up nowhere. |
| 849 | } |
| 850 | metrics.remove(i); |
| 851 | } |
| 852 | updatey2range.onEvent(null); |
| 853 |
no test coverage detected