本文整理汇总了Java中com.haulmont.cuba.gui.ComponentsHelper.walkComponents方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentsHelper.walkComponents方法的具体用法?Java ComponentsHelper.walkComponents怎么用?Java ComponentsHelper.walkComponents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.haulmont.cuba.gui.ComponentsHelper
的用法示例。
在下文中一共展示了ComponentsHelper.walkComponents方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initEditComponents
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
private void initEditComponents(boolean enabled) {
ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
if (component instanceof FieldGroup) {
((FieldGroup) component).setEditable(enabled);
} else if (component instanceof Table) {
((Table) component).getActions().stream().forEach(action -> action.setEnabled(enabled));
}
});
actionsPane.setVisible(enabled);
lookupBox.setEnabled(!enabled);
/**
* Enabling/disabling file upload control, depending if the screen is in editing mode or not
*/
imageUpload.setVisible(enabled);
}
示例2: initDebugIds
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
@Override
public void initDebugIds(final Frame frame) {
if (ui.isTestMode()) {
ComponentsHelper.walkComponents(frame, (component, name) -> {
if (component.getDebugId() == null) {
Frame componentFrame = null;
if (component instanceof BelongToFrame) {
componentFrame = ((BelongToFrame) component).getFrame();
}
if (componentFrame == null) {
log.warn("Frame for component {} is not assigned", component.getClass());
} else {
if (component instanceof WebAbstractComponent) {
WebAbstractComponent webComponent = (WebAbstractComponent) component;
webComponent.assignAutoDebugId();
}
}
}
});
}
}
示例3: afterLookupWindowOpened
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
@Override
protected void afterLookupWindowOpened(Window lookupWindow) {
boolean found = ComponentsHelper.walkComponents(lookupWindow, screenComponent -> {
if (!(screenComponent instanceof Filter)) {
return false;
} else {
MetaClass actualMetaClass = ((Filter) screenComponent).getDatasource().getMetaClass();
MetaClass propertyMetaClass = extendedEntities.getEffectiveMetaClass(pickerField.getMetaClass());
if (Objects.equals(actualMetaClass, propertyMetaClass)) {
applyFilter(((Filter) screenComponent));
return true;
}
return false;
}
});
if (!found) {
target.getFrame().showNotification(messages.getMainMessage("dynamicAttributes.entity.filter.filterNotFound"), Frame.NotificationType.WARNING);
}
((DsContextImplementation) lookupWindow.getDsContext()).resumeSuspended();
}
示例4: initEditComponents
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
/**
* Initializes edit controls, depending on if they should be enabled or disabled.
* @param enabled if true - enables edit controls and disables controls on the left side of the splitter
* if false - vice versa
*/
protected void initEditComponents(boolean enabled) {
TabSheet tabSheet = getTabSheet();
if (tabSheet != null) {
ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
if (component instanceof FieldGroup) {
((FieldGroup) component).setEditable(enabled);
} else if (component instanceof Table) {
((Table) component).getActions().forEach(action -> action.setEnabled(enabled));
} else if (!(component instanceof Component.Container)) {
component.setEnabled(enabled);
}
});
} else {
getFieldGroup().setEditable(enabled);
}
getActionsPane().setVisible(enabled);
getLookupBox().setEnabled(!enabled);
}
示例5: applySettings
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void applySettings(Settings settings) {
this.settings = settings;
ComponentsHelper.walkComponents(
window,
(component, name) -> {
if (component.getId() != null
&& component instanceof Component.HasSettings) {
log.trace("Applying settings for : {} : {} ", name, component);
Element e = WindowDelegate.this.settings.get(name);
((Component.HasSettings) component).applySettings(e);
if (component instanceof Component.HasPresentations
&& e.attributeValue("presentation") != null) {
final String def = e.attributeValue("presentation");
if (!StringUtils.isEmpty(def)) {
UUID defaultId = UUID.fromString(def);
((Component.HasPresentations) component).applyPresentationAsDefault(defaultId);
}
}
}
}
);
}
示例6: initEditComponents
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
private void initEditComponents(boolean enabled) {
ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
if (component instanceof FieldGroup) {
((FieldGroup) component).setEditable(enabled);
} else if (component instanceof Table) {
((Table) component).getActions().stream().forEach(action -> action.setEnabled(enabled));
}
});
actionsPane.setVisible(enabled);
lookupBox.setEnabled(!enabled);
}
示例7: saveSettings
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void saveSettings() {
if (settings != null) {
ComponentsHelper.walkComponents(
window,
(component, name) -> {
if (component.getId() != null
&& component instanceof Component.HasSettings) {
log.trace("Saving settings for : {} : {}", name, component);
Element e = WindowDelegate.this.settings.get(name);
boolean modified = ((Component.HasSettings) component).saveSettings(e);
if (component instanceof Component.HasPresentations
&& ((Component.HasPresentations) component).isUsePresentations()) {
Object def = ((Component.HasPresentations) component).getDefaultPresentationId();
e.addAttribute("presentation", def != null ? def.toString() : "");
Presentations presentations = ((Component.HasPresentations) component).getPresentations();
if (presentations != null) {
presentations.commit();
}
}
WindowDelegate.this.settings.setModified(modified);
}
}
);
settings.commit();
}
}
示例8: disposeComponents
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void disposeComponents() {
ComponentsHelper.walkComponents(
window,
(component, name) -> {
if (component instanceof Component.Disposable) {
((Component.Disposable) component).dispose();
}
}
);
}
示例9: createTopLevelWindow
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void createTopLevelWindow(WindowInfo windowInfo) {
ui.beforeTopLevelWindowInit();
String template = windowInfo.getTemplate();
Window.TopLevelWindow topLevelWindow;
Map<String, Object> params = Collections.emptyMap();
if (template != null) {
//noinspection unchecked
topLevelWindow = (Window.TopLevelWindow) createWindow(windowInfo, OpenType.NEW_TAB, params,
LayoutLoaderConfig.getWindowLoaders(), true);
} else {
Class screenClass = windowInfo.getScreenClass();
if (screenClass != null) {
//noinspection unchecked
topLevelWindow = (Window.TopLevelWindow) createWindowByScreenClass(windowInfo, params);
} else {
throw new DevelopmentException("Unable to load top level window");
}
}
// detect work area
Window windowImpl = ((Window.Wrapper) topLevelWindow).getWrappedWindow();
if (topLevelWindow instanceof AbstractMainWindow) {
AbstractMainWindow mainWindow = (AbstractMainWindow) topLevelWindow;
// bind system UI components to AbstractMainWindow
ComponentsHelper.walkComponents(windowImpl, component -> {
if (component instanceof AppWorkArea) {
mainWindow.setWorkArea((AppWorkArea) component);
} else if (component instanceof UserIndicator) {
mainWindow.setUserIndicator((UserIndicator) component);
} else if (component instanceof FoldersPane) {
mainWindow.setFoldersPane((FoldersPane) component);
}
return false;
});
}
ui.setTopLevelWindow(topLevelWindow);
// load menu
ComponentsHelper.walkComponents(windowImpl, component -> {
if (component instanceof TopLevelWindowAttachListener) {
((TopLevelWindowAttachListener) component).topLevelWindowAttached(topLevelWindow);
}
return false;
});
if (topLevelWindow instanceof Window.HasWorkArea) {
AppWorkArea workArea = ((Window.HasWorkArea) topLevelWindow).getWorkArea();
if (workArea != null) {
workArea.addStateChangeListener(new AppWorkArea.StateChangeListener() {
@Override
public void stateChanged(AppWorkArea.State newState) {
if (newState == AppWorkArea.State.WINDOW_CONTAINER) {
initTabShortcuts();
// listener used only once
getConfiguredWorkArea(createWorkAreaContext(topLevelWindow)).removeStateChangeListener(this);
}
}
});
}
}
afterShowWindow(topLevelWindow);
}
示例10: initLazyTab
import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
protected void initLazyTab(JComponent tab) {
LazyTabInfo lti = null;
for (LazyTabInfo lazyTabInfo : lazyTabs) {
if (lazyTabInfo.getTabComponent() == tab) {
lti = lazyTabInfo;
break;
}
}
if (lti == null) { // already initialized
return;
}
if (!lti.getTab().isEnabled()) {
return;
}
lazyTabs.remove(lti);
lti.loader.createComponent();
Component lazyContent = lti.loader.getResultComponent();
lazyContent.setWidth("100%");
lti.tabContent.add(lazyContent);
lti.tabContent.expand(lazyContent, "", "");
lazyContent.setParent(this);
lti.loader.loadComponent();
if (lazyContent instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) lazyContent).setParentEnabled(false);
}
final Window window = ComponentsHelper.getWindow(DesktopTabSheet.this);
if (window != null) {
ComponentsHelper.walkComponents(
lti.tabContent,
(component, name) -> {
if (component instanceof HasSettings) {
Settings settings = window.getSettings();
if (settings != null) {
Element e = settings.get(name);
((HasSettings) component).applySettings(e);
}
}
}
);
lti.getTab().setLazyInitialized(true);
}
}