com.vaadin.server.Page.getCurrent() - java examples

Here are the examples of the java api com.vaadin.server.Page.getCurrent() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

83 Examples 7

19 View Complete Implementation : LoginWindow.java
Copyright The Unlicense
Author : mstahv
private OAuthService createService() {
    ServiceBuilder sb = new ServiceBuilder();
    sb.provider(Google2Api.clreplaced);
    sb.apiKey(gpluskey);
    sb.apiSecret(gplussecret);
    sb.scope("email");
    String callBackUrl = Page.getCurrent().getLocation().toString();
    if (callBackUrl.contains("#")) {
        callBackUrl = callBackUrl.substring(0, callBackUrl.indexOf("#"));
    }
    sb.callback(callBackUrl);
    return sb.build();
}

19 View Complete Implementation : Wizard.java
Copyright Apache License 2.0
Author : tehapo
@Override
public void uriFragmentChanged(UriFragmentChangedEvent event) {
    if (isUriFragmentEnabled()) {
        String fragment = event.getUriFragment();
        if ((fragment == null || fragment.equals("")) && !steps.isEmpty()) {
            // empty fragment -> set the fragment of first step
            Page.getCurrent().setUriFragment(getId(steps.get(0)));
        } else {
            activateStep(fragment);
        }
    }
}

19 View Complete Implementation : AbstractTypeLayout.java
Copyright Eclipse Public License 1.0
Author : eclipse
private static void getDynamicStyles(final String colorPickedPreview) {
    Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.changeToNewSelectedPreviewColor(colorPickedPreview));
}

19 View Complete Implementation : AdminView.java
Copyright Apache License 2.0
Author : korpling
private void setFragmentParameter(String param) {
    Page.getCurrent().setUriFragment("!" + NAME + "/" + param, false);
}

19 View Complete Implementation : NotificationMessage.java
Copyright Eclipse Public License 1.0
Author : eclipse
/**
 * Notification message component.
 *
 * @param styleName
 *            style name of message
 * @param caption
 *            message caption
 * @param description
 *            message description
 * @param autoClose
 *            flag to indicate enable close option
 */
void showNotification(final String styleName, final String caption, final String description, final Boolean autoClose) {
    decorate(styleName, caption, description, autoClose);
    this.show(Page.getCurrent());
}

19 View Complete Implementation : UploadArtifactView.java
Copyright Eclipse Public License 1.0
Author : eclipse
@PostConstruct
void init() {
    buildLayout();
    restoreState();
    checkNoDataAvaialble();
    eventBus.subscribe(this);
    Page.getCurrent().addBrowserWindowResizeListener(this);
    showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
}

19 View Complete Implementation : HelpSplitPanel.java
Copyright GNU General Public License v3.0
Author : rlsutton1
private void buildMainLayout() {
    addComponent((Component) component);
    setExpandRatio((Component) component, 1);
    helpPane = new Panel();
    helpPane.setImmediate(false);
    showHelpLoadingSplash();
    helpSliderPanel = new SliderPanelBuilder(helpPane).expanded(false).mode(SliderMode.RIGHT).tabPosition(SliderTabPosition.MIDDLE).style(SliderPanelStyles.COLOR_BLUE).caption("Help").animationDuration(400).tabSize(30).autoCollapseSlider(true).fixedContentSize((int) (UI.getCurrent().getPage().getBrowserWindowWidth() * 0.75)).build();
    helpLoader = new SlideOutLoader();
    innerSecondPanel = new VerticalLayout();
    innerSecondPanel.setSizeFull();
    innerSecondPanel.setWidth("30");
    innerSecondPanel.addComponent(helpSliderPanel);
    innerSecondPanel.setComponentAlignment(helpSliderPanel, Alignment.MIDDLE_RIGHT);
    addComponent(innerSecondPanel);
    Page.getCurrent().addBrowserWindowResizeListener(new BrowserWindowResizeListener() {

        private static final long serialVersionUID = -8548907013566961812L;

        @Override
        public void browserWindowResized(BrowserWindowResizeEvent event) {
            helpSliderPanel.setFixedContentSize((int) (event.getWidth() * 0.75));
            if (helpSliderPanel.isExpanded()) {
                helpSliderPanel.collapse();
            }
        }
    });
}

19 View Complete Implementation : NoUserSessionHandler.java
Copyright Apache License 2.0
Author : cuba-platform
protected void relogin() {
    String url = ControllerUtils.getLocationWithoutParams() + "?restartApp";
    Page.getCurrent().open(url, "_self");
}

19 View Complete Implementation : WizardsDemoApplication.java
Copyright Apache License 2.0
Author : tehapo
public void activeStepChanged(WizardStepActivationEvent event) {
    // display the step caption as the window replacedle
    Page.getCurrent().setreplacedle(event.getActivatedStep().getCaption());
}

19 View Complete Implementation : UrlChangeHandler.java
Copyright Apache License 2.0
Author : cuba-platform
public void handleUrlChange(Page.PopStateEvent event) {
    if (notSuitableMode()) {
        log.debug("UrlChangeHandler is disabled for '{}' URL handling mode", webConfig.getUrlHandlingMode());
        return;
    }
    int hashIdx = event.getUri().indexOf("#");
    NavigationState requestedState = hashIdx < 0 ? NavigationState.EMPTY : urlTools.parseState(event.getUri().substring(hashIdx + 1));
    if (requestedState == null) {
        log.debug("Unable to handle requested state: '{}'", Page.getCurrent().getUriFragment());
        reloadApp();
        return;
    }
    __handleUrlChange(requestedState);
}

19 View Complete Implementation : Diagram.java
Copyright GNU General Public License v3.0
Author : JumpMind
public void export() {
    // Lookup how large the canvas needs to be based on node positions.
    int maxHeight = 0;
    int maxWidth = 0;
    for (Node node : getState().nodes) {
        if (node.getX() > maxWidth) {
            maxWidth = node.getX();
        }
        if (node.getY() > maxHeight) {
            maxHeight = node.getY();
        }
    }
    // Pad Boundary to include text and margins.
    maxWidth += 200;
    maxHeight += 200;
    // Call client side code to create the canvas and display it.
    Page.getCurrent().getJavaScript().execute("exportDiagram(" + maxWidth + "," + maxHeight + ");");
}

19 View Complete Implementation : AuthorizationFailureEventListener.java
Copyright Apache License 2.0
Author : Hack23
@Override
public void onApplicationEvent(final AuthorizationFailureEvent authorizationFailureEvent) {
    final String sessionId = RequestContextHolder.currentRequestAttributes().getSessionId();
    final CreateApplicationEventRequest serviceRequest = new CreateApplicationEventRequest();
    serviceRequest.setSessionId(sessionId);
    serviceRequest.setEventGroup(ApplicationEventGroup.APPLICATION);
    serviceRequest.setApplicationOperation(ApplicationOperationType.AUTHORIZATION);
    serviceRequest.setUserId(UserContextUtil.getUserIdFromSecurityContext());
    final Page currentPageIfAny = Page.getCurrent();
    final String requestUrl = UserContextUtil.getRequestUrl(currentPageIfAny);
    final UI currentUiIfAny = UI.getCurrent();
    String methodInfo = "";
    if (currentPageIfAny != null && currentUiIfAny != null && currentUiIfAny.getNavigator() != null && currentUiIfAny.getNavigator().getCurrentView() != null) {
        serviceRequest.setPage(currentUiIfAny.getNavigator().getCurrentView().getClreplaced().getSimpleName());
        serviceRequest.setPageMode(currentPageIfAny.getUriFragment());
    }
    if (authorizationFailureEvent.getSource() instanceof ReflectiveMethodInvocation) {
        final ReflectiveMethodInvocation methodInvocation = (ReflectiveMethodInvocation) authorizationFailureEvent.getSource();
        if (methodInvocation != null && methodInvocation.getThis() != null) {
            methodInfo = new StringBuilder().append(methodInvocation.getThis().getClreplaced().getSimpleName()).append('.').append(methodInvocation.getMethod().getName()).toString();
        }
    }
    final Collection<? extends GrantedAuthority> authorities = authorizationFailureEvent.getAuthentication().getAuthorities();
    final Collection<ConfigAttribute> configAttributes = authorizationFailureEvent.getConfigAttributes();
    serviceRequest.setErrorMessage(MessageFormat.format(ERROR_MESSAGE_FORMAT, requestUrl, methodInfo, AUTHORITIES, authorities, REQUIRED_AUTHORITIES, configAttributes, authorizationFailureEvent.getSource()));
    serviceRequest.setApplicationMessage(ACCESS_DENIED);
    applicationManager.service(serviceRequest);
    LOGGER.info(LOG_MSG_AUTHORIZATION_FAILURE_SESSION_ID_AUTHORITIES_REQUIRED_AUTHORITIES, requestUrl.replaceAll(CRLF, CRLF_REPLACEMENT), methodInfo.replaceAll(CRLF, CRLF_REPLACEMENT), sessionId.replaceAll(CRLF, CRLF_REPLACEMENT), authorities, configAttributes);
}

