コード例 #1
0
  private void openFormTab() {
    if (currentTab.equals(TABS.FORM)) return;

    updateForm();
    ensureFormHasRow();

    String tabHandlercurrent = "inlineButtonChecked";
    String tabsContent = "tabsContent";
    String cssTabContent = "tabContent";
    String tabContentCurrent = "tabContentCurrent";

    HTML5Element tab = (HTML5Element) formTab.getElement().cast();
    ((HTML5Element) tab.getParentElement())
        .querySelector("." + tabHandlercurrent)
        .getClassList()
        .remove(tabHandlercurrent);
    tab.getClassList().add(tabHandlercurrent);

    HTML5Element contentParent = (HTML5Element) tabContent.getParentElement();
    contentParent
        .querySelector("." + tabsContent + " ." + cssTabContent + "." + tabContentCurrent)
        .getClassList()
        .remove(tabContentCurrent);
    contentParent
        .querySelector("." + tabsContent + " ." + cssTabContent + "[data-tab=\"form\"]")
        .getClassList()
        .add(tabContentCurrent);

    currentTab = TABS.FORM;
    GoogleAnalytics.sendEvent(ANALYTICS_EVENT_CATEGORY, "Tab switched", "Form tab");
    GoogleAnalyticsApp.sendEvent(ANALYTICS_EVENT_CATEGORY, "Tab switched", "Form tab");
  }
コード例 #2
0
  private void openRawTab() {
    if (currentTab.equals(TABS.RAW)) return;

    String tabHandlercurrent = "inlineButtonChecked";
    String tabsContent = "tabsContent";
    String cssTabContent = "tabContent";
    String tabContentCurrent = "tabContentCurrent";

    HTML5Element tab = (HTML5Element) rawTab.getElement().cast();
    ((HTML5Element) tab.getParentElement())
        .querySelector("." + tabHandlercurrent)
        .getClassList()
        .remove(tabHandlercurrent);
    tab.getClassList().add(tabHandlercurrent);

    HTML5Element contentParent = (HTML5Element) tabContent.getParentElement();
    contentParent
        .querySelector("." + tabsContent + " ." + cssTabContent + "." + tabContentCurrent)
        .getClassList()
        .remove(tabContentCurrent);
    contentParent
        .querySelector("." + tabsContent + " ." + cssTabContent + "[data-tab=\"raw\"]")
        .getClassList()
        .add(tabContentCurrent);

    currentTab = TABS.RAW;

    if (headersCodeMirror != null) {
      headersCodeMirror.refresh();
    }
    GoogleAnalytics.sendEvent(ANALYTICS_EVENT_CATEGORY, "Tab switched", "Raw tab");
    GoogleAnalyticsApp.sendEvent(ANALYTICS_EVENT_CATEGORY, "Tab switched", "Raw tab");
  }