mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 12:17:41 +08:00
PL-10444 Support UI permissions for LookupPickerField / SearchPickerField / SuggestionPickerField
This commit is contained in:
parent
a5ceb154e7
commit
57fc25bb2f
@ -19,6 +19,8 @@ package com.haulmont.cuba.desktop.gui.components;
|
||||
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.gui.components.Action;
|
||||
import com.haulmont.cuba.gui.components.ActionsPermissions;
|
||||
import com.haulmont.cuba.gui.components.Component.SecuredActionsHolder;
|
||||
import com.haulmont.cuba.gui.components.Frame;
|
||||
import com.haulmont.cuba.gui.components.LookupPickerField;
|
||||
import com.haulmont.cuba.gui.data.CollectionDatasource;
|
||||
@ -28,11 +30,13 @@ import javax.annotation.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.util.Collection;
|
||||
|
||||
public class DesktopLookupPickerField extends DesktopLookupField implements LookupPickerField {
|
||||
public class DesktopLookupPickerField extends DesktopLookupField implements LookupPickerField, SecuredActionsHolder {
|
||||
|
||||
protected DesktopPickerField pickerField;
|
||||
protected boolean isRefreshOptionsOnLookupClose = false;
|
||||
|
||||
protected ActionsPermissions actionsPermissions = new ActionsPermissions(this);
|
||||
|
||||
public DesktopLookupPickerField() {
|
||||
pickerField = new DesktopPickerField(new Picker());
|
||||
}
|
||||
@ -164,6 +168,11 @@ public class DesktopLookupPickerField extends DesktopLookupField implements Look
|
||||
isRefreshOptionsOnLookupClose = refresh;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionsPermissions getActionsPermissions() {
|
||||
return actionsPermissions;
|
||||
}
|
||||
|
||||
private class Picker extends com.haulmont.cuba.desktop.sys.vcl.Picker {
|
||||
@Override
|
||||
protected void initEditor() {
|
||||
|
@ -19,9 +19,8 @@ package com.haulmont.cuba.desktop.gui.components;
|
||||
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.gui.components.Action;
|
||||
import com.haulmont.cuba.gui.components.Frame;
|
||||
import com.haulmont.cuba.gui.components.PickerField;
|
||||
import com.haulmont.cuba.gui.components.SearchPickerField;
|
||||
import com.haulmont.cuba.gui.components.*;
|
||||
import com.haulmont.cuba.gui.components.Component.SecuredActionsHolder;
|
||||
import com.haulmont.cuba.gui.data.CollectionDatasource;
|
||||
import com.haulmont.cuba.gui.data.Datasource;
|
||||
|
||||
@ -29,10 +28,12 @@ import javax.annotation.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.util.Collection;
|
||||
|
||||
public class DesktopSearchPickerField extends DesktopSearchField implements SearchPickerField {
|
||||
public class DesktopSearchPickerField extends DesktopSearchField implements SearchPickerField, SecuredActionsHolder {
|
||||
|
||||
protected DesktopPickerField pickerField;
|
||||
|
||||
protected ActionsPermissions actionsPermissions = new ActionsPermissions(this);
|
||||
|
||||
public DesktopSearchPickerField() {
|
||||
pickerField = new DesktopPickerField(new Picker());
|
||||
}
|
||||
@ -154,6 +155,11 @@ public class DesktopSearchPickerField extends DesktopSearchField implements Sear
|
||||
pickerField.setParentEnabled(isEnabledWithParent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionsPermissions getActionsPermissions() {
|
||||
return actionsPermissions;
|
||||
}
|
||||
|
||||
private class Picker extends com.haulmont.cuba.desktop.sys.vcl.Picker {
|
||||
@Override
|
||||
protected void initEditor() {
|
||||
|
@ -19,6 +19,8 @@ package com.haulmont.cuba.desktop.gui.components;
|
||||
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.gui.components.Action;
|
||||
import com.haulmont.cuba.gui.components.ActionsPermissions;
|
||||
import com.haulmont.cuba.gui.components.Component.SecuredActionsHolder;
|
||||
import com.haulmont.cuba.gui.components.Frame;
|
||||
import com.haulmont.cuba.gui.components.SuggestionPickerField;
|
||||
import com.haulmont.cuba.gui.data.CollectionDatasource;
|
||||
@ -29,10 +31,12 @@ import javax.swing.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class DesktopSuggestionPickerField extends DesktopSuggestionField implements SuggestionPickerField {
|
||||
public class DesktopSuggestionPickerField extends DesktopSuggestionField implements SuggestionPickerField, SecuredActionsHolder {
|
||||
|
||||
protected DesktopPickerField pickerField;
|
||||
|
||||
protected ActionsPermissions actionsPermissions = new ActionsPermissions(this);
|
||||
|
||||
public DesktopSuggestionPickerField() {
|
||||
pickerField = new DesktopPickerField(new Picker());
|
||||
}
|
||||
@ -190,6 +194,11 @@ public class DesktopSuggestionPickerField extends DesktopSuggestionField impleme
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionsPermissions getActionsPermissions() {
|
||||
return actionsPermissions;
|
||||
}
|
||||
|
||||
private class Picker extends com.haulmont.cuba.desktop.sys.vcl.Picker {
|
||||
@Override
|
||||
protected void initEditor() {
|
||||
|
@ -20,6 +20,8 @@ package com.haulmont.cuba.web.gui.components;
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.chile.core.model.utils.InstanceUtils;
|
||||
import com.haulmont.cuba.gui.components.Action;
|
||||
import com.haulmont.cuba.gui.components.ActionsPermissions;
|
||||
import com.haulmont.cuba.gui.components.Component.SecuredActionsHolder;
|
||||
import com.haulmont.cuba.gui.components.Frame;
|
||||
import com.haulmont.cuba.gui.components.LookupPickerField;
|
||||
import com.haulmont.cuba.gui.data.CollectionDatasource;
|
||||
@ -34,12 +36,14 @@ import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class WebLookupPickerField extends WebLookupField implements LookupPickerField {
|
||||
public class WebLookupPickerField extends WebLookupField implements LookupPickerField, SecuredActionsHolder {
|
||||
|
||||
protected WebPickerField pickerField;
|
||||
protected boolean updateComponentValue = false;
|
||||
protected boolean refreshOptionsOnLookupClose = false;
|
||||
|
||||
protected final ActionsPermissions actionsPermissions = new ActionsPermissions(this);
|
||||
|
||||
public WebLookupPickerField() {
|
||||
}
|
||||
|
||||
@ -329,4 +333,9 @@ public class WebLookupPickerField extends WebLookupField implements LookupPicker
|
||||
public boolean isRefreshOptionsOnLookupClose() {
|
||||
return refreshOptionsOnLookupClose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionsPermissions getActionsPermissions() {
|
||||
return actionsPermissions;
|
||||
}
|
||||
}
|
@ -21,6 +21,8 @@ import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.core.global.AppBeans;
|
||||
import com.haulmont.cuba.core.global.Messages;
|
||||
import com.haulmont.cuba.gui.components.Action;
|
||||
import com.haulmont.cuba.gui.components.ActionsPermissions;
|
||||
import com.haulmont.cuba.gui.components.Component.SecuredActionsHolder;
|
||||
import com.haulmont.cuba.gui.components.Frame;
|
||||
import com.haulmont.cuba.gui.components.SearchPickerField;
|
||||
import com.haulmont.cuba.gui.data.CollectionDatasource;
|
||||
@ -34,11 +36,13 @@ import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class WebSearchPickerField extends WebSearchField implements SearchPickerField {
|
||||
public class WebSearchPickerField extends WebSearchField implements SearchPickerField, SecuredActionsHolder {
|
||||
|
||||
protected WebPickerField pickerField;
|
||||
protected boolean updateComponentValue = false;
|
||||
|
||||
protected final ActionsPermissions actionsPermissions = new ActionsPermissions(this);
|
||||
|
||||
public WebSearchPickerField() {
|
||||
final ComboBox selectComponent = component;
|
||||
WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {
|
||||
@ -300,4 +304,9 @@ public class WebSearchPickerField extends WebSearchField implements SearchPicker
|
||||
public boolean isRequired() {
|
||||
return pickerField.isRequired();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionsPermissions getActionsPermissions() {
|
||||
return actionsPermissions;
|
||||
}
|
||||
}
|
@ -18,6 +18,8 @@ package com.haulmont.cuba.web.gui.components;
|
||||
|
||||
import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.gui.components.Action;
|
||||
import com.haulmont.cuba.gui.components.ActionsPermissions;
|
||||
import com.haulmont.cuba.gui.components.Component.SecuredActionsHolder;
|
||||
import com.haulmont.cuba.gui.components.Frame;
|
||||
import com.haulmont.cuba.gui.components.SuggestionPickerField;
|
||||
import com.haulmont.cuba.gui.data.Datasource;
|
||||
@ -29,12 +31,14 @@ import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class WebSuggestionPickerField extends WebSuggestionField implements SuggestionPickerField {
|
||||
public class WebSuggestionPickerField extends WebSuggestionField implements SuggestionPickerField, SecuredActionsHolder {
|
||||
|
||||
protected WebPickerField pickerField;
|
||||
|
||||
protected boolean updateComponentValue = false;
|
||||
|
||||
protected final ActionsPermissions actionsPermissions = new ActionsPermissions(this);
|
||||
|
||||
public WebSuggestionPickerField() {
|
||||
component.setImmediate(true);
|
||||
component.setInvalidAllowed(false);
|
||||
@ -305,4 +309,9 @@ public class WebSuggestionPickerField extends WebSuggestionField implements Sugg
|
||||
|
||||
component.removePopupStyleName(styleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionsPermissions getActionsPermissions() {
|
||||
return actionsPermissions;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user