Example usage for com.google.gwt.user.client Timer scheduleRepeating

List of usage examples for com.google.gwt.user.client Timer scheduleRepeating

Introduction

In this page you can find the example usage for com.google.gwt.user.client Timer scheduleRepeating.

Prototype

public synchronized void scheduleRepeating(final int periodMs) 

Source Link

Document

Schedules a timer that elapses repeatedly.

Usage

From source file:org.pentaho.mantle.client.dialogs.scheduling.ScheduleEmailWizardPanel.java

License:Open Source License

public void setFocus() {
    Timer t = new Timer() {
        public void run() {
            toAddressTextBox.getElement().blur();
            toAddressTextBox.setFocus(false);
            toAddressTextBox.setFocus(true);
            toAddressTextBox.getElement().focus();
            if (toAddressTextBox.isAttached() && toAddressTextBox.isVisible()) {
                cancel();//from  ww w  . jav  a 2  s .  com
            }
        }
    };
    t.scheduleRepeating(250);
}

From source file:org.pentaho.mantle.client.dialogs.scheduling.ScheduleRecurrenceDialog.java

License:Open Source License

@Override
public void center() {
    super.center();
    Timer t = new Timer() {
        @Override//from  w  w w  . j  a  va  2 s .c o m
        public void run() {
            if (scheduleEditorWizardPanel.isAttached() && scheduleEditorWizardPanel.isVisible()) {
                cancel();
            }
        }
    };
    t.scheduleRepeating(250);
}

From source file:org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPerspective.java

License:Open Source License

private void buildUI() {
    FlowPanel topPanel = new FlowPanel();
    SimplePanel toolbarWrapper = new SimplePanel();
    toolbarWrapper.setWidget(new BrowserToolbar());
    toolbarWrapper.setStyleName("files-toolbar"); //$NON-NLS-1$
    topPanel.add(toolbarWrapper);/*  w  ww  .j av a 2 s .  com*/
    topPanel.add(new SolutionTreeWrapper(solutionTree));

    solutionNavigatorPanel.setStyleName("puc-vertical-split-panel");
    solutionNavigatorPanel.setHeight("100%"); //$NON-NLS-1$
    solutionNavigatorPanel.setTopWidget(topPanel);
    solutionNavigatorPanel.setBottomWidget(filesListPanel);

    /* BISERVER-6181 - - add padding to bottom of file list panel.
       add a css class to allow us to override inline styles to add the padding
    */
    filesListPanel.getElement().getParentElement().addClassName("filter-list-panel-container");

    solutionNavigatorPanel.setSplitPosition("60%"); //$NON-NLS-1$
    solutionNavigatorAndContentPanel.setStyleName("puc-horizontal-split-panel");
    solutionNavigatorAndContentPanel.setLeftWidget(solutionNavigatorPanel);
    solutionNavigatorAndContentPanel.setRightWidget(contentPanel);
    solutionNavigatorAndContentPanel.getElement().setAttribute("id", "solutionNavigatorAndContentPanel");

    @SuppressWarnings("rawtypes")
    NodeList possibleChildren = solutionNavigatorAndContentPanel.getElement().getElementsByTagName("table");
    for (int i = 0; i < possibleChildren.getLength(); i++) {
        Node child = possibleChildren.getItem(i);
        if (child instanceof Element) {
            Element elementChild = (Element) child;
            if (elementChild.getClassName().equalsIgnoreCase("hsplitter")) {
                elementChild.setAttribute("id", "pucHorizontalSplitter");
                elementChild.addClassName("pentaho-rounded-panel-top-right");
                elementChild.addClassName("pentaho-shadow-right-side");
                break;
            }
        }
    }

    possibleChildren = solutionNavigatorPanel.getElement().getElementsByTagName("div");
    for (int i = 0; i < possibleChildren.getLength(); i++) {
        Node child = possibleChildren.getItem(i);
        if (child instanceof Element) {
            Element elementChild = (Element) child;
            if (elementChild.getClassName().equalsIgnoreCase("vsplitter")) {
                elementChild.setAttribute("id", "pucVerticalSplitter");
                pucVerticalSplitterImg = ((Element) elementChild.getChild(0)).getStyle().getBackgroundImage();
                break;
            }
        }
    }

    solutionNavigatorPanel.getElement().getParentElement().addClassName("puc-navigator-panel");
    solutionNavigatorPanel.getElement().getParentElement().removeAttribute("style");

    workspacePanel = new WorkspacePanel(isAdministrator);
    contentPanel.setAnimationEnabled(false);
    contentPanel.add(workspacePanel);
    contentPanel.add(launchPanel);
    contentPanel.add(contentTabPanel);
    if (showSolutionBrowser) {
        solutionNavigatorAndContentPanel.setSplitPosition(defaultSplitPosition);
    } else {
        solutionNavigatorAndContentPanel.setSplitPosition("0px"); //$NON-NLS-1$
        solutionNavigatorPanel.setVisible(false);
    }
    contentPanel.setHeight("100%"); //$NON-NLS-1$
    contentPanel.setWidth("100%"); //$NON-NLS-1$
    contentPanel.getElement().setId("contentDeck");
    contentPanel.getElement().getParentElement().setClassName("pucContentDeck");
    contentPanel.getElement().getParentElement().getStyle().clearBorderWidth();
    contentPanel.getElement().getParentElement().getStyle().clearBorderStyle();
    contentPanel.getElement().getParentElement().getStyle().clearBorderColor();
    contentPanel.getElement().getParentElement().getStyle().clearMargin();

    setStyleName("panelWithTitledToolbar"); //$NON-NLS-1$  
    setHeight("100%"); //$NON-NLS-1$
    setWidth("100%"); //$NON-NLS-1$
    add(solutionNavigatorAndContentPanel);

    sinkEvents(Event.MOUSEEVENTS);

    showContent();
    ElementUtils.removeScrollingFromSplitPane(solutionNavigatorPanel);
    ElementUtils.removeScrollingFromUpTo(solutionNavigatorAndContentPanel.getLeftWidget().getElement(),
            solutionNavigatorAndContentPanel.getElement());

    // BISERVER-6208 Files List panel behaves badly in Safari
    if (Window.Navigator.getUserAgent().toLowerCase().indexOf("webkit") != -1) {
        Timer t = new Timer() {
            public void run() {
                String left = DOM.getElementById("pucHorizontalSplitter").getParentElement().getStyle()
                        .getLeft();
                if (left.indexOf("px") != -1) {
                    left = left.substring(0, left.indexOf("px"));
                }
                int leftInt = Integer.parseInt(left);
                if (leftInt <= 0) {
                    setNavigatorShowing(false);
                }
            }
        };
        t.scheduleRepeating(1000);
    }
}

