use of org.jdesktop.swingx.JXTable in project cuba by cuba-platform.
the class DesktopRowsCount method onNextClick.
private void onNextClick() {
if (!(datasource instanceof CollectionDatasource.SupportsPaging)) {
return;
}
CollectionDatasource.SupportsPaging ds = (CollectionDatasource.SupportsPaging) datasource;
int firstResult = ds.getFirstResult();
ds.setFirstResult(ds.getFirstResult() + ds.getMaxResults());
if (refreshDatasource(ds)) {
if (state == State.LAST && size == 0) {
ds.setFirstResult(firstResult);
int maxResults = ds.getMaxResults();
ds.setMaxResults(maxResults + 1);
refreshDatasource(ds);
ds.setMaxResults(maxResults);
}
if (owner instanceof DesktopAbstractTable) {
JXTable table = (JXTable) ((DesktopAbstractTable) owner).getComponent();
table.scrollRowToVisible(0);
}
} else {
ds.setFirstResult(firstResult);
}
}
use of org.jdesktop.swingx.JXTable in project cuba by cuba-platform.
the class DesktopRowsCount method onFirstClick.
protected void onFirstClick() {
if (!(datasource instanceof CollectionDatasource.SupportsPaging)) {
return;
}
CollectionDatasource.SupportsPaging ds = (CollectionDatasource.SupportsPaging) datasource;
int firstResult = ds.getFirstResult();
ds.setFirstResult(0);
if (refreshDatasource(ds)) {
if (owner instanceof DesktopAbstractTable) {
JXTable table = (JXTable) ((DesktopAbstractTable) owner).getComponent();
table.scrollRowToVisible(0);
}
} else {
ds.setFirstResult(firstResult);
}
}
use of org.jdesktop.swingx.JXTable in project cuba by cuba-platform.
the class DesktopRowsCount method onLastClick.
protected void onLastClick() {
if (!(datasource instanceof CollectionDatasource.SupportsPaging)) {
return;
}
CollectionDatasource.SupportsPaging ds = (CollectionDatasource.SupportsPaging) datasource;
int count = ((CollectionDatasource.SupportsPaging) datasource).getCount();
int itemsToDisplay = count % ds.getMaxResults();
if (itemsToDisplay == 0)
itemsToDisplay = ds.getMaxResults();
int firstResult = ds.getFirstResult();
ds.setFirstResult(count - itemsToDisplay);
if (refreshDatasource(ds)) {
if (owner instanceof DesktopAbstractTable) {
JXTable table = (JXTable) ((DesktopAbstractTable) owner).getComponent();
table.scrollRowToVisible(0);
}
} else {
ds.setFirstResult(firstResult);
}
}
use of org.jdesktop.swingx.JXTable in project cuba by cuba-platform.
the class EntityInspectorBrowseCompanion method setHorizontalScrollEnabled.
@Override
public void setHorizontalScrollEnabled(Table table, boolean enabled) {
JXTable jxTable = (JXTable) DesktopComponentsHelper.unwrap(table);
jxTable.setHorizontalScrollEnabled(enabled);
}
use of org.jdesktop.swingx.JXTable in project MtgDesktopCompanion by nicho92.
the class BestCardsDashlet method initGUI.
@Override
public void initGUI() {
JPanel panneauHaut = new JPanel();
getContentPane().add(panneauHaut, BorderLayout.NORTH);
cboFormat = new JComboBox<>();
cboFormat.setModel(new DefaultComboBoxModel<>(FORMAT.values()));
panneauHaut.add(cboFormat);
cboFilter = new JComboBox<>();
cboFilter.setModel(new DefaultComboBoxModel<>(MTGControler.getInstance().getEnabledDashBoard().getDominanceFilters()));
panneauHaut.add(cboFilter);
lblLoading = new JLabel("");
lblLoading.setIcon(MTGConstants.ICON_LOADING);
panneauHaut.add(lblLoading);
JScrollPane scrollPane = new JScrollPane();
getContentPane().add(scrollPane, BorderLayout.CENTER);
models = new CardDominanceTableModel();
table = new JXTable(models);
scrollPane.setViewportView(table);
initToolTip(table, 0, null);
cboFormat.addActionListener(ae -> init());
cboFilter.addActionListener(ae -> init());
if (getProperties().size() > 0) {
Rectangle r = new Rectangle((int) Double.parseDouble(getProperty("x")), (int) Double.parseDouble(getProperty("y")), (int) Double.parseDouble(getProperty("w")), (int) Double.parseDouble(getProperty("h")));
try {
cboFormat.setSelectedItem(getProperty("FORMAT", "standard"));
cboFilter.setSelectedItem(getProperty("FILTER", "all"));
} catch (Exception e) {
logger.error("can't get value", e);
}
setBounds(r);
}
setVisible(true);
}
Aggregations