net.anwiba.commons.swing.table.ObjectTableConfigurationBuilder Maven / Gradle / Ivy
/*
* #%L
* anwiba commons swing
* %%
* Copyright (C) 2007 - 2016 Andreas Bartels
* %%
* 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 2.1 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%
*/
package net.anwiba.commons.swing.table;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ListSelectionModel;
import net.anwiba.commons.swing.table.action.ITableActionConfiguration;
import net.anwiba.commons.swing.table.action.ITableActionFactory;
public class ObjectTableConfigurationBuilder {
private int selectionMode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION;
private final List columnConfigurations = new ArrayList<>();
private final List> actionFactories = new ArrayList<>();
private int preferredVisibleRowCount = 10;
private IMouseListenerFactory mouseListenerFactory;
private IKeyListenerFactory keyListenerFactory;
public void setKeyListenerFactory(final IKeyListenerFactory keyListenerFactory) {
this.keyListenerFactory = keyListenerFactory;
}
public void setSelectionMode(final int selectionMode) {
this.selectionMode = selectionMode;
}
public void addColumnConfiguration(final IColumnConfiguration columnConfiguration) {
this.columnConfigurations.add(columnConfiguration);
}
public void addActionFactory(final ITableActionFactory factory) {
this.actionFactories.add(factory);
}
public void setPreferredVisibleRowCount(final int preferredVisibleRowCount) {
this.preferredVisibleRowCount = preferredVisibleRowCount;
}
public IObjectTableConfiguration build() {
final ITableActionConfiguration actionConfiguration = new TableActionConfiguration<>(this.actionFactories);
return new ObjectTableConfiguration<>(
-1,
this.selectionMode,
this.preferredVisibleRowCount,
this.columnConfigurations,
this.mouseListenerFactory,
this.keyListenerFactory,
actionConfiguration);
}
public void setMouseListenerFactory(final IMouseListenerFactory mouseListenerFactory) {
this.mouseListenerFactory = mouseListenerFactory;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy