Example usage for com.google.gwt.user.client Window open

List of usage examples for com.google.gwt.user.client Window open

Introduction

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

Prototype

public static void open(String url, String name, String features) 

Source Link

Usage

From source file:com.google.api.explorer.client.FullView.java

License:Apache License

/**
 * Create a command that can be bound to a menu item that will open a url in a new tab.
 *//* w w w  . j a v  a  2  s .c om*/
private Command getOpenUrlAction(final String url) {
    return new Command() {
        @Override
        public void execute() {
            Window.open(url, NEW_TAB_TARGET, "");
        }
    };
}

From source file:com.google.appinventor.client.Ode.java

License:Open Source License

/**
 * Main entry point for Ode. Setting up the UI and the web service
 * connections./*from w  w w. j a  v a2s  . co  m*/
 */
@Override
public void onModuleLoad() {
    Tracking.trackPageview();

    // Handler for any otherwise unhandled exceptions
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        @Override
        public void onUncaughtException(Throwable e) {
            OdeLog.xlog(e);

            if (AppInventorFeatures.sendBugReports()) {
                if (Window.confirm(MESSAGES.internalErrorReportBug())) {
                    Window.open(BugReport.getBugReportLink(e), "_blank", "");
                }
            } else {
                // Display a confirm dialog with error msg and if 'ok' open the debugging view
                if (Window.confirm(MESSAGES.internalErrorClickOkDebuggingView())) {
                    Ode.getInstance().switchToDebuggingView();
                }
            }
        }
    });

    // Define bridge methods to Javascript
    JsonpConnection.defineBridgeMethod();

    // Initialize global Ode instance
    instance = this;

    // Let's see if we were started with a repo= parameter which points to a template
    templatePath = Window.Location.getParameter("repo");
    if (templatePath != null) {
        OdeLog.wlog("Got a template path of " + templatePath);
        templateLoadingFlag = true;
    }

    // Let's see if we were started with a galleryId= parameter which points to a template
    galleryId = Window.Location.getParameter("galleryId");
    if (galleryId != null) {
        OdeLog.wlog("Got a galleryId of " + galleryId);
        galleryIdLoadingFlag = true;
    }

    // Get user information.
    OdeAsyncCallback<Config> callback = new OdeAsyncCallback<Config>(
            // failure message
            MESSAGES.serverUnavailable()) {

        @Override
        public void onSuccess(Config result) {
            config = result;
            user = result.getUser();
            isReadOnly = user.isReadOnly();

            // If user hasn't accepted terms of service, ask them to.
            if (!user.getUserTosAccepted() && !isReadOnly) {
                // We expect that the redirect to the TOS page should be handled
                // by the onFailure method below. The server should return a
                // "forbidden" error if the TOS wasn't accepted.
                ErrorReporter.reportError(MESSAGES.serverUnavailable());
                return;
            }

            splashConfig = result.getSplashConfig();

            if (result.getRendezvousServer() != null) {
                setRendezvousServer(result.getRendezvousServer());
            } else {
                setRendezvousServer(YaVersion.RENDEZVOUS_SERVER);
            }

            userSettings = new UserSettings(user);

            // Gallery settings
            gallerySettings = new GallerySettings();
            //gallerySettings.loadGallerySettings();
            loadGallerySettings();

            // Initialize project and editor managers
            // The project manager loads the user's projects asynchronously
            projectManager = new ProjectManager();
            projectManager.addProjectManagerEventListener(new ProjectManagerEventAdapter() {
                @Override
                public void onProjectsLoaded() {
                    projectManager.removeProjectManagerEventListener(this);

                    // This handles any built-in templates stored in /war
                    // Retrieve template data stored in war/templates folder and
                    // and save it for later use in TemplateUploadWizard
                    OdeAsyncCallback<String> templateCallback = new OdeAsyncCallback<String>(
                            // failure message
                            MESSAGES.createProjectError()) {
                        @Override
                        public void onSuccess(String json) {
                            // Save the templateData
                            TemplateUploadWizard.initializeBuiltInTemplates(json);
                            // Here we call userSettings.loadSettings, but the settings are actually loaded
                            // asynchronously, so this loadSettings call will return before they are loaded.
                            // After the user settings have been loaded, openPreviousProject will be called.
                            // We have to call this after the builtin templates have been loaded otherwise
                            // we will get a NPF.
                            userSettings.loadSettings();
                        }
                    };
                    Ode.getInstance().getProjectService().retrieveTemplateData(
                            TemplateUploadWizard.TEMPLATES_ROOT_DIRECTORY, templateCallback);
                }
            });
            editorManager = new EditorManager();

            // Initialize UI
            initializeUi();

            topPanel.showUserEmail(user.getUserEmail());
        }

        @Override
        public void onFailure(Throwable caught) {
            if (caught instanceof StatusCodeException) {
                StatusCodeException e = (StatusCodeException) caught;
                int statusCode = e.getStatusCode();
                switch (statusCode) {
                case Response.SC_UNAUTHORIZED:
                    // unauthorized => not on whitelist
                    // getEncodedResponse() gives us the message that we wrote in
                    // OdeAuthFilter.writeWhitelistErrorMessage().
                    Window.alert(e.getEncodedResponse());
                    return;
                case Response.SC_FORBIDDEN:
                    // forbidden => need tos accept
                    Window.open("/" + ServerLayout.YA_TOS_FORM, "_self", null);
                    return;
                case Response.SC_PRECONDITION_FAILED:
                    String locale = Window.Location.getParameter("locale");
                    if (locale == null || locale.equals("")) {
                        Window.Location.replace("/login/");
                    } else {
                        Window.Location.replace("/login/?locale=" + locale);
                    }
                    return; // likely not reached
                }
            }
            super.onFailure(caught);
        }
    };

    // The call below begins an asynchronous read of the user's settings
    // When the settings are finished reading, various settings parsers
    // will be called on the returned JSON object. They will call various
    // other functions in this module, including openPreviousProject (the
    // previous project ID is stored in the settings) as well as the splash
    // screen displaying functions below.
    //
    // TODO(user): ODE makes too many RPC requests at startup time. Currently
    // we do 3 RPCs + 1 per project + 1 per open file. We should bundle some of
    // those with each other or with the initial HTML transfer.
    //
    // This call also stores our sessionId in the backend. This will be checked
    // when we go to save a file and if different file saving will be disabled
    // Newer sessions invalidate older sessions.

    userInfoService.getSystemConfig(sessionId, callback);

    History.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            openProject(event.getValue());
        }
    });

    // load project based on current url
    // TODO(sharon): Seems like a possible race condition here if the onValueChange
    // handler defined above gets called before the getSystemConfig call sets
    // userSettings.
    // The following line causes problems with GWT debugging, and commenting
    // it out doesn't seem to break things.
    //History.fireCurrentHistoryState();
}

