org.tentackle.fx.rdc.DefaultRdcFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tentackle-fx-rdc Show documentation
Show all versions of tentackle-fx-rdc Show documentation
Rich Desktop Client based on FX
/*
* Tentackle - https://tentackle.org.
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.tentackle.fx.rdc;
import javafx.scene.control.TreeView;
import org.tentackle.common.Service;
import org.tentackle.fx.Fx;
import org.tentackle.fx.component.FxTableView;
import org.tentackle.fx.component.FxTreeTableView;
import org.tentackle.fx.rdc.crud.PdoCrud;
import org.tentackle.fx.rdc.search.PdoSearch;
import org.tentackle.fx.rdc.table.TablePopup;
import org.tentackle.fx.table.TableColumnConfiguration;
import org.tentackle.pdo.PersistentDomainObject;
/**
* The default RDC factory.
*
* @author harald
*/
@Service(RdcFactory.class)
public class DefaultRdcFactory implements RdcFactory {
@Override
public > PdoCrud createPdoCrud(T pdo, boolean editable, boolean modal) {
GuiProvider provider = GuiProviderFactory.getInstance().createGuiProvider(pdo);
PdoEditor editor = provider.createEditor();
@SuppressWarnings("unchecked")
PdoCrud crud = Fx.load(PdoCrud.class);
crud.setEditable(editable);
crud.setEditor(editor);
crud.setModal(modal);
crud.setPdo(pdo);
return crud;
}
@Override
public > PdoSearch createPdoSearch(T pdo) {
GuiProvider provider = GuiProviderFactory.getInstance().createGuiProvider(pdo);
PdoFinder finder = provider.createFinder();
@SuppressWarnings("unchecked")
PdoSearch search = Fx.load(PdoSearch.class);
search.setFinder(finder);
search.setPdo(pdo);
return search;
}
@Override
public > PdoTreeItem createTreeItem(T pdo) {
return new PdoTreeItem<>(pdo);
}
@Override
public > PdoTreeCell createTreeCell(TreeView treeView) {
return new PdoTreeCell<>(); // treeview is ignored by default but application may override this
}
@Override
public > PdoTreeTableCell createTreeTableCell(TableColumnConfiguration columnConfig) {
return new PdoTreeTableCell<>(columnConfig);
}
@Override
public > PdoTableCell createTableCell(TableColumnConfiguration columnConfig) {
return new PdoTableCell<>(columnConfig);
}
@Override
public TablePopup createTablePopup(FxTableView table, String preferencesSuffix, String title) {
return new TablePopup<>(table, preferencesSuffix, title);
}
@Override
public TablePopup createTablePopup(FxTreeTableView treeTable, String preferencesSuffix, String title) {
return new TablePopup<>(treeTable, preferencesSuffix, title);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy