Java Code Examples for com.smartgwt.client.util.SC#say()

The following examples show how to use com.smartgwt.client.util.SC#say() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubscriptionListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
protected ClickHandler createDeleteHandler(final ListGridRecord ruleRecord) {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            boolean subscribed = ruleRecord.getAttributeAsBoolean(SUBSCRIBED).booleanValue();
            if (subscribed) {
                SC.say(i18n.deleteOnlyWhenUnsubbscribed());
            } else {
                SC.ask(i18n.deleteSubscriptionQuestion(), new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                        if (value) {
                            String role = getLoggedInUserRole();
                            String uuid = ruleRecord.getAttribute(UUID);
                            getMainEventBus().fireEvent(new DeleteRuleEvent(currentSession(), uuid, role));
                            removeData(ruleRecord);
                        }
                    }
                });
            }
        }
    };
}
 
Example 2
Source File: ExportAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
protected final void dsAddData(DataSource dataSource, Record record, DSCallback dsCallback, DSRequest dsRequest) {
    DynamicForm optionsForm = createOptionsForm();

    if (optionsForm == null) {
        dataSource.addData(record, dsCallback, dsRequest);
        SC.say(i18n.ExportAction_Sent_Msg());
        return;
    }

    Dialog d = new Dialog(i18n.ExportAction_Request_Title());
    d.getDialogContentContainer().addMember(optionsForm);

    IButton okButton = d.addOkButton((ClickEvent eventX) -> {
        setRequestOptions(record);
        dataSource.addData(record, dsCallback, dsRequest);
        d.destroy();
        SC.say(i18n.ExportAction_Sent_Msg());
    });

    d.addCancelButton(() -> d.destroy());
    d.setWidth(400);
    d.show();

    okButton.focus();
}
 
Example 3
Source File: RegisterLayout.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
protected void register() {
    form.validate(true);

    if (RegisterLayout.this.form.validate() && (Boolean) RegisterLayout.this.acceptBox.getValue()) {
        String userName = (String) RegisterLayout.this.userNameItem.getValue();
        String name = (String) RegisterLayout.this.nameItem.getValue();
        String password = DataControlsSes.createMD5((String) RegisterLayout.this.passwordItem.getValue());
        String eMail = (String) RegisterLayout.this.emailItem.getValue();
        boolean activated = false;
        
        if (name == null || name.equals("")) {
            name = "";
        }
        // create user without parameterId and register
        UserDTO u = new UserDTO(userName, name, password, eMail, NOT_REGISTERED_USER, activated, new Date());
        EventBus.getMainEventBus().fireEvent(new RegisterUserEvent(u));
    } else if (RegisterLayout.this.form.validate() && !(Boolean) RegisterLayout.this.acceptBox.getValue()) {
        SC.say(i18n.acceptTermsOfUseInfo());
    }
}
 
Example 4
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
public void copy(final String userID, String ruleName) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        public void onSuccess(SesClientResponse result) {
            if (result.getType().equals(SesClientResponseType.OK)) {
                EventBus.getMainEventBus().fireEvent(new GetAllOwnRulesEvent(currentSession(), true));
            }
            else if (result.getType().equals(SesClientResponseType.RULE_NAME_EXISTS)) {
                SC.say(i18n.copyExists());
            }
        }
    };
    this.sesRulesService.copy(userID, ruleName, callback);
}
 
Example 5
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
public void deleteProfile(final SessionInfo sessionInfo) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        @Override
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        @Override
        public void onSuccess(SesClientResponse result) {
            if (result.getType() == REQUIRES_LOGIN) {
            	handleRelogin();
            }
            SC.say(i18n.profileDelete());
        }
    };
    sesUserService.requestToDeleteProfile(sessionInfo, callback);
}
 
Example 6
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sends a new password to ther user's email if it matches the registered one.
 * 
 * @param name
 *        the username
 * @param email
 *        the email
 */
