/** Gets triggered whenever the comment changes. */ private void onCommentChanges() { Integer charsRemaining = MAXLENGTH - commentBox.getText().length(); countDown.setText(charsRemaining.toString()); if (charsRemaining >= 0 && charsRemaining != MAXLENGTH) { countDown.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().overCharacterLimit()); post.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive()); inactive = false; } else { if (charsRemaining != MAXLENGTH) { countDown.addStyleName(StaticResourceBundle.INSTANCE.coreCss().overCharacterLimit()); } post.addStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive()); inactive = true; } }
/** Check the post box. */ private void checkPostBox() { postCharCount.setInnerText(Integer.toString(POST_MAX - postBox.getText().length())); if (POST_MAX - postBox.getText().length() < 0) { postCharCount.addClassName(style.postCharCountOverLimit()); } else { postCharCount.removeClassName(style.postCharCountOverLimit()); } if ((postBox.getText().length() > 0 && POST_MAX - postBox.getText().length() >= 0) || attachment != null) { postButton.removeStyleName(style.postButtonInactive()); } else { postButton.addStyleName(style.postButtonInactive()); } }