From source file:com.google.appinventor.client.wizards.FileUploadWizard.java

License:Open Source License

private void createErrorDialog(String title, String body, Error e, final FolderNode folderNode,
        final FileUploadedCallback fileUploadedCallback) {
    final DialogBox dialogBox = new DialogBox(false, true);
    HTML message;/*from w  w w  .  jav  a2s.  co  m*/
    dialogBox.setStylePrimaryName("ode-DialogBox");
    dialogBox.setHeight("150px");
    dialogBox.setWidth("350px");
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);
    dialogBox.center();
    VerticalPanel DialogBoxContents = new VerticalPanel();
    FlowPanel holder = new FlowPanel();
    Button ok = new Button("OK");
    ok.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            dialogBox.hide();
            new FileUploadWizard(folderNode, fileUploadedCallback).show();
        }
    });
    holder.add(ok);
    dialogBox.setText(title);
    message = new HTML(body);

    switch (e) {
    case AIAMEDIAASSET:
        Button info = new Button("More Info");
        info.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                Window.open(MESSAGES.aiaMediaAssetHelp(), "AIA Help", "");
            }
        });
        holder.add(info);
    case NOFILESELECETED:
    case MALFORMEDFILENAME:
    case FILENAMEBADSIZE:
    default:
        break;
    }

    message.setStyleName("DialogBox-message");
    DialogBoxContents.add(message);
    DialogBoxContents.add(holder);
    dialogBox.setWidget(DialogBoxContents);
    dialogBox.show();
}

