Search in sources :

Example 16 with JXTable

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);
    }
}
Also used : JXTable(org.jdesktop.swingx.JXTable) CollectionDatasource(com.haulmont.cuba.gui.data.CollectionDatasource)

Example 17 with JXTable

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);
    }
}
Also used : JXTable(org.jdesktop.swingx.JXTable) CollectionDatasource(com.haulmont.cuba.gui.data.CollectionDatasource)

Example 18 with JXTable

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);
    }
}
Also used : JXTable(org.jdesktop.swingx.JXTable) CollectionDatasource(com.haulmont.cuba.gui.data.CollectionDatasource)

Example 19 with JXTable

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);
}
Also used : JXTable(org.jdesktop.swingx.JXTable)

Example 20 with JXTable

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JXTable(org.jdesktop.swingx.JXTable) CardDominanceTableModel(org.magic.gui.models.CardDominanceTableModel) Rectangle(java.awt.Rectangle) JLabel(javax.swing.JLabel)

Aggregations

JXTable (org.jdesktop.swingx.JXTable)25 JScrollPane (javax.swing.JScrollPane)13 JPanel (javax.swing.JPanel)11 JLabel (javax.swing.JLabel)10 Rectangle (java.awt.Rectangle)6 ArrayList (java.util.ArrayList)6 BorderLayout (java.awt.BorderLayout)5 JButton (javax.swing.JButton)5 TableFilterHeader (net.coderazzi.filters.gui.TableFilterHeader)5 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)4 JComboBox (javax.swing.JComboBox)4 MagicEdition (org.magic.api.beans.MagicEdition)4 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)3 Component (java.awt.Component)3 SQLException (java.sql.SQLException)3 List (java.util.List)3 JSpinner (javax.swing.JSpinner)3 JSplitPane (javax.swing.JSplitPane)3 JTabbedPane (javax.swing.JTabbedPane)3 SpinnerNumberModel (javax.swing.SpinnerNumberModel)3