19 View Complete Implementation : CubaImage.java
Copyright Apache License 2.0
Author : cuba-platform
@Override
public void attach() {
    super.attach();
    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isIE() || webBrowser.isEdge()) {
        CubaImageObjectFitPolyfillExtension.get(getUI());
    }
}

19 View Complete Implementation : SearchView.java
Copyright Apache License 2.0
Author : korpling
@Override
public void onLogin() {
    getControlPanel().getCorpusList().updateCorpusSetList(true);
    // re-evaluate the fragment in case a corpus is now accessible
    evaluateFragment(Page.getCurrent().getUriFragment());
}

19 View Complete Implementation : SQLPIPConfigurationComponent.java
Copyright MIT License
Author : att
protected void testJDBCConnection() {
    try {
        if (this.comboBoxSQLDriver.getValue() != null) {
            Clreplaced.forName(this.comboBoxSQLDriver.getValue().toString());
        } else {
            throw new ClreplacedNotFoundException("Please select a JDBC driver to load.");
        }
    } catch (ClreplacedNotFoundException e) {
        logger.error(e);
        new Notification("Driver Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Is the JDBC driver's jar in the J2EE container path?", Type.ERROR_MESSAGE, true).show(Page.getCurrent());
        return;
    }
    Connection connection = null;
    try {
        connection = DriverManager.getConnection(this.textFieldConnectionURL.getValue(), this.textFieldUser.getValue(), this.textFieldPreplacedword.getValue());
        new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
    } catch (SQLException e) {
        logger.error(e);
        new Notification("SQL Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?", Type.ERROR_MESSAGE, true).show(Page.getCurrent());
    } finally {
        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException idontcare) {
            }
        }
    }
}

19 View Complete Implementation : NexbitAppLoginWindow.java
Copyright Apache License 2.0
Author : pfurini
@Override
public void init(Map<String, Object> params) {
    super.init(params);
    Page.getCurrent().getStyles().add(".nx-reset-button{padding-left:0 !important;}");
    if (forgotPreplacedwordConfig.getShowResetPreplacedwordLinkAtLogin()) {
        resetPreplacedwordSpacer.setVisible(true);
        resetPreplacedwordButton.setVisible(true);
    }
}

19 View Complete Implementation : SwModuleTable.java
Copyright Eclipse Public License 1.0
Author : eclipse
private void styleTableOnDistSelection() {
    Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.getScriptSMHighlightReset());
    setCellStyleGenerator(new Table.CellStyleGenerator() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getStyle(final Table source, final Object itemId, final Object propertyId) {
            return createTableStyle(itemId, propertyId);
        }
    });
}

19 View Complete Implementation : WizardView.java
Copyright GNU General Public License v3.0
Author : rlsutton1
@Override
public void stepSetChanged(WizardStepSetChangedEvent event) {
    Page.getCurrent().setreplacedle(event.getComponent().getCaption());
}

19 View Complete Implementation : LDAPPIPConfigurationComponent.java
Copyright Apache License 2.0
Author : apache
protected void testLDAPConnection() {
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, this.textFieldFactory.getValue());
    env.put(Context.PROVIDER_URL, this.textFieldProviderURL.getValue());
    env.put(Context.SECURITY_PRINCIPAL, this.textFieldPrincipal.getValue());
    env.put(Context.SECURITY_CREDENTIALS, this.textFieldCredentials.getValue());
    String auth = this.comboBoxAuthentication.getValue().toString();
    env.put(Context.SECURITY_AUTHENTICATION, auth);
    // 
    // Do we need to do anything?
    // 
    /*
		if (auth.equals(LDAP_AUTH_ANONYMOUS)) {
			
		} else if (auth.equals(LDAP_AUTH_SIMPLE)) {
			
		} else if (auth.equals(LDAP_AUTH_SASL)) {
			
		}
		*/
    DirContext ctx = null;
    try {
        ctx = new InitialDirContext(env);
        new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
    } catch (NamingException e) {
        logger.error(e);
        new Notification("Connection Failed", "<br/>" + e.getLocalizedMessage(), Type.ERROR_MESSAGE, true).show(Page.getCurrent());
    } finally {
        try {
            if (ctx != null) {
                ctx.close();
            }
        } catch (NamingException idontcare) {
        // NOPMD
        }
    }
}