public void newPassword(String name, String email) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        @Override
        public void onFailure(Throwable arg0) {
            getToasterInstance().addErrorMessage(i18n.failedGeneratePassword());
        }

        @Override
        public void onSuccess(SesClientResponse response) {
            if (response.getType() != NEW_PASSWORD_OK) {
                SC.say(i18n.invalidNewPasswordInputs());
            }
            else {
                SC.say(i18n.passwordSended());
                getMainEventBus().fireEvent(new ChangeLayoutEvent(LayoutType.LOGIN));
            }
        }
    };
    sesUserService.resetPassword(name, email, callback);
}
 
Example 7
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
public void deleteUser(final SessionInfo sessionInfo, String userIdToDelete) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        @Override
        public void onFailure(Throwable arg0) {
            getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        @Override
        public void onSuccess(SesClientResponse result) {
            final SessionInfo currentSession = currentSession();
            if (result.getType() == REQUIRES_LOGIN) {
            	handleRelogin();
            }
            else if (result.getType().equals(LAST_ADMIN)) {
                SC.say(i18n.lastAdmin());
            }
            if ( !ClientSessionManager.isAdminLogin()) {
                getMainEventBus().fireEvent(new LogoutEvent(currentSession));
            }
            if (ClientSessionManager.isAdminLogin()) {
                getMainEventBus().fireEvent(new GetAllUsersEvent(currentSession));
            }
        }
    };
    sesUserService.deleteUser(sessionInfo, userIdToDelete, callback);
}
 
Example 8
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
public void deleteRule(final SessionInfo sessionInfo, String uuid, final String role) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        public void onSuccess(SesClientResponse response) {
            if (response.getType() == REQUIRES_LOGIN) {
            	handleRelogin();
            }
            else if (response.getType().equals(DELETE_RULE_SUBSCRIBED)) {
                SC.say(i18n.ruleSubscribed());
            }
            else {
                // update list
                if (role.equals("ADMIN")) {
                    getMainEventBus().fireEvent(new GetAllRulesEvent(sessionInfo));
                }
                else {
                    getMainEventBus().fireEvent(new GetAllOwnRulesEvent(sessionInfo, true));
                }
            }
        }
    };
    this.sesRulesService.deleteRule(sessionInfo, uuid, callback);
}
 
Example 9
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
public void createBasicRule(final SessionInfo sessionInfo, Rule rule, boolean edit, String oldRuleName) {

        ServerCallback<SesClientResponse> callback = new CreateSimpleRuleCallback(this, "Could not create rule.") {
            @Override
            public void onSuccess(SesClientResponse result) {
                if (result.getType() == REQUIRES_LOGIN) {
                	handleRelogin();
                }
                else if (result.getType() == RULE_NAME_NOT_EXISTS) {
                    Rule basicRule = result.getBasicRule();
                    EventBus.getMainEventBus().fireEvent(new RuleCreatedEvent(basicRule));
                }
                else {
                    // TODO handle more result types
                    SC.say(i18n.creatingRuleWasUnsuccessful());
                }
            }
        };
        this.sesRulesService.createBasicRule(sessionInfo, rule, edit, oldRuleName, callback);
    }
 
Example 10
Source File: LoginHeaderLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onChangeRole(SetRoleEvent evt) {
    UserRole role = evt.getRole();
    if (role == LOGOUT) {
              loginHeaderLayout.showLoggedOutHeader();
              SC.say(i18n.logoutSuccessful());
          } else if (role == USER || role == ADMIN) {
              loginHeaderLayout.showUserAsLoggedIn();
          }
}
 
Example 11
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void createComplexRule(final SessionInfo sessionInfo, ComplexRuleData rule, boolean edit, String oldName) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        public void onSuccess(SesClientResponse result) {

            if (REQUIRES_LOGIN == result.getType()) {
            	handleRelogin();
            }
            else if (result.getType().equals(RULE_NAME_EXISTS)) {
                SC.say(i18n.ruleExists());
            }
            else if (result.getType().equals(OK)) {
                SC.say(i18n.creationSuccessful());
                if (isUserLogin()) {
                    getMainEventBus().fireEvent(new ChangeLayoutEvent(ABOS));
                }
                else if (isAdminLogin()) {
                    getMainEventBus().fireEvent(new ChangeLayoutEvent(RULELIST));
                }
            }
            else if (result.getType().equals(EDIT_COMPLEX_RULE)) {
                if (isUserLogin()) {
                    getMainEventBus().fireEvent(new ChangeLayoutEvent(EDIT_RULES));
                }
                else if (isAdminLogin()) {
                    getMainEventBus().fireEvent(new ChangeLayoutEvent(RULELIST));
                }
            }
        }
    };
    this.sesRulesService.createComplexRule(sessionInfo, rule, edit, oldName, callback);
}
 