From source file:com.google.collide.client.workspace.FileTreeContextMenuController.java

License:Open Source License

private void createMenuItems() {
    FileTreeMenuItem newFile = new FileTreeMenuItem() {
        @Override//www  .  ja v a  2s .c om
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleNewFile(node);
        }

        @Override
        public String toString() {
            return "New File";
        }
    };

    FileTreeMenuItem newFolder = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleNewFolder(node);
        }

        @Override
        public String toString() {
            return "New Folder";
        }
    };

    // Check if the cut menu option is enabled.
    FileTreeMenuItem cut = null;
    if (BrowserUtils.hasUrlParameter(FILE_TREE_CUT_URL_PARAM, "t")) {
        cut = new FileTreeMenuItem() {
            @Override
            public void onClicked(TreeNodeElement<FileTreeNode> node) {
                handleCopy(node, true);
            }

            @Override
            public String toString() {
                return "Cut";
            }
        };
    }

    FileTreeMenuItem copy = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleCopy(node, false);
        }

        @Override
        public String toString() {
            return "Copy";
        }
    };

    FileTreeMenuItem rename = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleRename(node);
        }

        @Override
        boolean isDisabled() {
            return fileTreeUiController.getTree().getSelectionModel().getSelectedNodes().size() > 1;
        }

        @Override
        public String toString() {
            return "Rename";
        }
    };

    FileTreeMenuItem delete = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleDelete(node);
        }

        @Override
        public String toString() {
            return "Delete";
        }
    };

    FileTreeMenuItem viewFile = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleViewFile(node);
        }

        @Override
        public String toString() {
            return "View in Browser";
        }
    };

    FileTreeMenuItem paste = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handlePaste(node);
        }

        @Override
        boolean isDisabled() {
            return copiedNodes.isEmpty();
        }

        @Override
        public String toString() {
            return "Paste";
        }
    };

    FileTreeMenuItem folderAsZip = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleDownload(node, true);
        }

        @Override
        public String toString() {
            return "Download Folder as a Zip";
        }
    };

    FileTreeMenuItem branchAsZip = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleDownload(node, true);
        }

        @Override
        public String toString() {
            return "Download Branch as a Zip";
        }
    };

    FileTreeMenuItem download = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            handleDownload(node, false);
        }

        @Override
        public String toString() {
            return "Download";
        }
    };

    final PathUtil rootPath = PathUtil.EMPTY_PATH;
    FileTreeMenuItem uploadFile = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            place.fireEvent(new UploadClickedEvent(UploadType.FILE,
                    node == null ? rootPath : node.getData().getNodePath()));
        }

        @Override
        public String toString() {
            return "Upload File";
        }
    };

    FileTreeMenuItem uploadZip = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            place.fireEvent(new UploadClickedEvent(UploadType.ZIP,
                    node == null ? rootPath : node.getData().getNodePath()));
        }

        @Override
        public String toString() {
            return "Upload and Extract Zip";
        }
    };

    FileTreeMenuItem uploadFolder = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            place.fireEvent(new UploadClickedEvent(UploadType.DIRECTORY,
                    node == null ? rootPath : node.getData().getNodePath()));
        }

        @Override
        public String toString() {
            return "Upload Folder";
        }
    };

    FileTreeMenuItem newTab = new FileTreeMenuItem() {
        @Override
        public void onClicked(TreeNodeElement<FileTreeNode> node) {
            String link = WorkspaceUtils.createDeepLinkToFile(node.getData().getNodePath());
            Window.open(link, node.getData().getName(), null);
        }

        @Override
        public String toString() {
            return "Open in New Tab";
        }
    };

    rootMenuItems.add(newFile);
    rootMenuItems.add(newFolder);
    rootMenuItems.add(paste);
    rootMenuItems.add(uploadFile);
    rootMenuItems.add(uploadFolder);
    rootMenuItems.add(uploadZip);
    rootMenuItems.add(branchAsZip);

    dirMenuItems.add(newFile);
    dirMenuItems.add(newFolder);
    if (cut != null) {
        dirMenuItems.add(cut);
    }
    dirMenuItems.add(copy);
    dirMenuItems.add(paste);
    dirMenuItems.add(rename);
    dirMenuItems.add(delete);
    dirMenuItems.add(uploadFile);
    dirMenuItems.add(uploadFolder);
    dirMenuItems.add(uploadZip);
    dirMenuItems.add(folderAsZip);

    if (cut != null) {
        fileMenuItems.add(cut);
    }
    fileMenuItems.add(copy);
    fileMenuItems.add(viewFile);
    fileMenuItems.add(newTab);
    fileMenuItems.add(rename);
    fileMenuItems.add(delete);
    fileMenuItems.add(download);

    // Read Only Variety
    readonlyRootMenuItems.add(branchAsZip);

    readonlyDirMenuItems.add(folderAsZip);

    readonlyFileMenuItems.add(viewFile);
    readonlyFileMenuItems.add(newTab);
    readonlyFileMenuItems.add(download);

    allMenuItems.add(newFile);
    allMenuItems.add(newFolder);
    if (cut != null) {
        allMenuItems.add(cut);
    }
    allMenuItems.add(copy);
    allMenuItems.add(paste);
    allMenuItems.add(rename);
    allMenuItems.add(delete);
    allMenuItems.add(uploadFile);
    allMenuItems.add(uploadFolder);
    allMenuItems.add(uploadZip);
    allMenuItems.add(folderAsZip);
    allMenuItems.add(branchAsZip);
    allMenuItems.add(download);
}

From source file:com.google.gerrit.client.account.ContactPanelShort.java

License:Apache License

protected void onInitUI() {
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        labelIdx = 1;//from ww w  .j  av a 2s.c  o  m
        fieldIdx = 0;
    } else {
        labelIdx = 0;
        fieldIdx = 1;
    }

    nameTxt = new NpTextBox();
    nameTxt.setVisibleLength(60);
    nameTxt.setReadOnly(!canEditFullName());

    emailPick = new ListBox();

    final Grid infoPlainText = new Grid(2, 2);
    infoPlainText.setStyleName(Gerrit.RESOURCES.css().infoBlock());
    infoPlainText.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());

    body.add(infoPlainText);

    registerNewEmail = new Button(Util.C.buttonOpenRegisterNewEmail());
    registerNewEmail.setEnabled(false);
    registerNewEmail.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            doRegisterNewEmail();
        }
    });
    final FlowPanel emailLine = new FlowPanel();
    emailLine.add(emailPick);
    if (canRegisterNewEmail()) {
        emailLine.add(registerNewEmail);
    }

    int row = 0;
    if (!Gerrit.getConfig().canEdit(FieldName.USER_NAME) && Gerrit.getConfig().siteHasUsernames()) {
        infoPlainText.resizeRows(infoPlainText.getRowCount() + 1);
        row(infoPlainText, row++, Util.C.userName(), new UsernameField());
    }

    if (!canEditFullName()) {
        FlowPanel nameLine = new FlowPanel();
        nameLine.add(nameTxt);
        if (Gerrit.getConfig().getEditFullNameUrl() != null) {
            Button edit = new Button(Util.C.linkEditFullName());
            edit.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    Window.open(Gerrit.getConfig().getEditFullNameUrl(), "_blank", null);
                }
            });
            nameLine.add(edit);
        }
        Button reload = new Button(Util.C.linkReloadContact());
        reload.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                Window.Location.replace(Gerrit.loginRedirect(PageLinks.SETTINGS_CONTACT));
            }
        });
        nameLine.add(reload);
        row(infoPlainText, row++, Util.C.contactFieldFullName(), nameLine);
    } else {
        row(infoPlainText, row++, Util.C.contactFieldFullName(), nameTxt);
    }
    row(infoPlainText, row++, Util.C.contactFieldEmail(), emailLine);

    infoPlainText.getCellFormatter().addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
    infoPlainText.getCellFormatter().addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
    infoPlainText.getCellFormatter().addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());

    save = new Button(Util.C.buttonSaveChanges());
    save.setEnabled(false);
    save.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            doSave(null);
        }
    });
    new OnEditEnabler(save, nameTxt);

    emailPick.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(final ChangeEvent event) {
            final int idx = emailPick.getSelectedIndex();
            final String v = 0 <= idx ? emailPick.getValue(idx) : null;
            if (Util.C.buttonOpenRegisterNewEmail().equals(v)) {
                for (int i = 0; i < emailPick.getItemCount(); i++) {
                    if (currentEmail.equals(emailPick.getValue(i))) {
                        emailPick.setSelectedIndex(i);
                        break;
                    }
                }
                doRegisterNewEmail();
            } else {
                save.setEnabled(true);
            }
        }
    });
}

