
xdev.ui.XdevNmListBox Maven / Gradle / Ivy
package xdev.ui;
/*-
* #%L
* XDEV Application Framework
* %%
* Copyright (C) 2003 - 2020 XDEV Software
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import xdev.db.DBConnection;
import xdev.db.DBException;
import xdev.db.sql.Condition;
import xdev.ui.ManyToMany.State;
import xdev.util.logging.LoggerFactory;
import xdev.util.logging.XdevLogger;
import xdev.vt.KeyValues;
import xdev.vt.VirtualTable;
import xdev.vt.VirtualTable.VirtualTableRow;
import xdev.vt.VirtualTableException;
public class XdevNmListBox extends XdevListBox implements ManyToManyComponent
{
/**
* Logger instance for this class.
*/
private static final XdevLogger log = LoggerFactory.getLogger(XdevNmListBox.class);
private State state;
private VirtualTable savedState;
public XdevNmListBox()
{
super(true);
}
@Override
public void setModel(VirtualTable vt, String itemCol, String dataCol, boolean queryData)
{
/*
* Dont't use unique indices in this VT because most of the values are
* not used, default values will be added and
* UniqueIndexDoubleValuesException are thrown
*/
vt = vt.clone(!queryData);
vt.setCheckUniqueIndexDoubleValues(false);
super.setModel(vt,itemCol,dataCol,false);
/*
* Don't query all the data of the nm-table, use the refresh method
* instead to get a reasonable result.
*/
if(queryData)
{
Formular form = FormularSupport.getFormularOf(this);
if(form != null)
{
VirtualTable masterVT = form.getVirtualTable();
if(masterVT != null)
{
refresh(masterVT.createRow());
}
}
}
}
@Override
public void refresh(VirtualTableRow masterRecord)
{
try
{
state = new State(masterRecord,getVirtualTable());
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy