本文整理汇总了Java中com.haulmont.cuba.gui.components.Window.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Window.getComponent方法的具体用法?Java Window.getComponent怎么用?Java Window.getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.haulmont.cuba.gui.components.Window
的用法示例。
在下文中一共展示了Window.getComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveFocus
import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
protected void moveFocus(TabSheetBehaviour tabSheet, String tabId) {
//noinspection SuspiciousMethodCalls
Window window = tabs.get(tabSheet.getTabComponent(tabId)).getCurrentWindow();
if (window != null) {
boolean focused = false;
String focusComponentId = window.getFocusComponent();
if (focusComponentId != null) {
com.haulmont.cuba.gui.components.Component focusComponent = window.getComponent(focusComponentId);
if (focusComponent != null && focusComponent.isEnabled() && focusComponent.isVisible()) {
focusComponent.requestFocus();
focused = true;
}
}
if (!focused && window instanceof Window.Wrapper) {
Window.Wrapper wrapper = (Window.Wrapper) window;
focused = ((WebWindow) wrapper.getWrappedWindow()).findAndFocusChildComponent();
if (!focused) {
tabSheet.focus();
}
}
}
}
示例2: moveFocus
import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
protected void moveFocus(java.awt.Component tab) {
Window window = tabs.get(tab).getCurrentWindow();
if (window != null) {
String focusComponentId = window.getFocusComponent();
boolean focused = false;
if (focusComponentId != null) {
com.haulmont.cuba.gui.components.Component focusComponent = window.getComponent(focusComponentId);
if (focusComponent != null) {
if (focusComponent.isEnabled() && focusComponent.isVisible()) {
focusComponent.requestFocus();
focused = true;
}
}
}
if (!focused && window instanceof Window.Wrapper) {
Window.Wrapper wrapper = (Window.Wrapper) window;
focused = ((DesktopWindow) wrapper.getWrappedWindow()).findAndFocusChildComponent();
if (!focused) {
tabsPane.requestFocus();
}
}
}
}
示例3: applyComponentPermission
import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
private static void applyComponentPermission(Window window, String screenId,
Integer permissionValue, String targetComponentId) {
Component component = window.getComponent(targetComponentId);
if (component != null) {
if (permissionValue == UiPermissionValue.HIDE.getValue()) {
component.setVisible(false);
} else if (permissionValue == UiPermissionValue.READ_ONLY.getValue()) {
if (component instanceof Component.Editable) {
((Component.Editable) component).setEditable(false);
} else {
component.setEnabled(false);
}
}
} else {
log.info(String.format("Couldn't find component %s in window %s", targetComponentId, screenId));
}
}
示例4: applyCompositeComponentPermission
import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
private static void applyCompositeComponentPermission(Window window, String screenId,
Integer permissionValue, String componentId) {
final Matcher matcher = INNER_COMPONENT_PATTERN.matcher(componentId);
if (matcher.find()) {
final String customComponentId = matcher.group(1);
final String subComponentId = matcher.group(2);
final Component compositeComponent = window.getComponent(customComponentId);
if (compositeComponent != null) {
if (compositeComponent instanceof Component.UiPermissionAware) {
Component.UiPermissionAware uiPermissionAwareComponent = (Component.UiPermissionAware) compositeComponent;
UiPermissionValue uiPermissionValue = UiPermissionValue.fromId(permissionValue);
UiPermissionDescriptor permissionDescriptor;
if (subComponentId.contains("<")) {
final Matcher actionMatcher = COMPONENT_ACTION_PATTERN.matcher(subComponentId);
if (actionMatcher.find()) {
final String actionHolderComponentId = actionMatcher.group(1);
final String actionId = actionMatcher.group(2);
permissionDescriptor = new UiPermissionDescriptor(uiPermissionValue, screenId,
actionHolderComponentId, actionId);
} else {
log.warn(String.format("Incorrect permission definition for component %s in window %s", subComponentId, screenId));
return;
}
} else {
permissionDescriptor = new UiPermissionDescriptor(uiPermissionValue, screenId, subComponentId);
}
uiPermissionAwareComponent.applyPermission(permissionDescriptor);
}
} else {
log.info(String.format("Couldn't find component %s in window %s", componentId, screenId));
}
}
}
示例5: applyComponentActionPermission
import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
/**
* Process permissions for actions in action holder
*
* @param window Window
* @param screenId Screen Id
* @param permissionValue Permission value
* @param componentId Component Id
*/
private static void applyComponentActionPermission(Window window, String screenId,
Integer permissionValue, String componentId) {
final Matcher matcher = COMPONENT_ACTION_PATTERN.matcher(componentId);
if (matcher.find()) {
final String customComponentId = matcher.group(1);
final String actionId = matcher.group(2);
final Component actionHolderComponent = window.getComponent(customComponentId);
if (actionHolderComponent != null) {
if (actionHolderComponent instanceof Component.SecuredActionsHolder) {
ActionsPermissions permissions =
((Component.SecuredActionsHolder) actionHolderComponent).getActionsPermissions();
if (permissionValue == UiPermissionValue.HIDE.getValue()) {
permissions.addHiddenActionPermission(actionId);
} else if (permissionValue == UiPermissionValue.READ_ONLY.getValue()) {
permissions.addDisabledActionPermission(actionId);
}
} else {
log.warn(String.format("Couldn't apply permission on action %s for component %s in window %s",
actionId, customComponentId, screenId));
}
} else {
log.info(String.format("Couldn't find component %s in window %s", componentId, screenId));
}
} else {
log.warn(String.format("Incorrect permission definition for component %s in window %s", componentId, screenId));
}
}