19 View Complete Implementation : Wizard.java
Copyright Apache License 2.0
Author : tehapo
public void setUriFragmentEnabled(boolean enabled) {
    if (enabled) {
        Page.getCurrent().addUriFragmentChangedListener(this);
    } else {
        Page.getCurrent().removeUriFragmentChangedListener(this);
    }
    uriFragmentEnabled = enabled;
}

19 View Complete Implementation : DeploymentView.java
Copyright Eclipse Public License 1.0
Author : eclipse
@PostConstruct
void init() {
    buildLayout();
    restoreState();
    checkNoDataAvaialble();
    Page.getCurrent().addBrowserWindowResizeListener(this);
    showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
    getEventBus().publish(this, ManagementUIEvent.SHOW_COUNT_MESSAGE);
}

19 View Complete Implementation : BulkUploadHandler.java
Copyright Eclipse Public License 1.0
Author : eclipse
@Override
public void uploadStarted(final StartedEvent event) {
    if (!event.getFilename().endsWith(".csv")) {
        new HawkbitErrorNotificationMessage(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null, i18n.getMessage("bulk.targets.upload"), true).show(Page.getCurrent());
        LOG.error("Wrong file format for file {}", event.getFilename());
        upload.interruptUpload();
    } else {
        eventBus.publish(this, new TargetTableEvent(TargetComponentEvent.BULK_TARGET_UPLOAD_STARTED));
    }
}

19 View Complete Implementation : SQLPIPConfigurationComponent.java
Copyright Apache License 2.0
Author : apache
protected void testJDBCConnection() {
    try {
        if (this.comboBoxSQLDriver.getValue() != null) {
            Clreplaced.forName(this.comboBoxSQLDriver.getValue().toString());
        } else {
            throw new ClreplacedNotFoundException("Please select a JDBC driver to load.");
        }
    } catch (ClreplacedNotFoundException e) {
        logger.error(e);
        new Notification("Driver Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Is the JDBC driver's jar in the J2EE container path?", Type.ERROR_MESSAGE, true).show(Page.getCurrent());
        return;
    }
    Connection connection = null;
    try {
        connection = DriverManager.getConnection(this.textFieldConnectionURL.getValue(), this.textFieldUser.getValue(), this.textFieldPreplacedword.getValue());
        new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
    } catch (SQLException e) {
        logger.error(e);
        new Notification("SQL Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?", Type.ERROR_MESSAGE, true).show(Page.getCurrent());
    } finally {
        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException idontcare) {
            // NOPMD
            }
        }
    }
}

19 View Complete Implementation : ShortCutModifierUtils.java
Copyright Eclipse Public License 1.0
Author : eclipse
/**
 * Returns the ctrl or meta modifier depending on the platform.
 *
 * @return on mac return
 *         {@link com.vaadin.event.ShortcutAction.ModifierKey#META} other
 *         platform return
 *         {@link com.vaadin.event.ShortcutAction.ModifierKey#CTRL}
 */
public static int getCtrlOrMetaModifier() {
    final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isMacOSX()) {
        return ShortcutAction.ModifierKey.META;
    }
    return ShortcutAction.ModifierKey.CTRL;
}

19 View Complete Implementation : UrlTools.java
Copyright Apache License 2.0
Author : cuba-platform
/**
 * INTERNAL
 *
 * @return whether application is running in headless mode
 */
public static boolean headless() {
    Page current = Page.getCurrent();
    if (current == null) {
        return true;
    }
    return current.getUI().getSession() == null;
}

19 View Complete Implementation : TopBarButtonHelp.java
Copyright GNU General Public License v3.0
Author : JumpMind
protected void openHelp(ClickEvent event) {
    String docUrl = Page.getCurrent().getLocation().toString();
    docUrl = docUrl.substring(0, docUrl.lastIndexOf("/"));
    Page.getCurrent().open(docUrl + "/doc/html/user-guide.html", "doc");
}