From source file:com.google.gerrit.client.api.DefaultActions.java

License:Apache License

private static AsyncCallback<JavaScriptObject> callback(final String target) {
    return new GerritCallback<JavaScriptObject>() {
        @Override//from   w ww  . j  av  a2s. c  o  m
        public void onSuccess(JavaScriptObject in) {
            UiResult result = asUiResult(in);
            if (result.alert() != null) {
                Window.alert(result.alert());
            }

            if (result.redirectUrl() != null && result.openWindow()) {
                Window.open(result.redirectUrl(), "_blank", null);
            } else if (result.redirectUrl() != null) {
                Location.assign(result.redirectUrl());
            } else {
                Gerrit.display(target);
            }
        }

        private UiResult asUiResult(JavaScriptObject in) {
            if (NativeString.is(in)) {
                String str = ((NativeString) in).asString();
                return str.isEmpty() ? UiResult.none() : UiResult.alert(str);
            }
            return in.cast();
        }
    };
}

From source file:com.google.gerrit.client.change.FileTable.java

License:Apache License

void openAll() {
    if (table != null) {
        String self = Gerrit.selfRedirect(null);
        for (FileInfo info : Natives.asList(table.list)) {
            if (canOpen(info.path())) {
                Window.open(self + "#" + url(info), "_blank", null);
            }/*from w ww.j a  va2 s.c o m*/
        }
    }
}

From source file:com.google.gwt.sample.feedreader.client.EntryPanel.java

License:Apache License

public void enter() {
    if (isAttached()) {
        return;//from ww w.  j a v a2s . c  om
    }

    if (!contentsSet) {
        PanelLabel contents = new PanelLabel(entry.getContent(), null, true);
        retargetLinks(contents.getElement());
        contents.addStyleName("articleContents");
        add(contents);
        add(new PanelLabel("Open article", new Command() {
            public void execute() {
                Window.open(entry.getLink(), "_blank", "");
            }
        }));
        contentsSet = true;
    }
    super.enter();
    History.newItem(parentFeed.getUrl() + "||" + entry.getLink());
}

From source file:com.google.gwt.sample.showcase.client.content.cell.CompositeContactCell.java

private static HasCell<ContactInfo, ContactInfo> createMailTo() {
    Cell<ContactInfo> mailToIcon = Cells.adaptWithConstantValue(new TextCell(), "@");
    return HasCells.forCell(Cells.makeClickable(mailToIcon, new Receiver<ContactInfo>() {
        public void accept(ContactInfo contact) {
            Window.open(
                    "https://mail.google.com/mail/u/0/" + "?view=cm&fs=1&tf=1&source=mailto&to="
                            + contact.getFirstName() + "." + contact.getLastName() + "@gmail.com",
                    "_blank", null);
        }/*from  ww  w .ja v  a  2  s  . c  o  m*/
    }));
}

From source file:com.google.gwt.sample.stockwatcher.client.OntologyBasedContentManagement.java