From source file:org.pentaho.mantle.client.ui.tabs.MantleTabPanel.java

License:Open Source License

public void showNewURLTab(String tabName, String tabTooltip, String url, boolean setFileInfoInFrame,
        String frameName) {//from  www.j  av a2 s .c o m

    showLoadingIndicator();

    PerspectiveManager.getInstance().setPerspective(PerspectiveManager.OPENED_PERSPECTIVE);

    // Because Frames are being generated with the window.location object, relative URLs will be generated
    // differetly
    // than if set with the src attribute. This detects the relative paths are prepends them appropriately.
    if (url.indexOf("http") != 0 && url.indexOf("/") != 0) {
        url = GWT.getHostPageBaseURL() + url;
    }

    if (!url.contains("?")) {
        url = url + "?ts=" + System.currentTimeMillis();
    } else {
        url = url + "&ts=" + System.currentTimeMillis();
    }

    final int elementId = getTabCount();
    if (frameName == null || "".equals(frameName.trim())) {
        frameName = getUniqueFrameName();
    }

    // check for other tabs with this name
    if (existingTabMatchesName(tabName)) {
        int counter = 2;
        while (true) {
            // Loop until a unique tab name is not found
            // i.e. get the last counter number and then add 1 to it for the new tab
            // name
            if (existingTabMatchesName(tabName + " (" + counter + ")")) { // unique //$NON-NLS-1$ //$NON-NLS-2$
                counter++;
                continue;
            } else {
                tabName = tabName + " (" + counter + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                tabTooltip = tabTooltip + " (" + counter + ")"; //$NON-NLS-1$ //$NON-NLS-2$
                break;
            }
        }
    }

    IFrameTabPanel panel = null;
    if (freeFrames.size() > 0) {
        panel = freeFrames.iterator().next();
        panel.setName(frameName);
        // mark as no longer free by removing from set
        freeFrames.remove(panel);
    } else {
        panel = new IFrameTabPanel(frameName);
    }

    addTab(tabName, tabTooltip, true, panel);
    selectTab(elementId);

    // plugins will define their background color, if any
    // all other content is expected, for backwards compatibility to
    // be set on a white background (default for web browsers)
    // I have defined a CSS class for this background if someone
    // wants to change or remove the color
    if (url.indexOf("/content") > -1 || url.indexOf("/generatedContent") > -1) {
        panel.getElement().addClassName("mantle-white-tab-background"); // white background
    } else {
        panel.getElement().addClassName("mantle-default-tab-background"); // transparent background
    }

    final ArrayList<com.google.gwt.dom.client.Element> parentList = new ArrayList<com.google.gwt.dom.client.Element>();
    com.google.gwt.dom.client.Element parent = panel.getFrame().getElement();
    while (parent != getElement()) {
        parentList.add(parent);
        parent = parent.getParentElement();
    }
    Collections.reverse(parentList);
    for (int i = 1; i < parentList.size(); i++) {
        parentList.get(i).getStyle().setProperty("height", "100%"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    Widget selectTabContent = null;
    if (getTab(getSelectedTabIndex()) != null) {
        selectTabContent = getTab(getSelectedTabIndex()).getContent();
    }
    List<FileItem> selectedItems = SolutionBrowserPanel.getInstance().getFilesListPanel()
            .getSelectedFileItems();

    EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserOpenEvent(selectTabContent, selectedItems));

    // if showContent is the thing that turns on our first tab, which is entirely possible, then we
    // would encounter the same timing issue as before
    panel.setUrl(url);

    EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserSelectEvent(selectTabContent, selectedItems));

    if (setFileInfoInFrame
            && SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems().size() > 0) {
        setFileInfoInFrame(
                SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems().get(0));
    }

    // create a timer to check the readyState
    Timer t = new Timer() {
        public void run() {
            Element frameElement = getFrameElement(getSelectedTab());
            if (supportsReadyFeedback(frameElement)) {
                // cancel the timer, the content will hide the loading indicator itself
                cancel();
            } else {
                if ("complete".equalsIgnoreCase(getReadyState(frameElement))) {
                    // the content is not capable of giving us feedback so when the
                    // readyState is "complete" we hide/cancel
                    hideLoadingIndicator();
                    cancel();
                } else if (StringUtils.isEmpty(getReadyState(frameElement))
                        || "undefined".equals(getReadyState(frameElement))) {
                    hideLoadingIndicator();
                    cancel();
                }
            }
        }
    };
    t.scheduleRepeating(1000);
}

From source file:org.pentaho.mantle.client.ui.xul.MantleXul.java

License:Open Source License

public void customizeAdminStyle() {
    Timer t = new Timer() {
        public void run() {
            if (container != null) {
                cancel();/*  w ww . j  av a  2 s .c o m*/
                // call this method when Elements are added to DOM
                GwtTree adminCatTree = (GwtTree) container.getDocumentRoot().getElementById("adminCatTree");
                adminCatTree.getTree().removeStyleName("gwt-Tree");
                Panel adminContentPanel = (Panel) container.getDocumentRoot()
                        .getElementById("adminContentPanel").getManagedObject();
                adminContentPanel.setWidth("100%");

                for (int i = 0; i < adminCatTree.getTree().getItemCount(); i++) {
                    TreeItem treeItem = adminCatTree.getTree().getItem(i);
                    Element e = treeItem.getElement();
                    e.getStyle().clearPadding();
                    e.addClassName("adminCatTreeItem");
                    if (i == adminCatTree.getTree().getItemCount() - 1) {
                        e.addClassName("adminCatTreeItemLast");
                    }
                }

                MantleXul.this.selectAdminCatTreeTreeItem(
                        Messages.getString("manageUsersAndRoles").replaceAll("&amp;", "&"));
            }
        }
    };
    t.scheduleRepeating(250);
}

From source file:org.pentaho.mantle.client.ui.xul.MantleXul.java

License:Open Source License

