use of org.entirej.framework.core.enumerations.EJQuestionButton in project rap by entirej.
the class EJRWTListRecordBlockRenderer method askToDeleteRecord.
public void askToDeleteRecord(final EJDataRecord recordToDelete, String msg) {
if (msg == null) {
msg = "Are you sure you want to delete the current record?";
}
EJMessage message = new EJMessage(msg);
EJQuestion question = new EJQuestion(new EJForm(_block.getForm()), "DELETE_RECORD", "Delete", message, "Yes", "No") {
@Override
public void setAnswer(EJQuestionButton answerButton) {
super.setAnswer(answerButton);
if (EJQuestionButton.ONE == answerButton) {
_block.getBlock().deleteRecord(recordToDelete);
}
_block.setRendererFocus(true);
}
};
_block.getForm().getMessenger().askQuestion(question);
}
use of org.entirej.framework.core.enumerations.EJQuestionButton in project rap by entirej.
the class EJRWTLineChartRecordBlockRenderer method askToDeleteRecord.
@Override
public void askToDeleteRecord(final EJDataRecord recordToDelete, String msg) {
if (msg == null) {
msg = "Are you sure you want to delete the current record?";
}
EJMessage message = new EJMessage(msg);
EJQuestion question = new EJQuestion(new EJForm(_block.getForm()), "DELETE_RECORD", "Delete", message, "Yes", "No") {
@Override
public void setAnswer(EJQuestionButton answerButton) {
super.setAnswer(answerButton);
if (EJQuestionButton.ONE == answerButton) {
_block.getBlock().deleteRecord(recordToDelete);
}
_block.setRendererFocus(true);
}
};
_block.getForm().getMessenger().askQuestion(question);
}
use of org.entirej.framework.core.enumerations.EJQuestionButton in project rap by entirej.
the class EJRWTMessenger method askQuestion.
/**
* Asks the given question and after the user has made an answer, the answer
* will be sent to the corresponding <code>IActionProcessor</code>
*
* @param question
* The question to be asked
*/
@Override
public void askQuestion(final EJQuestion question) {
final EJQuestionButton[] optionsButtons = getOptions(question);
String[] options = new String[optionsButtons.length];
for (int i = 0; i < optionsButtons.length; i++) {
options[i] = question.getButtonText(optionsButtons[i]);
}
MessageDialog dialog = new MessageDialog(manager.getShell(), question.getTitle(), null, question.getMessageText(), MessageDialog.QUESTION, options, 2) {
@Override
public boolean close() {
boolean close = super.close();
int answer = getReturnCode();
try {
if (answer > -1) {
question.setAnswer(optionsButtons[answer]);
question.getActionProcessor().questionAnswered(question);
}
} catch (EJApplicationException e) {
handleException(e);
}
return close;
}
};
dialog.setBlockOnOpen(false);
dialog.open();
}
use of org.entirej.framework.core.enumerations.EJQuestionButton in project rap by entirej.
the class EJRWTMessenger method askInternalQuestion.
/**
* Asks the given question and after the user has made an answer, the answer
* will be sent to the corresponding <code>IActionProcessor</code>
*
* @param question
* The question to be asked
*/
@Override
public void askInternalQuestion(final EJInternalQuestion question) {
final EJQuestionButton[] optionsButtons = getOptions(question);
String[] options = new String[optionsButtons.length];
for (int i = 0; i < optionsButtons.length; i++) {
options[i] = question.getButtonText(optionsButtons[i]);
}
MessageDialog dialog = new MessageDialog(manager.getShell(), question.getTitle(), null, question.getMessageText(), MessageDialog.QUESTION, options, 2) {
@Override
public boolean close() {
boolean close = super.close();
int answer = getReturnCode();
try {
if (answer > -1) {
question.setAnswer(optionsButtons[answer]);
question.getActionProcessor().questionAnswered(question);
}
question.getForm().internalQuestionAnswered(question);
} catch (EJApplicationException e) {
handleException(e);
}
return close;
}
};
dialog.setBlockOnOpen(false);
dialog.open();
}
use of org.entirej.framework.core.enumerations.EJQuestionButton in project rap by entirej.
the class EJRWTSingleRecordBlockRenderer method askToDeleteRecord.
@Override
public void askToDeleteRecord(final EJDataRecord recordToDelete, String msg) {
if (msg == null) {
msg = "Are you sure you want to delete the current record?";
}
EJMessage message = new EJMessage(msg);
EJQuestion question = new EJQuestion(new EJForm(_block.getForm()), "DELETE_RECORD", "Delete", message, "Yes", "No") {
@Override
public void setAnswer(EJQuestionButton answerButton) {
super.setAnswer(answerButton);
if (EJQuestionButton.ONE == answerButton) {
_block.getBlock().deleteRecord(recordToDelete);
}
_block.setRendererFocus(true);
}
};
_block.getForm().getMessenger().askQuestion(question);
}
Aggregations