Example 12
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void unsubscribe(final SessionInfo sessionInfo, String uuid, String medium, String format) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        public void onSuccess(SesClientResponse response) {
            SesClientResponseType type = response.getType();

            switch (type) {
            case REQUIRES_LOGIN:
                handleRelogin();
                break;
            case OK:
                SC.say(i18n.unsubscribeSuccessful());
                final SessionInfo currentSession = currentSession();
                EventBus.getMainEventBus().fireEvent(new GetAllOwnRulesEvent(currentSession, false));
                EventBus.getMainEventBus().fireEvent(new GetAllOtherRulesEvent(currentSession, false));
                break;
            case ERROR_UNSUBSCRIBE_SES:
                Toaster.getToasterInstance().addErrorMessage(i18n.errorUnsubscribeSES());
                break;
            default:
                break;
            }
        }
    };
    this.sesRulesService.unSubscribe(sessionInfo, uuid, medium, format, callback);
}
 
Example 13
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void upateTimeseriesFeed(String timeseriesFeedId, boolean active) {
    AsyncCallback<Void> callback = new AsyncCallback<Void>() {
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        public void onSuccess(Void response) {
            SC.say(i18n.updateSuccessful());
        }
    };
    this.sesTimeseriesService.updateTimeseriesFeed(timeseriesFeedId, active, callback);
}
 
Example 14
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void login(String name, String password, final SessionInfo sessionInfo) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(i18n.failedLogin());
        }

        public void onSuccess(SesClientResponse response) {
            
            if (response.getType() == LOGIN_OK) {
                UserDTO user = response.getUser();

                if (!user.isEmailVerified()) {
                    SC.say(i18n.validateEMail());
                }
                if (user.isPasswordChanged()) {
                    SC.say(i18n.passwordChanged());
                }

                SesRequestManager.this.performLogin(response);
                
            }
            else if (response.getType() == LOGIN_USER) {
                SC.say(i18n.onlyAdminsAllowedToLogin());
            }
            else {
                getMainEventBus().fireEvent(new InformUserEvent(response));
            }
        }

    };
    this.sesUserService.login(name, password, sessionInfo, callback);
}
 
Example 15
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void registerUser(UserDTO user) {
        AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
            public void onFailure(Throwable arg0) {
                Toaster.getToasterInstance().addErrorMessage(i18n.failedRegistration());
            }

            public void onSuccess(SesClientResponse response) {
                
//                setSessionInfo(response.getSessionInfo());
                
                if (response.getType().equals(REGISTER_OK)) {

                    if ( !isAdminLogin()) {
                        getMainEventBus().fireEvent(new ChangeLayoutEvent(LOGIN));
                        SC.say(i18n.emailSent());
                    }
                    else {
                        SC.say(i18n.createUserSuccessful());
                    }
                }
                else if (response.getType().equals(REGISTER_NAME)) {
                    SC.say(i18n.registerName());
                }
                else if (response.getType().equals(REGSITER_EMAIL)) {
                    SC.say(i18n.registerEMail());
                }
            }
        };
        this.sesUserService.registerUser(user, callback);
    }
 
Example 16
Source File: UserRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private static void warnForLongSmsMessages(ListGridRecord record) {
    if (DataControlsSes.warnUserLongNotification) {
        if (record.getAttribute(MEDIUM).contains("SMS")) {
            String format = record.getAttribute(FORMAT);
            if (format.contains("XML") || format.contains("EML")) {
                SC.say(i18n.longNotificationMessage());
                return;
            }
        }
    }
}
 