19 View Complete Implementation : ExportDialog.java
Copyright GNU General Public License v3.0
Author : JumpMind
protected void downloadExport(final String export, String filename) {
    StreamSource ss = new StreamSource() {

        private static final long serialVersionUID = 1L;

        public InputStream getStream() {
            try {
                return new ByteArrayInputStream(export.getBytes(Charset.forName("utf-8")));
            } catch (Exception e) {
                log.error("Failed to export configuration", e);
                CommonUiUtils.notify("Failed to export configuration.", Type.ERROR_MESSAGE);
                return null;
            }
        }
    };
    String datetime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
    StreamResource resource = new StreamResource(ss, String.format("%s-config-%s.json", filename, datetime));
    final String KEY = "export";
    setResource(KEY, resource);
    Page.getCurrent().open(ResourceReference.create(resource, this, KEY).getURL(), null);
}

19 View Complete Implementation : CubaCopyButtonExtension.java
Copyright Apache License 2.0
Author : cuba-platform
public static boolean browserSupportCopy() {
    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    return !webBrowser.isSafari() && !webBrowser.isIOS() && !webBrowser.isWindowsPhone();
}

19 View Complete Implementation : ExecutionRunPanel.java
Copyright GNU General Public License v3.0
Author : JumpMind
protected void download() {
    String stepId = null;
    if (showDiagramCheckbox.getValue()) {
        if (diagram.getSelectedNodeIds().size() > 0) {
            String flowStepId = diagram.getSelectedNodeIds().get(0);
            ExecutionData data = getExecutionData();
            if (data != null) {
                ExecutionStep executionStep = data.findExecutionStep(flowStepId);
                if (executionStep != null) {
                    stepId = executionStep.getId();
                }
            }
        }
    } else {
        stepId = (String) stepTable.getSelectedRow();
    }
    if (stepId != null) {
        final File file = executionService.getExecutionStepLog(stepId);
        StreamSource ss = new StreamSource() {

            private static final long serialVersionUID = 1L;

            public InputStream getStream() {
                try {
                    return new FileInputStream(file);
                } catch (Exception e) {
                    log.error("Failed to download log file", e);
                    CommonUiUtils.notify("Failed to download log file", Type.ERROR_MESSAGE);
                    return null;
                }
            }
        };
        StreamResource resource = new StreamResource(ss, file.getName());
        final String KEY = "export";
        setResource(KEY, resource);
        Page.getCurrent().open(ResourceReference.create(resource, this, KEY).getURL(), null);
    }
}

19 View Complete Implementation : LDAPPIPConfigurationComponent.java
Copyright MIT License
Author : att
protected void testLDAPConnection() {
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, this.textFieldFactory.getValue());
    env.put(Context.PROVIDER_URL, this.textFieldProviderURL.getValue());
    env.put(Context.SECURITY_PRINCIPAL, this.textFieldPrincipal.getValue());
    env.put(Context.SECURITY_CREDENTIALS, this.textFieldCredentials.getValue());
    String auth = this.comboBoxAuthentication.getValue().toString();
    env.put(Context.SECURITY_AUTHENTICATION, auth);
    // 
    // Do we need to do anything?
    // 
    if (auth.equals(LDAP_AUTH_ANONYMOUS)) {
    } else if (auth.equals(LDAP_AUTH_SIMPLE)) {
    } else if (auth.equals(LDAP_AUTH_SASL)) {
    }
    DirContext ctx = null;
    try {
        ctx = new InitialDirContext(env);
        new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
    } catch (NamingException e) {
        logger.error(e);
        new Notification("Connection Failed", "<br/>" + e.getLocalizedMessage(), Type.ERROR_MESSAGE, true).show(Page.getCurrent());
    } finally {
        try {
            if (ctx != null) {
                ctx.close();
            }
        } catch (NamingException idontcare) {
        }
    }
}

