use of org.entirej.framework.core.data.controllers.EJItemLovController in project rap by entirej.
the class EJRWTStackedItemRenderer method loadComboBoxValues.
private List<ComboBoxValue> loadComboBoxValues(EJRWTStackedItemRendererConfig.Combo config) {
// Initialise both the field and the values.
List<ComboBoxValue> _comboValues = new ArrayList<ComboBoxValue>();
String lovDefName = config.getLovDefinition();
if (lovDefName == null || lovDefName.trim().length() == 0) {
return _comboValues;
}
String defName = lovDefName;
String defItemName = config.getItemName();
if (defItemName == null || defItemName.trim().length() == 0) {
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 _comboValues;
}
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 _comboValues;
}
EJLovController lovController = _item.getForm().getLovController(defName);
if (lovController == null) {
return _comboValues;
}
try {
lovController.executeQuery(new EJItemLovController(_item.getBlock().getBlockController().getFormController(), _item, ((EJCoreItemProperties) _itemProperties).getLovMappingPropertiesOnUpdate()));
if (!_item.getProperties().isMandatory()) {
ComboBoxValue emptyValue = new ComboBoxValue(null, defItemName, config);
_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 new ArrayList<ComboBoxValue>();
}
ComboBoxValue comboValue = new ComboBoxValue(ejDataRecord, defItemName, config);
_comboValues.add(comboValue);
}
} catch (Exception e) {
_item.getForm().getFrameworkManager().getApplicationManager().getApplicationMessenger().handleException(e, true);
}
return _comboValues;
}
use of org.entirej.framework.core.data.controllers.EJItemLovController in project rap by entirej.
the class EJRWTListItemRenderer method loadListBoxValues.
private void loadListBoxValues() {
// Initialise both the field and the values.
_lovInitialied = true;
_listValues.clear();
_listKays.clear();
String lovDefName = _rendererProps.getStringProperty(EJRWTListBoxRendererDefinitionProperties.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 ListBox 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()));
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;
}
ListBoxValue listValue = new ListBoxValue(ejDataRecord, defItemName);
String itemValueAsString = listValue.getItemValueAsString();
_listValues.put(itemValueAsString, listValue);
_listKays.add(itemValueAsString);
}
} catch (Exception e) {
_item.getForm().getFrameworkManager().getApplicationManager().getApplicationMessenger().handleException(e, true);
}
}
use of org.entirej.framework.core.data.controllers.EJItemLovController 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);
}
}
Aggregations