public void enableUsersRolesTreeItem(final boolean enabled) {

    Timer t = new Timer() {
        public void run() {
            if (container != null) {
                cancel();//from  w w  w. ja  v a  2  s . c  o m
                String usersRolesLabel = Messages.getString("users") + "/" + Messages.getString("roles");
                GwtTree adminCatTree = (GwtTree) container.getDocumentRoot().getElementById("adminCatTree");

                TreeItem usersRolesTreeItem = null;
                Tree adminTree = adminCatTree.getTree();
                Iterator<TreeItem> adminTreeItr = adminTree.treeItemIterator();
                while (adminTreeItr.hasNext()) {
                    usersRolesTreeItem = adminTreeItr.next();
                    if (usersRolesTreeItem.getText().equals(usersRolesLabel)) {
                        usersRolesTreeItem.setVisible(enabled);
                        break;
                    }
                }
            }
        }
    };
    t.scheduleRepeating(250);
}

From source file:org.pentaho.mantle.client.ui.xul.MantleXul.java

License:Open Source License

public void addOverlays(ArrayList<XulOverlay> overlays) {
    this.overlays.addAll(overlays);
    Collections.sort(this.overlays, new OverlayPriority());

    if (this.overlays.size() > 0) {
        // wait for container to be loaded/ready
        Timer loadOverlayTimer = new Timer() {
            public void run() {
                if (container != null) {
                    cancel();//from ww  w .  j  a va  2  s  .  c  o m
                    new OverlayLoader(MantleXul.this.overlays).loadOverlays();
                }
            }
        };
        loadOverlayTimer.scheduleRepeating(250);
    }
}

From source file:org.pentaho.mantle.client.ui.xul.MantleXul.java

License:Open Source License

public void applyOverlay(final String id) {
    if (container != null) {
        try {/* www .  jav  a2 s.c o m*/
            container.loadOverlay(id);
        } catch (XulException e) {
            //ignored
        }
    } else {
        Timer t = new Timer() {
            public void run() {
                try {
                    if (container != null) {
                        cancel();
                        container.loadOverlay(id);
                    }
                } catch (XulException e) {
                    //ignored
                }
            }
        };
        t.scheduleRepeating(250);
    }
}

From source file:org.pentaho.mantle.client.ui.xul.MantleXul.java

License:Open Source License

public void removeOverlay(final String id) {
    if (container != null) {
        try {//w  ww. j a  v a  2s . c  om
            container.removeOverlay(id);
        } catch (XulException e) {
            //ignored
        }
    } else {
        Timer t = new Timer() {
            public void run() {
                try {
                    if (container != null) {
                        cancel();
                        container.removeOverlay(id);
                    }
                } catch (XulException e) {
                    //ignored
                }
            }
        };
        t.scheduleRepeating(250);
    }
}

From source file:org.pentaho.support.bi.client.BISupportUtility.java

License:Open Source License

/**
 * called when module starts//from w  w w  .j  a v a  2  s.com
 */
@Override
public void onModuleLoad() {
    selectObj.setInstallType("Installer");
    ((ServiceDefTarget) bisupportService).setServiceEntryPoint(getBaseUrl());
    RootPanel panel = RootPanel.get("maincontainer");
    mainPanel = new AbsolutePanel();
    mainPanel.setStyleName("mainPanel");
    panel.add(mainPanel, 0, 0);
    mainPanel.setSize("809px", "565px");

    bck_img = new Image("Images/login-crystal-bg.jpg");
    mainPanel.add(bck_img, 0, 0);
    bck_img.setSize("809px", "565px");

    logo_img = new Image("Images/puc-login-logo.png");
    mainPanel.add(logo_img, 10, 33);
    logo_img.setSize("360px", "93px");

    Label pentahoCustomerSupport = new Label("Pentaho Customer Support Wizard");
    mainPanel.add(pentahoCustomerSupport, 255, 132);
    pentahoCustomerSupport.setStyleName("pentaho-label");

    Label lblSelectInstallationType = new Label("Select Installation Type :");
    lblSelectInstallationType.setStyleName("gwt-Label-header");
    mainPanel.add(lblSelectInstallationType, 47, 184);

    rdbtnInstaller = new RadioButton("type", "Installer");
    rdbtnInstaller.setValue(true);
    rdbtnInstaller.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selectObj.setInstallType("Installer");
        }
    });
    mainPanel.add(rdbtnInstaller, 196, 225);

    rdbtnArchive = new RadioButton("type", "Archive");
    rdbtnArchive.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selectObj.setInstallType("Archive");
        }
    });
    mainPanel.add(rdbtnArchive, 353, 225);

    rdbtnManual = new RadioButton("type", "Manual");
    rdbtnManual.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selectObj.setInstallType("Manual");
        }
    });
    mainPanel.add(rdbtnManual, 504, 225);

    AbsolutePanel absolutePanel = new AbsolutePanel();
    mainPanel.add(absolutePanel, 102, 254);
    absolutePanel.setSize("611px", "201px");

    selectDselect = new CheckBox("Select/De-Select");
    selectDselect.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            onSelectDselect();
        }
    });
    absolutePanel.add(selectDselect, 10, 10);

    VerticalPanel absolutePanel_left = new VerticalPanel();
    absolutePanel.add(absolutePanel_left, 68, 36);
    absolutePanel_left.setSize("200px", "160px");

    license = new CheckBox("License File");
    license.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    secure = new CheckBox("Secure Files");
    secure.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    md5 = new CheckBox("MD5 Hash Value");
    md5.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });
    running = new CheckBox("Running Process");
    running.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    environment = new CheckBox("Environment");
    environment.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    datasource = new CheckBox("Datasource Details");
    datasource.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    absolutePanel_left.add(license);
    absolutePanel_left.add(secure);
    absolutePanel_left.add(md5);
    absolutePanel_left.add(running);
    absolutePanel_left.add(environment);
    absolutePanel_left.add(datasource);

    VerticalPanel absolutePanel_right = new VerticalPanel();
    absolutePanel.add(absolutePanel_right, 362, 36);
    absolutePanel_right.setSize("200px", "160px");

    logs = new CheckBox("Logs");
    logs.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    structure = new CheckBox("Structure Details");
    structure.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    serverXml = new CheckBox("XML files from Server");
    serverXml.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    tomcatXml = new CheckBox("XML files from Tomcat");
    tomcatXml.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    serverbat = new CheckBox("Start up files from server");
    serverbat.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    serverProp = new CheckBox("Properites files from server");
    serverProp.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            checkList();
        }
    });

    absolutePanel_right.add(logs);
    absolutePanel_right.add(structure);
    absolutePanel_right.add(serverXml);
    absolutePanel_right.add(tomcatXml);
    absolutePanel_right.add(serverbat);
    absolutePanel_right.add(serverProp);

    Label information = new Label("Browser Information :");
    mainPanel.add(information, 74, 461);
    information.setSize("179px", "20px");
    information.setStyleName("label-browser");

    browserText = new TextBox();
    mainPanel.add(browserText, 255, 464);
    browserText.setSize("417px", "27px");

    button = new Button("Package");
    button.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

            boolean result = false;
            selectObj.setServerName("biserver");

            // checks and set value based on selected
            if (selectDselect.getValue()) {
                selectObj.setBidiXml(true);
                selectObj.setBidiBatFile(true);
                selectObj.setBidiProrperties(true);
                selectObj.setTomcatXml(true);

                selectedItem = new ArrayList<String>();
                for (String item : BIConstant.SELECTEDITEM) {

                    selectedItem.add(item);
                }
                if (!browserText.getText().isEmpty()) {
                    selectObj.setBrowserInfo(browserText.getText());
                    selectedItem.add(BIConstant.BROWSER_INFO);
                }

                result = true;
            } else if (checkSelected()) {
                result = true;
            } else {
                message = null;
                message = new MessageDialogBox("Message", "Please select options to proceed", false, true,
                        true);
                showDialog();
            }

            if (result) {

                disableAll();

                final ProgressBar progressBar = new ProgressBar(0);
                DOM.setElementAttribute(progressBar.getElement(), "id", "progressBar");
                mainPanel.add(progressBar, 58, 508);

                Timer timer = new Timer() {
                    public void run() {
                        double progress = progressBar.getProgress() + 1;
                        if (progress > 100) {
                            cancel();
                        }
                        progressBar.setProgress(progress);
                    }
                };
                timer.scheduleRepeating(1500);

                // call the service
                bisupportService.readandsaveSelectedConfiguration(selectedItem, selectObj,
                        new AsyncCallback<Boolean>() {

                            @Override
                            public void onFailure(Throwable caught) {
                                message = new MessageDialogBox("Error", caught.getMessage(), false, true, true);
                                showDialog();
                            }

                            @Override
                            public void onSuccess(Boolean result) {
                                progressBar.removeFromParent();
                                button.setVisible(true);
                                selectedItem.clear();
                                enableAll();
                            }

                        });

            }
        }
    });
    mainPanel.add(button, 58, 508);
    button.setSize("661px", "30px");

}