19 View Complete Implementation : ReportBugWindow.java
Copyright Apache License 2.0
Author : korpling
private boolean sendBugReport(String bugEMailAddress, byte[] screenImage, String imageMimeType) {
    MultiPartEmail mail = new MultiPartEmail();
    try {
        // server setup
        mail.setHostName("localhost");
        // content of the mail
        mail.addReplyTo(form.getField("email").getValue().toString(), form.getField("name").getValue().toString());
        mail.setFrom(bugEMailAddress);
        mail.addTo(bugEMailAddress);
        mail.setSubject("[ANNIS BUG] " + form.getField("summary").getValue().toString());
        // TODO: add info about version etc.
        StringBuilder sbMsg = new StringBuilder();
        sbMsg.append("Reporter: ").append(form.getField("name").getValue().toString()).append(" (").append(form.getField("email").getValue().toString()).append(")\n");
        sbMsg.append("Version: ").append(VersionInfo.getVersion()).append("\n");
        sbMsg.append("Vaadin Version: ").append(Version.getFullVersion()).append("\n");
        sbMsg.append("Browser: ").append(Page.getCurrent().getWebBrowser().getBrowserApplication()).append("\n");
        sbMsg.append("URL: ").append(UI.getCurrent().getPage().getLocation().toASCIIString()).append("\n");
        sbMsg.append("\n");
        sbMsg.append(form.getField("description").getValue().toString());
        mail.setMsg(sbMsg.toString());
        if (screenImage != null) {
            mail.attach(new ByteArrayDataSource(screenImage, imageMimeType), "screendump.png", "Screenshot of the browser content at time of problem report");
        }
        File logfile = new File(VaadinService.getCurrent().getBaseDirectory(), "/WEB-INF/log/annis-gui.log");
        if (logfile.exists() && logfile.isFile() && logfile.canRead()) {
            mail.attach(new FileDataSource(logfile), "annis-gui.log", "Logfile of the GUI (shared by all users)");
        }
        if (cause != null) {
            try {
                mail.attach(new ByteArrayDataSource(Helper.convertExceptionToMessage(cause), "text/plain"), "exception.txt", "Exception that caused the user to report the problem");
            } catch (IOException ex) {
                log.error(null, ex);
            }
        }
        mail.send();
        return true;
    } catch (EmailException ex) {
        Notification.show("E-Mail not configured on server", "If this is no Kickstarter version please ask the administrator (" + bugEMailAddress + ") of this ANNIS-instance for replacedistance. " + "Problem reports are not available for ANNIS Kickstarter", Notification.Type.ERROR_MESSAGE);
        log.error(null, ex);
        return false;
    }
}

19 View Complete Implementation : CubaPickerField.java
Copyright Apache License 2.0
Author : cuba-platform
protected void initLayout() {
    container = new CubaCssActionsLayout();
    container.setPrimaryStyleName(LAYOUT_STYLENAME);
    container.setWidth(100, Unit.PERCENTAGE);
    field.setWidth(100, Unit.PERCENTAGE);
    Page current = Page.getCurrent();
    if (current != null) {
        WebBrowser browser = current.getWebBrowser();
        if (browser != null && browser.isSafari()) {
            inputWrapper = new CssLayout();
            inputWrapper.setWidth(100, Unit.PERCENTAGE);
            inputWrapper.setPrimaryStyleName("safari-input-wrap");
            inputWrapper.addComponent(field);
            container.addComponent(inputWrapper);
        } else {
            container.addComponent(field);
        }
    } else {
        container.addComponent(field);
    }
    setFocusDelegate((Focusable) field);
}

19 View Complete Implementation : SecuredNavigator.java
Copyright Apache License 2.0
Author : markoradinovic
private String extractViewToken() {
    String uriFragment = Page.getCurrent().getUriFragment();
    if (uriFragment != null && !uriFragment.isEmpty() && uriFragment.length() > 1) {
        return uriFragment.substring(1);
    } else {
        return "";
    }
}

19 View Complete Implementation : CmsLoginController.java
Copyright GNU Lesser General Public License v2.1
Author : alkacon
/**
 * Logs the current user out by invalidating the session an reloading the current URI.<p>
 * Important:  This works only within vaadin apps.<p>
 */
public static void logout() {
    CmsObject cms = A_CmsUI.getCmsObject();
    if (UI.getCurrent() instanceof CmsAppWorkplaceUi) {
        ((CmsAppWorkplaceUi) UI.getCurrent()).onWindowClose();
    }
    String loggedInUser = cms.getRequestContext().getCurrentUser().getName();
    UI.getCurrent().getSession().close();
    String loginLink = OpenCms.getLinkManager().subsreplaceduteLinkForUnknownTarget(cms, CmsWorkplaceLoginHandler.LOGIN_HANDLER, false);
    VaadinService.getCurrentRequest().getWrappedSession().invalidate();
    Page.getCurrent().setLocation(loginLink);
    // logout was successful
    if (LOG.isInfoEnabled()) {
        LOG.info(org.opencms.jsp.Messages.get().getBundle().key(org.opencms.jsp.Messages.LOG_LOGOUT_SUCCESFUL_3, loggedInUser, "{workplace logout option}", cms.getRequestContext().getRemoteAddress()));
    }
}

