use of org.entirej.framework.core.EJMessage 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);
}
use of org.entirej.framework.core.EJMessage in project rap by entirej.
the class EJRWTTreeRecordBlockRenderer 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.EJMessage in project rap by entirej.
the class EJRWTComboItemRenderer method _loadComboBoxValues.
private void _loadComboBoxValues() {
// Initialise both the field and the values.
_lovInitialied.set(true);
_comboValues.clear();
String lovDefName = _rendererProps.getStringProperty(EJRWTComboBoxRendererDefinitionProperties.LOV_DEFINITION_NAME);
if (lovDefName == null || lovDefName.trim().length() == 0) {
return;
}
String defName = lovDefName;
String defItemName = "";
if (lovDefName.indexOf('.') != -1) {
defName = lovDefName.substring(0, lovDefName.indexOf('.'));
defItemName = lovDefName.substring(lovDefName.indexOf('.') + 1);
} else {
EJMessage message = new EJMessage("No LovDefinition item has been chosen for the ComboBox renderer properties on item: " + _itemProperties.getName());
_item.getForm().getFrameworkManager().getApplicationManager().getApplicationMessenger().handleMessage(message);
return;
}
if (_item.getBlock().getProperties().isReferenceBlock()) {
defName = String.format("%s.%s", _item.getBlock().getProperties().getName(), defName);
}
EJLovDefinitionProperties lovDef = _item.getForm().getProperties().getLovDefinitionProperties(defName);
if (lovDef == null) {
return;
}
EJLovController lovController = _item.getForm().getLovController(defName);
if (lovController == null) {
return;
}
try {
lovController.executeQuery(new EJItemLovController(_item.getBlock().getBlockController().getFormController(), _item, ((EJCoreItemProperties) _itemProperties).getLovMappingPropertiesOnUpdate()));
if (!_item.getProperties().isMandatory()) {
ComboBoxValue emptyValue = new ComboBoxValue(null, defItemName);
_comboValues.add(emptyValue);
}
Collection<EJDataRecord> records = lovController.getRecords();
for (EJDataRecord ejDataRecord : records) {
if (!ejDataRecord.containsItem(defItemName)) {
EJMessage message = new EJMessage("The item name '" + defItemName + "', does not exist within the lov definitions underlying block. Lov Definition: " + defName);
_item.getForm().getFrameworkManager().getApplicationManager().getApplicationMessenger().handleMessage(message);
return;
}
ComboBoxValue comboValue = new ComboBoxValue(ejDataRecord, defItemName);
_comboValues.add(comboValue);
}
} catch (Exception e) {
_item.getForm().getFrameworkManager().getApplicationManager().getApplicationMessenger().handleException(e, true);
}
}
use of org.entirej.framework.core.EJMessage in project rap by entirej.
the class EJRWTLookupFormLovRenderer method enterQuery.
@Override
public void enterQuery(EJDataRecord record) {
if (_queryScreenRenderer == null) {
EJMessage message = new EJMessage("Please define a Query Screen Renderer for this form before a query operation can be performed.");
getLovController().getFormController().getMessenger().handleMessage(message);
} else {
_queryScreenRenderer.open(record);
}
}
Aggregations