Example 17
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public void subscribe(final SessionInfo sessionInfo, final String uuid, final String medium, final String format) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        @Override
        public void onFailure(Throwable arg0) {
            getToasterInstance().addErrorMessage(arg0.getMessage());
        }

        @Override
        public void onSuccess(SesClientResponse result) {
            SesClientResponseType type = result.getType();

            switch (type) {
            case REQUIRES_LOGIN:
            	handleRelogin();
                break;
            case OK:
                String message = i18n.subscribeSuccessful1();
                String[] formats = format.split("_");
                String[] media = medium.split("_");
                String finalFormat = "";
                String finalMedium = "";

                for (int i = 0; i < formats.length; i++) {
                    finalFormat = finalFormat + formats[i] + " ";
                }

                for (int j = 0; j < media.length; j++) {
                    finalMedium = finalMedium + media[j] + " ";
                }
                finalFormat = finalFormat.trim();
                finalMedium = finalMedium.trim();

                String finalMessage = message + i18n.subscribeSuccessful2() + "<br/><br/>"
                        + i18n.subscriptionInfo();
                SC.say(finalMessage);

                getMainEventBus().fireEvent(new GetAllOwnRulesEvent(sessionInfo, false));
                getMainEventBus().fireEvent(new GetAllOtherRulesEvent(sessionInfo, false));
                break;
            case RULE_NAME_EXISTS:
                SC.say(i18n.copyExistsSubscribe());
                break;
            case ERROR_SUBSCRIBE_SES:
                Toaster.getToasterInstance().addErrorMessage(i18n.errorSubscribeSES());
                break;
            case ERROR_SUBSCRIBE_FEEDER:
                Toaster.getToasterInstance().addErrorMessage(i18n.errorSubscribeFeeder());
                break;
            case SUBSCRIPTION_EXISTS:
                SC.say(i18n.subscriptionExists());
                EventBus.getMainEventBus().fireEvent(new GetAllOwnRulesEvent(sessionInfo, false));
                EventBus.getMainEventBus().fireEvent(new GetAllOtherRulesEvent(sessionInfo, false));
                break;
            default:
                break;
            }
        }
    };
    this.sesRulesService.subscribe(sessionInfo, uuid, medium, format, callback);
}
 
Example 18
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public void updateUser(final SessionInfo sessionInfo, UserDTO user) {
    AsyncCallback<SesClientResponse> callback = new AsyncCallback<SesClientResponse>() {
        @Override
        public void onFailure(Throwable arg0) {
            Toaster.getToasterInstance().addErrorMessage(i18n.failedUpdateUser());
        }

        @Override
        public void onSuccess(SesClientResponse response) {
            if (response.getType() == REQUIRES_LOGIN) {
            	handleRelogin();
            }
            else if (response.getType().equals(OK)) {
                SC.say(i18n.updateSuccessful());
                if (isAdminLogin()) {
                    getMainEventBus().fireEvent(new GetAllUsersEvent(sessionInfo));
                }
            }
            else if (response.getType().equals(REGISTER_HANDY)) {
                SC.say(i18n.registerHandy());
            }
            else if (response.getType().equals(REGISTER_NAME)) {
                SC.say(i18n.registerName());
            }
            else if (response.getType().equals(REGSITER_EMAIL)) {
                SC.say(i18n.registerEMail());
            }
            else if (response.getType().equals(LAST_ADMIN)) {
                SC.say(i18n.lastAdmin());
            }
            else if (response.getType().equals(LOGOUT)) {
                getMainEventBus().fireEvent(new LogoutEvent(sessionInfo));
            }
            else if (response.getType().equals(MAIL)) {
                SC.say(i18n.mailSent());
            }
            else if (response.getType().equals(ERROR)) {
                SC.say(i18n.passwordDoNotMatch());
            }
        }
    };
    sesUserService.updateUser(sessionInfo, user, callback);
}
 
Example 19
Source File: SesRequestManager.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
protected void handleRelogin() {
	getMainEventBus().fireEvent(new ChangeLayoutEvent(LOGIN));
	getMainEventBus().fireEvent(new SessionExpiredEvent());
	SC.say(i18n.relogin());
}
 
Example 20
Source File: RegisterLayout.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public void setTermsOfUse(String termsOfUse) {
    SC.say(termsOfUse);
}