use of org.entirej.applicationframework.rwt.renderers.form.EJRWTFormRenderer in project rap by entirej.
the class EJRWTApplicationContainer method buildApplication.
void buildApplication(EJRWTApplicationManager applicationManager, Composite mainWindow, String serviceForm) {
_applicationManager = applicationManager;
_mainPane = new Composite(mainWindow, SWT.NO_FOCUS);
_mainPane.setData(EJ_RWT.CUSTOM_VARIANT, "applayout");
mainWindow.setLayout(new FillLayout());
if (serviceForm == null)
buildApplicationContainer();
else
buildServiceApplicationContainer(serviceForm);
if (_formContainer == null) {
_formContainer = new EJRWTFormContainer() {
EJRWTAbstractDialog _popupDialog;
EJRWTFormPopUp _formPopup;
@Override
public EJInternalForm switchToForm(String key) {
// ignore
return null;
}
@Override
public EJInternalForm switchToForm(EJInternalForm form) {
// TODO Auto-generated method stub
return null;
}
@Override
public void removeFormSelectedListener(EJRWTFormSelectedListener selectionListener) {
// ignore
}
@Override
public void popupFormClosed() {
if (_formPopup != null) {
_formPopup.close();
_formPopup = null;
}
}
@Override
public void openPopupForm(EJPopupFormController popupController) {
_formPopup = new EJRWTFormPopUp(_applicationManager.getShell(), popupController);
_formPopup.showForm();
}
@Override
public Collection<EJInternalForm> getAllForms() {
// ignore
return Collections.emptyList();
}
@Override
public EJInternalForm getActiveForm() {
// ignore
return null;
}
@Override
public boolean containsForm(String formName) {
// ignore
return false;
}
@Override
public void closeForm(EJInternalForm form) {
if (_formPopup != null && _formPopup.getPopupController().getPopupForm().equals(form)) {
_formPopup.close();
_formPopup = null;
return;
}
if (_popupDialog != null) {
_popupDialog.close();
_popupDialog = null;
}
}
@Override
public void addFormSelectedListener(EJRWTFormSelectedListener selectionListener) {
// ignore
}
@Override
public EJInternalForm addForm(final EJInternalForm form) {
final int height = form.getProperties().getFormHeight();
final int width = form.getProperties().getFormWidth();
final EJRWTFormRenderer formRenderer = (EJRWTFormRenderer) form.getRenderer();
_popupDialog = new EJRWTAbstractDialog(_applicationManager.getShell()) {
private static final long serialVersionUID = -4685316941898120169L;
@Override
public void createBody(Composite parent) {
parent.setLayout(new FillLayout());
final ScrolledComposite scrollComposite = new EJRWTScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
formRenderer.createControl(scrollComposite);
scrollComposite.setContent(formRenderer.getGuiComponent());
scrollComposite.setExpandHorizontal(true);
scrollComposite.setExpandVertical(true);
scrollComposite.setMinSize(form.getProperties().getFormWidth(), form.getProperties().getFormHeight());
formRenderer.gainInitialFocus();
}
@Override
public int open() {
return super.open();
}
private void addExtraButton(Composite parent, String label, int id) {
if (label == null || label.length() == 0) {
return;
}
createButton(parent, id, label, false);
}
@Override
public boolean close() {
return super.close();
}
};
_popupDialog.create();
final EJCoreFormProperties coreFormProperties = form.getProperties();
_popupDialog.getShell().setData("POPUP - " + coreFormProperties.getName());
_popupDialog.getShell().setText(coreFormProperties.getTitle() == null ? coreFormProperties.getName() : coreFormProperties.getTitle());
// add dialog border offsets
_popupDialog.getShell().setSize(width + 80, height + 100);
_popupDialog.centreLocation();
_popupDialog.open();
_popupDialog.activateDialog();
return form;
}
@Override
public void updateFormTitle(EJInternalForm form) {
// TODO Auto-generated method stub
}
};
}
}
use of org.entirej.applicationframework.rwt.renderers.form.EJRWTFormRenderer in project rap by entirej.
the class EJRWTStackedPaneFormContainer method addForm.
@Override
public EJInternalForm addForm(EJInternalForm form) {
final String name = form.getFormController().getEJForm().getName();
final EJInternalForm formByPage = getFormByPage(name);
if (formByPage != null) {
_stackPane.showPane(name);
EJRWTFormRenderer renderer = (EJRWTFormRenderer) formByPage.getRenderer();
renderer.gainInitialFocus();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
formByPage.focusGained();
for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
listener.fireFormSelected(formByPage);
}
}
});
return formByPage;
}
_stackedPages.put(form, name);
final EJRWTFormRenderer renderer = (EJRWTFormRenderer) form.getRenderer();
renderer.createControl(_stackPane);
_stackPane.add(name, new EJRWTEntireJStackedPane.StackedPage() {
@Override
public String getKey() {
return name;
}
public Control getControl() {
return renderer.getGuiComponent();
}
});
_stackPane.showPane(name);
renderer.gainInitialFocus();
form.focusGained();
for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
listener.fireFormSelected(form);
}
return form;
}
use of org.entirej.applicationframework.rwt.renderers.form.EJRWTFormRenderer in project rap by entirej.
the class EJRWTStackedPaneFormContainer method switchToForm.
@Override
public EJInternalForm switchToForm(String key) {
for (EJInternalForm form : _stackedPages.keySet()) {
if (form.getProperties().getName().equalsIgnoreCase(key)) {
EJRWTFormRenderer renderer = (EJRWTFormRenderer) form.getRenderer();
_stackPane.showPane(_stackedPages.get(form));
EJ_RWT.setAttribute(_stackPane, "ej-item-selection", form.getProperties().getName());
renderer.gainInitialFocus();
form.focusGained();
for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
listener.fireFormSelected(form);
}
return form;
}
}
return null;
}
Aggregations