mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 03:38:33 +08:00
In/Not in conditions and date in filter. #PL-2283
This commit is contained in:
parent
bbd0bb3a99
commit
1d1a64f458
@ -12,6 +12,7 @@ import com.haulmont.chile.core.model.MetaClass;
|
||||
import com.haulmont.cuba.core.entity.Entity;
|
||||
import com.haulmont.cuba.core.global.AppBeans;
|
||||
import com.haulmont.cuba.core.global.MessageProvider;
|
||||
import com.haulmont.cuba.core.global.Messages;
|
||||
import com.haulmont.cuba.core.global.UserSessionSource;
|
||||
import com.haulmont.cuba.desktop.App;
|
||||
import com.haulmont.cuba.desktop.gui.components.*;
|
||||
@ -46,6 +47,7 @@ public class ListEditComponent extends Picker {
|
||||
|
||||
private Class itemClass;
|
||||
private MetaClass metaClass;
|
||||
private Messages messages;
|
||||
|
||||
private CollectionDatasource collectionDatasource;
|
||||
private List<String> runtimeEnum;
|
||||
@ -58,6 +60,7 @@ public class ListEditComponent extends Picker {
|
||||
protected UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.class);
|
||||
|
||||
public ListEditComponent(Class itemClass) {
|
||||
messages = AppBeans.get(Messages.class);
|
||||
setOpaque(false);
|
||||
contentPanel.setOpaque(false);
|
||||
actionsPanel.setOpaque(false);
|
||||
@ -108,7 +111,7 @@ public class ListEditComponent extends Picker {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void setText(String text){
|
||||
public void setText(String text) {
|
||||
super.setValue(text);
|
||||
}
|
||||
|
||||
@ -140,7 +143,6 @@ public class ListEditComponent extends Picker {
|
||||
private JPanel mainPanel = new JPanel(new MigLayout("fill"));
|
||||
private JPanel listPanel;
|
||||
private JPanel dateFieldPanel;
|
||||
private Object date = null;
|
||||
private JScrollPane pane;
|
||||
|
||||
private ListEditWindow(Map<Object, String> values) {
|
||||
@ -155,7 +157,7 @@ public class ListEditComponent extends Picker {
|
||||
addItemLayout(entry.getKey(), entry.getValue());
|
||||
}
|
||||
mainPanel.add(pane, "wrap, dock north, grow");
|
||||
mainPanel.setPreferredSize(new Dimension(250,250));
|
||||
mainPanel.setPreferredSize(new Dimension(250, 250));
|
||||
final DesktopAbstractComponent field;
|
||||
JButton addButton = null;
|
||||
|
||||
@ -248,30 +250,22 @@ public class ListEditComponent extends Picker {
|
||||
} else if (Date.class.isAssignableFrom(itemClass)) {
|
||||
field = new DesktopDateField();
|
||||
dateFieldPanel = new JPanel(new MigLayout());
|
||||
addButton = new JButton("Add");
|
||||
addButton = new JButton(messages.getMessage(getClass(), "addButton"));
|
||||
addButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (date != null){
|
||||
String str = addDate((Date)date);
|
||||
Date date = ((DesktopDateField) field).getValue();
|
||||
if (date != null) {
|
||||
String str = addDate(date);
|
||||
addItemLayout(date, str);
|
||||
((DesktopDateField)field).setValue(null);
|
||||
date = null;
|
||||
((DesktopDateField) field).setValue(null);
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
if (itemClass.equals(java.sql.Date.class))
|
||||
((DesktopDateField) field).setResolution(DateField.Resolution.DAY);
|
||||
else
|
||||
((DesktopDateField) field).setResolution(DateField.Resolution.MIN);
|
||||
((DesktopDateField) field).addListener(new ValueListener() {
|
||||
@Override
|
||||
public void valueChanged(Object source, String property, Object prevValue, Object value) {
|
||||
if (value != null) {
|
||||
date = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} else
|
||||
throw new UnsupportedOperationException();
|
||||
@ -306,13 +300,12 @@ public class ListEditComponent extends Picker {
|
||||
bottomPanel.add(cancelBtn);
|
||||
|
||||
mainPanel.add(bottomPanel, "dock south");
|
||||
if (dateFieldPanel == null){
|
||||
if (dateFieldPanel == null) {
|
||||
mainPanel.add(field.getComposition(), "wrap, dock north, gapy 10px 10px");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dateFieldPanel.add(field.getComposition());
|
||||
dateFieldPanel.add(addButton);
|
||||
mainPanel.add(dateFieldPanel,"dock south");
|
||||
mainPanel.add(dateFieldPanel, "dock south");
|
||||
}
|
||||
pack();
|
||||
|
||||
@ -321,7 +314,7 @@ public class ListEditComponent extends Picker {
|
||||
|
||||
@Override
|
||||
public void windowClosed(WindowEvent e) {
|
||||
DesktopComponentsHelper.getTopLevelFrame(ListEditComponent.this).activate();
|
||||
DesktopComponentsHelper.getTopLevelFrame(ListEditComponent.this).activate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -5,4 +5,5 @@ export.dataProviderError=Could not save file, data provider error
|
||||
export.tempFileError=Could not create temp file for download
|
||||
export.openError=Could not open file, please check your installed software
|
||||
export.fileCaption=File
|
||||
upload.selectFiles=Upload
|
||||
upload.selectFiles=Upload
|
||||
addButton=Add
|
@ -6,3 +6,4 @@ export.saveError=Невозможно сохранить файл
|
||||
export.dataProviderError=Невозможно сохранить файл, ошибка провайдера данных
|
||||
export.tempFileError=Невозможно создать временный файл
|
||||
upload.selectFiles=Добавить
|
||||
addButton=Добавить
|
@ -343,12 +343,11 @@ public class ListEditComponent extends CustomField {
|
||||
private VerticalLayout listLayout;
|
||||
private Map<Object, String> values;
|
||||
private Messages messages;
|
||||
private Object date = null;
|
||||
|
||||
private ListEditWindow(Map<Object, String> values) {
|
||||
super(AppBeans.get(Messages.class).getMessage(MESSAGES_PACK, "ListEditWindow.caption"));
|
||||
setWidth(200, Unit.PIXELS);
|
||||
setHeight(200,Unit.PIXELS);
|
||||
setHeight(200, Unit.PIXELS);
|
||||
setModal(true);
|
||||
|
||||
this.messages = AppBeans.get(Messages.class);
|
||||
@ -369,8 +368,8 @@ public class ListEditComponent extends CustomField {
|
||||
editAreaPanel.setSizeFull();
|
||||
editAreaPanel.setContent(listLayout);
|
||||
contentLayout.addComponent(editAreaPanel);
|
||||
contentLayout.setExpandRatio(editAreaPanel,1.0f);
|
||||
contentLayout.setHeight(100,Unit.PERCENTAGE);
|
||||
contentLayout.setExpandRatio(editAreaPanel, 1.0f);
|
||||
contentLayout.setHeight(100, Unit.PERCENTAGE);
|
||||
|
||||
final Field field;
|
||||
Button addButton = null;
|
||||
@ -468,20 +467,18 @@ public class ListEditComponent extends CustomField {
|
||||
|
||||
} else if (Date.class.isAssignableFrom(itemClass)) {
|
||||
final WebDateField dateField = new WebDateField();
|
||||
|
||||
field = dateField.getComponent();
|
||||
dateFieldLayout = new HorizontalLayout();
|
||||
dateFieldLayout.setHeight(-1,Unit.PIXELS);
|
||||
this.setWidth(350, Unit.PIXELS);
|
||||
addButton = new Button("Add");
|
||||
addButton = new Button(messages.getMessage(getClass(), "addButton"));
|
||||
addButton.addClickListener(new Button.ClickListener() {
|
||||
@Override
|
||||
public void buttonClick(Button.ClickEvent event) {
|
||||
if (date != null){
|
||||
String str = addDate((Date)date);
|
||||
Date date = dateField.getValue();
|
||||
if (date != null) {
|
||||
String str = addDate(date);
|
||||
addItemLayout(date, str);
|
||||
field.setValue(null);
|
||||
date = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -496,15 +493,6 @@ public class ListEditComponent extends CustomField {
|
||||
}
|
||||
dateField.setResolution(resolution);
|
||||
dateField.setDateFormat(dateFormat);
|
||||
|
||||
dateField.addListener(new ValueListener() {
|
||||
@Override
|
||||
public void valueChanged(Object source, String property, Object prevValue, Object value) {
|
||||
if (value != null) {
|
||||
date = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@ -519,7 +507,6 @@ public class ListEditComponent extends CustomField {
|
||||
}
|
||||
|
||||
HorizontalLayout bottomLayout = new HorizontalLayout();
|
||||
bottomLayout.setHeight(-1,Unit.PIXELS);
|
||||
bottomLayout.setMargin(new MarginInfo(true, false, true, false));
|
||||
bottomLayout.setSpacing(true);
|
||||
|
||||
|
@ -37,4 +37,6 @@ warning.msg=Substitution is not set. This link must be opened on behalf of <b>%s
|
||||
warning.userNotFound=User not found.
|
||||
|
||||
searchSelect.notFound=Not found items for filter: %s
|
||||
searchSelect.minimumLengthOfFilter=Minimum length of search string is %s
|
||||
searchSelect.minimumLengthOfFilter=Minimum length of search string is %s
|
||||
|
||||
addButton=Add
|
@ -37,4 +37,6 @@ warning.msg=Отсутствуют права на замещение. Данн
|
||||
warning.userNotFound=Пользователь, от имени которого Вы хотите открыть ссылку, не найден.
|
||||
|
||||
searchSelect.notFound=Не найдено записей для фильтра: %s
|
||||
searchSelect.minimumLengthOfFilter=Минимальная длина строки для поиска %s
|
||||
searchSelect.minimumLengthOfFilter=Минимальная длина строки для поиска %s
|
||||
|
||||
addButton=Добавить
|
Loading…
Reference in New Issue
Block a user