use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.
the class EJRWTApplicationManager method createEmbeddedForm.
public EJInternalForm createEmbeddedForm(String formName, Composite parent) {
try {
EJInternalForm form = getFrameworkManager().createInternalForm(formName, null);
if (form != null) {
EJRWTFormRenderer renderer = (EJRWTFormRenderer) form.getRenderer();
renderer.createControl(parent);
EJRWTEntireJGridPane gridPane = renderer.getGuiComponent();
gridPane.cleanLayout();
embeddedForms.add(form);
return form;
}
} catch (Exception e) {
getApplicationMessenger().handleException(e, true);
}
return null;
}
use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.
the class EJRWTComboItemRenderer method connectLOVItems.
private void connectLOVItems() {
String lovDefName = _rendererProps.getStringProperty(EJRWTComboBoxRendererDefinitionProperties.LOV_DEFINITION_NAME);
if (lovDefName == null || lovDefName.trim().length() == 0) {
return;
}
String defName = lovDefName;
EJInternalForm form = _item.getForm();
if (lovDefName.indexOf('.') != -1) {
defName = lovDefName.substring(0, lovDefName.indexOf('.'));
} else {
EJMessage message = new EJMessage("No LovDefinition item has been chosen for the ComboBox renderer properties on item: " + _itemProperties.getName());
form.getFrameworkManager().getApplicationManager().getApplicationMessenger().handleMessage(message);
return;
}
if (_item.getBlock().getProperties().isReferenceBlock()) {
defName = String.format("%s.%s", _item.getBlock().getProperties().getName(), defName);
}
EJLovDefinitionProperties lovDef = form.getProperties().getLovDefinitionProperties(defName);
if (lovDef == null) {
return;
}
Collection<EJItemProperties> allItemProperties = lovDef.getBlockProperties().getAllItemProperties();
for (EJItemProperties ejItemProperties : allItemProperties) {
String defaultValue = ejItemProperties.getDefaultQueryValue();
if (defaultValue == null || defaultValue.trim().length() == 0) {
continue;
}
String paramTypeCode = defaultValue.substring(0, defaultValue.indexOf(':'));
String paramValue = defaultValue.substring(defaultValue.indexOf(':') + 1);
final Logger logger = LoggerFactory.getLogger(EJRWTComboItemRenderer.class);
if ("APP_PARAMETER".equals(paramTypeCode)) {
EJApplicationLevelParameter param = form.getApplicationLevelParameter(paramValue);
if (param != null) {
param.addParameterChangedListener(new ParameterChangedListener() {
@Override
public void parameterChanged(String parameterName, Object oldValue, Object newValue) {
logger.debug("APP_PARAMETER:parameterChanged %s.%s", _item.getBlock().getProperties().getName(), _item.getName());
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
_loadComboBoxValues();
refreshCombo();
}
});
}
});
}
} else if ("FORM_PARAMETER".equals(paramTypeCode)) {
EJFormParameter param = form.getFormParameter(paramValue);
if (param != null) {
param.addParameterChangedListener(new ParameterChangedListener() {
@Override
public void parameterChanged(String parameterName, Object oldValue, Object newValue) {
logger.debug("FORM_PARAMETER.parameterChanged %s.%s", _item.getBlock().getProperties().getName(), _item.getName());
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
_loadComboBoxValues();
refreshCombo();
}
});
}
});
}
} else if ("BLOCK_ITEM".equals(paramTypeCode)) {
final String blockName = paramValue.substring(0, paramValue.indexOf('.'));
String itemName = paramValue.substring(paramValue.indexOf('.') + 1);
EJInternalEditableBlock block = form.getBlock(blockName);
if (block != null) {
final String itemBlock = _item.getBlock().getProperties().getName();
_lovInitialiedOnValueSet = true;
if (!itemBlock.equals(blockName) || _item.getScreenType() == EJScreenType.MAIN) {
block.getBlockController().addNewRecordFocusedListener(new EJNewRecordFocusedListener() {
@Override
public void focusedGained(EJDataRecord focusedRecord) {
logger.debug(String.format("BLOCK RECORD Changed %s", blockName));
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
_loadComboBoxValues();
refreshCombo();
}
});
}
});
}
block.addDataItemValueChangedListener(itemName, new EJDataItemValueChangedListener() {
@Override
public void dataItemValueChanged(String itemName, EJDataRecord changedRecord, EJScreenType screenType) {
if (blockName.equals(itemBlock)) {
if (screenType == _item.getScreenType()) {
logger.debug(String.format("BLOCK_ITEM.valueChanged %s.%s", blockName, itemName));
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
_loadComboBoxValues();
refreshCombo();
}
});
}
} else {
if (screenType == EJScreenType.MAIN) {
logger.debug(String.format("BLOCK_ITEM.valueChanged %s.%s", blockName, itemName));
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
_loadComboBoxValues();
refreshCombo();
}
});
}
}
}
});
}
}
}
EJLovController lovController = form.getLovController(defName);
if (lovController == null) {
return;
}
}
use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.
the class EJRWTTabPaneFormContainer method createContainer.
public Composite createContainer(Composite parent) {
if (_folder != null) {
_folder.dispose();
_folder = null;
}
int style = SWT.FLAT | SWT.BORDER | getTabOrientation() | SWT.CLOSE;
_folder = new CTabFolder(parent, style);
_folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
@Override
public void close(CTabFolderEvent event) {
event.doit = false;
if (event.item instanceof CTabItem) {
EJInternalForm form = getFormByTab((CTabItem) event.item);
if (form != null) {
try {
form.close();
} catch (Exception e) {
form.getFrameworkManager().getApplicationManager().handleException(e);
}
}
}
}
});
_folder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CTabItem selection = _folder.getSelection();
if (selection != null && selection.getData() instanceof EJInternalForm) {
final EJInternalForm form = (EJInternalForm) selection.getData();
EJ_RWT.setAttribute(_folder, "ej-item-selection", form.getProperties().getName());
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
listener.fireFormSelected(form);
}
form.focusGained();
}
});
}
}
});
return _folder;
}
use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.
the class EJRWTTabPaneFormContainer method switchToForm.
@Override
public EJInternalForm switchToForm(EJInternalForm aform) {
for (EJInternalForm form : _tabPages.keySet()) {
if (form.equals(aform)) {
EJRWTFormRenderer renderer = (EJRWTFormRenderer) form.getRenderer();
_folder.setSelection(_tabPages.get(form));
EJ_RWT.setAttribute(_folder, "ej-item-selection", form.getProperties().getName());
renderer.gainInitialFocus();
return form;
}
}
return null;
}
use of org.entirej.framework.core.internal.EJInternalForm in project rap by entirej.
the class EJRWTDefaultFormContainerToolbar method fireFormClosed.
@Override
public void fireFormClosed(EJInternalForm closedForm) {
closedForm.removeFormEventListener(this);
closedForm.removeBlockFocusedListener(this);
closedForm.removeItemFocusListener(this);
closedForm.removeItemValueChangedListener(this);
closedForm.removeNewRecordFocusedListener(this);
EJInternalForm form = getForm();
synchronize(form != null ? form.getFocusedBlock().getBlockController() : null);
}
Aggregations