19 View Complete Implementation : VerticalTabsheet.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void addTab(String parentId, String id, String caption, String link, Resource resource) {
    if (!hasTab(id)) {
        ButtonTab tab = new ButtonTab(id, caption, link);
        tab.addClickListener(clickEvent -> {
            if (!clickEvent.isCtrlKey() && !clickEvent.isMetaKey()) {
                if (selectedComp != tab) {
                    setSelectedTab(tab);
                }
                fireTabChangeEvent(new SelectedTabChangeEvent(VerticalTabsheet.this, true));
            } else {
                Page.getCurrent().open(tab.link, "_blank", false);
            }
        });
        tab.setIcon(resource);
        tab.withStyleName(TAB_STYLE, WebThemes.TEXT_ELLIPSIS).withFullWidth();
        if (parentId == null) {
            navigatorContainer.addComponent(tab);
        } else {
            ButtonTab parentTab = compMap.get(parentId);
            if (parentTab != null) {
                parentTab.addSubTab(tab);
                navigatorContainer.addComponent(tab);
                parentTab.addStyleName("collapsed-tab");
                tab.addStyleName("child-tab");
                tab.addStyleName("hide");
                if (parentTab.getListeners(Button.ClickEvent.clreplaced).size() < 2) {
                    parentTab.addClickListener((Button.ClickListener) event -> parentTab.toggleGroupTabDisplay());
                }
            } else {
                throw new MyCollabException("Not found parent tab with id " + parentId);
            }
        }
        compMap.put(id, tab);
    } else {
        throw new MyCollabException("Existing tab has id " + id);
    }
}

19 View Complete Implementation : DistributionsView.java
Copyright Eclipse Public License 1.0
Author : eclipse
@PostConstruct
void init() {
    buildLayout();
    restoreState();
    checkNoDataAvaialble();
    Page.getCurrent().addBrowserWindowResizeListener(this);
    showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth());
}

19 View Complete Implementation : NexbitLoginScreen.java
Copyright Apache License 2.0
Author : pfurini
@Override
protected void onInit(InitEvent event) {
    super.onInit(event);
    Page.getCurrent().getStyles().add(".nx-reset-button{padding-left:0 !important;}");
    if (forgotPreplacedwordConfig.getShowResetPreplacedwordLinkAtLogin()) {
        resetPreplacedwordSpacer.setVisible(true);
        resetPreplacedwordButton.setVisible(true);
    }
}

19 View Complete Implementation : UIWindowOverVaadinUI.java
Copyright Apache License 2.0
Author : consulo
@RequiredUIAccess
@Override
public void setreplacedle(@Nonnull String replacedle) {
    Page.getCurrent().setreplacedle(replacedle);
}

19 View Complete Implementation : WizardView.java
Copyright GNU General Public License v3.0
Author : rlsutton1
private void endWizard(String message) {
    wizard.setVisible(false);
    Notification.show(message);
    Page.getCurrent().setreplacedle(message);
    Page.getCurrent().setLocation("");
}

19 View Complete Implementation : AbstractTagLayout.java
Copyright Eclipse Public License 1.0
Author : eclipse
/**
 * Get target style - Dynamically as per the color picked, cannot be done
 * from the static css.
 *
 * @param colorPickedPreview
 */
private static void getTargetDynamicStyles(final String colorPickedPreview) {
    Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.changeToNewSelectedPreviewColor(colorPickedPreview));
}

19 View Complete Implementation : DemoUI.java
Copyright The Unlicense
Author : rolandkrueger
private void registerNavigationLogging() {
    Page.getCurrent().addUriFragmentChangedListener(this);
}

19 View Complete Implementation : CmsToolBar.java
Copyright GNU Lesser General Public License v2.1
Author : alkacon
/**
 * Recalculates the space required by the toolbar buttons.<p>
 */
protected void updateFoldingThreshhold() {
    int left = estimateRequiredWidth(m_itemsLeft) + estimateRequiredWidth(m_leftButtons);
    int right = estimateRequiredWidth(m_itemsRight) + estimateRequiredWidth(m_rightButtons);
    int requiredWidth = left > right ? left : right;
    if (requiredWidth < 350) {
        // folding not required at any width
        m_foldingThreshhold = 0;
    } else if (requiredWidth < 400) {
        m_foldingThreshhold = 984;
    } else if (requiredWidth <= 520) {
        m_foldingThreshhold = 1240;
    } else {
        // always fold
        m_foldingThreshhold = 10000;
    }
    updateButtonVisibility(Page.getCurrent().getBrowserWindowWidth());
}