@SuppressWarnings("deprecation")
protected void loadPageTwo(String path) {
    RootPanel.get("stockList").clear();
    // mainPanel.clear();
    // mainPanel.add(home_page);
    logger.log(Level.SEVERE, ontologies.getSelectedIndex() + " and " + path);

    /* second page */
    final String export_path = path;
    tree_grid.add(browseTree);/*ww w.j a v  a  2  s . c o  m*/
    instance_link.add(instance_grid);
    instance_link.addStyleName("treeAndGrid");
    instance_grid.addStyleName("treeAndGrid");

    instance_link.add(link);
    instance_link.add(to_content);

    queryPanel.add(ontologies);
    queryPanel.add(ontology_Classes);
    queryPanel.add(property_Resources);
    queryPanel.add(property_Literals);
    queryPanel.add(subjectQuery);

    queryPanel.add(queryButton);
    tree_grid.add(instance_link);
    tree_grid.add(queryPanel);
    page2Panel.add(entercontext);
    page2Panel.add(tree_grid);
    page2Panel.addStyleName("treeAndGrid");
    ClickHandler link_to_page = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            logger.log(Level.SEVERE, "URL: " + link_to_content_page);
            Window.open(link_to_content_page, "Content Page",
                    "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
        }

    };
    ClickHandler getWebsite = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            com.google.gwt.user.client.ui.HTMLTable.Cell cell = instance_grid.getCellForEvent(event);

            instance_grid.getRowFormatter().removeStyleName(rowIndex, "selectCell");
            int cellIndex = cell.getCellIndex();
            rowIndex = cell.getRowIndex();
            instance_grid.removeStyleName("selectCell");
            if (cellIndex == 0) {
                instance_grid.getRowFormatter().addStyleName(rowIndex, "selectCell");
                // instance_grid.getColumnFormatter().addStyleName(cellIndex,
                // "selectCell");
                link_to_content_page = instance_grid.getText(rowIndex, 0);
                link_to_content_page = link_to_content_page.substring(0, link_to_content_page.lastIndexOf('/'));
                logger.log(Level.SEVERE, "URL: " + link_to_content_page);
            }

        }
    };
    ClickHandler page2_queryHandler = new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (subjectQuery.getText().equals("")) {

            }
            logger.log(Level.SEVERE,
                    (subjectQuery.getText()
                            + webBox.getText().concat("/" + subjectQuery.getText().replace(' ', '_')) + " "
                            + ontology.get(ontologies.getSelectedIndex()).getBaseURI()
                            + property_Resources.getItemText(property_Resources.getSelectedIndex()) + " "
                            + ontology.get(ontologies.getSelectedIndex()).getBaseURI()
                            + ontology_Classes.getItemText(ontology_Classes.getSelectedIndex()) + " "
                            + entercontext.getText()));
            instance_grid.removeAllRows();
            greetingService.getQueryInstances(
                    subjectQuery.getText().equals("") ? "NONE"
                            : webBox.getText().concat("/" + subjectQuery.getText().replace(' ', '_')),
                    property_Resources.getItemText(property_Resources.getSelectedIndex()).equals("NONE")
                            ? "NONE"
                            : ontology.get(ontologies.getSelectedIndex()).getBaseURI().concat(
                                    property_Resources.getItemText(property_Resources.getSelectedIndex())),

                    ontology_Classes.getItemText(ontology_Classes.getSelectedIndex()).equals("NONE") ? "NONE"
                            : ontology.get(ontologies.getSelectedIndex()).getBaseURI()
                                    .concat(ontology_Classes.getItemText(ontology_Classes.getSelectedIndex())),
                    entercontext.getText().equals("") ? "NONE" : entercontext.getText(), new queryInstances());
        }

    };
    to_content.addClickHandler(link_to_page);
    instance_grid.addClickHandler(getWebsite);
    queryButton.addClickHandler(page2_queryHandler);
    buildTree(export_path);
    browseTree.addStyleName("treeAndGrid");

    greetingService.getChildren(export_path, "Thing", new TreeRootCallback(browseTree));
    // Gets instances for selected tree item!
    browseTree.addTreeListener(new TreeListener() {

        @Override
        public void onTreeItemSelected(TreeItem item) {
            logger.log(Level.SEVERE, "Item = " + item.getText());
            instance_grid.removeAllRows();
            greetingService.getInstances(export_path, item.getText(), entercontext.getText(),
                    new TreeItemInstances());
        }

        @Override
        public void onTreeItemStateChanged(TreeItem item) {

        }

    });

    instance_grid.setText(0, 0, "Row 1:Col 1");

    RootPanel.get("newList").add(home_page);
    logger.log(Level.SEVERE, "Cleared");
    RootPanel.get("newList").add(page2Panel);
    int left2, top2;
    left2 = Window.getClientWidth() / 5;
    top2 = Window.getClientHeight() / 5;
    // RootPanel.get("newList").add(queryPanel, left2, top2);
}