use of com.haulmont.cuba.gui.components.Frame in project cuba by cuba-platform.
the class ScreenHistorySupport method saveScreenHistory.
public void saveScreenHistory(Window window, WindowManager.OpenMode openMode) {
Security security = AppBeans.get(Security.NAME);
if (security.isEntityOpPermitted(ScreenHistoryEntity.class, EntityOp.CREATE) && window.getFrame() != null && (window.getFrame() instanceof Window.Editor) && openMode != WindowManager.OpenMode.DIALOG && (screenIds == null || screenIds.contains(window.getId()))) {
String caption = window.getCaption();
UUID entityId = null;
Frame frame = window.getFrame();
Entity entity = null;
if (frame instanceof Window.Editor) {
entity = ((Window.Editor) frame).getItem();
if (entity != null) {
if (PersistenceHelper.isNew(entity)) {
return;
}
if (StringUtils.isBlank(caption))
caption = messages.getTools().getEntityCaption(entity.getMetaClass()) + " " + entity.getInstanceName();
entityId = (UUID) entity.getId();
}
}
ScreenHistoryEntity screenHistoryEntity = metadata.create(ScreenHistoryEntity.class);
screenHistoryEntity.setCaption(StringUtils.abbreviate(caption, 255));
screenHistoryEntity.setUrl(makeLink(window));
screenHistoryEntity.setEntityId(entityId);
addAdditionalFields(screenHistoryEntity, entity);
CommitContext cc = new CommitContext(Collections.singleton(screenHistoryEntity));
DataService dataService = AppBeans.get(DataService.NAME);
dataService.commit(cc);
}
}
use of com.haulmont.cuba.gui.components.Frame in project cuba by cuba-platform.
the class DesktopWindowManager method dispose.
/**
* Release resources right before throwing away this WindowManager instance.
*/
public void dispose() {
for (WindowOpenInfo openInfo : windowOpenMode.values()) {
if (openInfo.getOpenMode() == OpenMode.DIALOG) {
JDialog dialog = (JDialog) openInfo.getData();
dialog.setVisible(false);
}
}
if (isMainWindowManager) {
// Stop background tasks
WatchDog watchDog = AppBeans.get(WatchDog.NAME);
watchDog.stopTasks();
}
// Dispose windows
for (Window window : windowOpenMode.keySet()) {
Frame frame = window.getFrame();
if (frame instanceof Component.Disposable)
((Component.Disposable) frame).dispose();
}
tabs.clear();
windowOpenMode.clear();
stacks.clear();
}
use of com.haulmont.cuba.gui.components.Frame in project cuba by cuba-platform.
the class DesktopWindow method disableEventListeners.
protected void disableEventListeners() {
Frame wrapper = delegate.getWrapper();
if (wrapper != null) {
List<ApplicationListener> uiEventListeners = ((AbstractFrame) wrapper).getUiEventListeners();
if (uiEventListeners != null) {
for (ApplicationListener listener : uiEventListeners) {
UiEventsMulticaster multicaster = App.getInstance().getUiEventsMulticaster();
multicaster.removeApplicationListener(listener);
}
}
}
}
use of com.haulmont.cuba.gui.components.Frame in project cuba by cuba-platform.
the class DesktopWindow method enableEventListeners.
protected void enableEventListeners() {
Frame wrapper = delegate.getWrapper();
if (wrapper != null) {
List<ApplicationListener> uiEventListeners = ((AbstractFrame) wrapper).getUiEventListeners();
if (uiEventListeners != null) {
for (ApplicationListener listener : uiEventListeners) {
UiEventsMulticaster multicaster = App.getInstance().getUiEventsMulticaster();
multicaster.addApplicationListener(listener);
}
}
}
}
use of com.haulmont.cuba.gui.components.Frame in project cuba by cuba-platform.
the class AbstractCollectionDatasource method getLoggingTag.
protected String getLoggingTag(String prefix) {
String windowId = "";
if (dsContext != null) {
FrameContext windowContext = dsContext.getFrameContext();
if (windowContext != null) {
Frame frame = windowContext.getFrame();
if (frame != null) {
windowId = ComponentsHelper.getFullFrameId(windowContext.getFrame());
}
}
}
String tag = prefix + " " + id;
if (StringUtils.isNotBlank(windowId))
tag = windowId + "@" + id;
return tag;
}
Aggregations