19 View Complete Implementation : Wizard.java
Copyright Apache License 2.0
Author : tehapo
private void updateUriFragment() {
    if (isUriFragmentEnabled()) {
        String currentStepId = getId(currentStep);
        if (currentStepId != null && currentStepId.length() > 0) {
            Page.getCurrent().setUriFragment(currentStepId, false);
        } else {
            Page.getCurrent().setUriFragment(null, false);
        }
    }
}

19 View Complete Implementation : AbstractHawkbitLoginUI.java
Copyright Eclipse Public License 1.0
Author : eclipse
private static boolean isUnsupportedBrowser() {
    final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    return webBrowser.isIE() && webBrowser.getBrowserMajorVersion() < 11;
}

19 View Complete Implementation : WebExportDisplay.java
Copyright Apache License 2.0
Author : cuba-platform
protected boolean isIOS() {
    return Page.getCurrent().getWebBrowser().isIOS();
}

19 View Complete Implementation : CmsEditor.java
Copyright GNU Lesser General Public License v2.1
Author : alkacon
/**
 * Navigates to the back link target.<p>
 *
 * @param backlink the back link
 */
public static void openBackLink(String backlink) {
    try {
        backlink = URLDecoder.decode(backlink, "UTF-8");
        String current = Page.getCurrent().getLocation().toString();
        if (current.contains("#")) {
            current = current.substring(0, current.indexOf("#"));
        }
        // check if the back link targets the workplace UI
        if (backlink.startsWith(current)) {
            // use the navigator to open the target
            String target = backlink.substring(backlink.indexOf("#") + 1);
            CmsAppWorkplaceUi.get().getNavigator().navigateTo(target);
        } else {
            // otherwise set the new location
            Page.getCurrent().setLocation(backlink);
        }
    } catch (UnsupportedEncodingException e) {
        // only in case of malformed charset
        LOG.error(e.getLocalizedMessage(), e);
    }
}

19 View Complete Implementation : CmsSiteSelectDialog.java
Copyright GNU Lesser General Public License v2.1
Author : alkacon
/**
 * Actually changes the site.
 *
 * @param context the dialog context
 * @param siteRoot the site root
 */
public static void changeSite(I_CmsDialogContext context, String siteRoot) {
    if (!context.getCms().getRequestContext().getSiteRoot().equals(siteRoot)) {
        A_CmsUI.get().changeSite(siteRoot);
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot) || OpenCms.getSiteManager().isSharedFolder(siteRoot)) {
            // switch to explorer view when selecting shared or root site
            Page.getCurrent().open(CmsCoreService.getFileExplorerLink(A_CmsUI.getCmsObject(), siteRoot), "_top");
            return;
        }
    } else {
        siteRoot = null;
    }
    context.finish(null, siteRoot);
}

19 View Complete Implementation : SQLPIPConfigurationComponent.java
Copyright Apache License 2.0
Author : apache
protected void testJNDIConnection() {
    try {
        Context initialContext = new InitialContext();
        DataSource dataSource = (DataSource) initialContext.lookup(this.textFieldDataSource.getValue());
        try (Connection connection = dataSource.getConnection()) {
            new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent());
        }
    } catch (NamingException e) {
        logger.error(e);
        new Notification("JNDI Naming Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Is the context defined in this J2EE Container instance?", Type.ERROR_MESSAGE, true).show(Page.getCurrent());
    } catch (SQLException e) {
        logger.error(e);
        new Notification("SQL Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?", Type.ERROR_MESSAGE, true).show(Page.getCurrent());
    }
}

19 View Complete Implementation : WebUrlRouting.java
Copyright Apache License 2.0
Author : cuba-platform
@Override
public NavigationState getState() {
    if (UrlHandlingMode.URL_ROUTES != webConfig.getUrlHandlingMode()) {
        log.debug("UrlRouting is disabled for '{}' URL handling mode", webConfig.getUrlHandlingMode());
        return NavigationState.EMPTY;
    }
    if (UrlTools.headless()) {
        log.debug("Unable to resolve navigation state in headless mode");
        return NavigationState.EMPTY;
    }
    return urlTools.parseState(Page.getCurrent().getLocation().getRawFragment());
}

19 View Complete Implementation : TopBar.java
Copyright GNU General Public License v3.0
Author : JumpMind
protected void logout() {
    URI uri = Page.getCurrent().getLocation();
    VaadinSession.getCurrent().close();
    Page.getCurrent().setLocation(uri.getPath());
}