Examples of TableColumnModel


Examples of javax.swing.table.TableColumnModel

    private void doSaveSettings()
    {  
        int i, anzahl = m_table.getColumnCount();
        Main.m_settings.m_cols = new short[anzahl];
        Main.m_settings.m_colWidth = new int[anzahl];
        TableColumnModel colModel = m_table.getColumnModel();
        for (i=0; i<anzahl; i++)
        {
            Main.m_settings.m_cols[i] = (short)m_table.convertColumnIndexToModel(i);
            TableColumn tableCol = colModel.getColumn(i);
            Main.m_settings.m_colWidth[i] = tableCol.getPreferredWidth();
        }

        // Custum tree entries
        DefaultTreeModel treeModel = (DefaultTreeModel)m_tree.getModel();
View Full Code Here

Examples of javax.swing.table.TableColumnModel

    }
   
    private void setTableHeaderValues()
    {
        int i, anzahl = m_table.getColumnCount();
        TableColumnModel colModel = m_table.getColumnModel();

        for (i=0; i<anzahl; i++)
        {
            TableColumn tableCol = colModel.getColumn(i);
            int colIndex = m_table.convertColumnIndexToModel(i);
            JLabel label = (JLabel)tableCol.getHeaderRenderer();
            if (label != null)
            {
                label.setIcon(m_tableData.getColIcon(colIndex));
View Full Code Here

Examples of javax.swing.table.TableColumnModel

            public void mouseClicked(MouseEvent ev)
            {
                int button = ev.getButton();
                if (button == MouseEvent.BUTTON1 || button == MouseEvent.BUTTON2)
                {
                    TableColumnModel colModel = m_table.getColumnModel();
                    int colIndex = colModel.getColumnIndexAtX(ev.getX());
                    colIndex = m_table.convertColumnIndexToModel(colIndex);
                    // if (JExifDataModel.m_colTag[colIndex] != JExifTag.GPSTAG_TAG_MAPLINK)
                    {
                        if (Main.m_settings.isDebug())
                            System.err.println("Sort:" + colIndex);

                        if (m_tableData.getSortCol() != colIndex)
                            m_tableData.setSortCol(colIndex);
                        else
                            m_tableData.setSortUp(!m_tableData.getSortUp());
                        setTableHeaderValues();

                        JIfdData jifdData = null;
                        int selRow = m_table.getSelectedRow();
                        if (selRow >= 0)
                            jifdData = m_tableData.getRowData(selRow);
                        m_tableData.sort();
                        if (jifdData != null && (selRow = m_tableData.findRow(jifdData)) >= 0)
                            selectRow(selRow, true);
                    }
                }
            }

            @Override
            public void mousePressed(MouseEvent ev)
            {
                doShowPopupMenu(ev);
            }

            @Override
            public void mouseReleased(MouseEvent ev)
            {
                doShowPopupMenu(ev);
            }

            protected void doShowPopupMenu(MouseEvent ev)
            {
                if (ev.isPopupTrigger())
                {
                    JPopupMenu menu = new JPopupMenu();
                    final MouseEvent mouseEv = ev;
                    JStatusMenuItem menuItem;
                    final TableModel tblModel = m_table.getModel();
                    if (tblModel.getColumnCount() != m_table.getColumnCount())
                    {
                        menuItem = new JStatusMenuItem(Main.getString("menu_tableheader_add"), Main.getString("statusbar_menutableheader_add_help"), m_statusBar);
                        menu.add(menuItem);
                        menuItem.addActionListener(new ActionListener()
                        {
                            public void actionPerformed (ActionEvent ev)
                            {
                                int i, anzahl = tblModel.getColumnCount(), colIndex, index = 0;
                                JColChooserData[] dataArray = new JColChooserData[anzahl - m_table.getColumnCount()];
                                for (i=0; i<anzahl; i++)
                                {
                                    colIndex = m_table.convertColumnIndexToView(i);
                                    if (colIndex == -1)
                                        dataArray[index++] = new JColChooserData(tblModel.getColumnName(i), i);
                                }
                                JColChooserDialog dia = new JColChooserDialog(Main.m_mainFrame, dataArray);
                                dia.setVisible(true);
                                if (dia.isOk())
                                {
                                    JColChooserData data = dia.getSelectedItem();
                                    TableColumn tblCol = new TableColumn();
                                    tblCol.setModelIndex(data.m_modelColIndex);
                                    TableColumnModel colModel = m_table.getColumnModel();
                                    colIndex = colModel.getColumnIndexAtX(mouseEv.getX());
                                    m_table.addColumn(tblCol);
                                    m_table.moveColumn(m_table.getColumnCount()-1, colIndex);
                                    if (JExifDataModel.m_colTag[data.m_modelColIndex] == JExifTag.GPSTAG_TAG_MAPLINK)
                                    {
                                        int w = new ImageIcon(Main.m_url_map).getIconWidth();
                                        tblCol.setPreferredWidth(w);
                                        tblCol.setMaxWidth(w);
                                        tblCol.setMinWidth(w);
                                    }
                                }
                            }
                        });
                    }
                    if (m_table.getColumnCount() > 1)
                    {
                        menuItem = new JStatusMenuItem(Main.getString("menu_tableheader_delete"), Main.getString("statusbar_menutableheader_delete_help"), m_statusBar);
                        menuItem.addActionListener(new ActionListener()
                        {
                            public void actionPerformed (ActionEvent ev)
                            {
                                TableColumnModel colModel = m_table.getColumnModel();
                                int colIndex = colModel.getColumnIndexAtX(mouseEv.getX());
                                TableColumn tblCol = colModel.getColumn(colIndex);
                                m_table.removeColumn(tblCol);
                                }
                        });
                        menu.add(menuItem);
                    }
View Full Code Here

Examples of nextapp.echo2.app.table.TableColumnModel

                testTable.setWidth(new Extent(100, Extent.PERCENT));
            }
        });
        controlsColumn.addButton("Set ColumnWidths Equal", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                TableColumnModel columnModel = testTable.getColumnModel();
                int columnCount = columnModel.getColumnCount();
                    if (columnCount > 0) {
                    Extent width = new Extent(100 / columnCount, Extent.PERCENT);
                    for (int i = 0; i < columnCount; ++i) {
                        columnModel.getColumn(i).setWidth(width);
                    }
                }
            }
        });
        controlsColumn.addButton("Toggle Header Visible", new ActionListener() {
View Full Code Here

Examples of org.jfree.layouting.renderer.model.table.cols.TableColumnModel

    // In a perfect world, we would start to take pagebreaks into account
    // and would try to distribute the table columns in a way, so that they
    // do not cross inner page boundaries.

    // But for the first release, our world is not perfect!
    final TableColumnModel model = tableBox.getColumnModel();
    long position = 0;
    final int columnCount = model.getColumnCount();
    for (int i = 0; i < columnCount; i++)
    {
      final TableColumn column = model.getColumn(i);
      column.setEffectiveCellPosition(position);
      position += column.getEffectiveSize() + model.getBorderSpacing();
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.table.columns.TableColumnModel

    final MinorAxisTableContext tableContext = getTableContext();
    final TableCellRenderBox tableCellRenderBox = (TableCellRenderBox) box;

    // This is slightly different for table cells ...
    final int columnIndex = tableCellRenderBox.getColumnIndex();
    final TableColumnModel columnModel = tableContext.getColumnModel();

    // cell-size does not include border spacing
    final long startOfRowX = nodeContext.getParentX1();

    final long x = startOfRowX + columnModel.getCellPosition(columnIndex);
    final long insetsLeft = Math.max(box.getInsetsLeft(), columnModel.getBorderSpacing() / 2);
    final long insetsRight = Math.max(box.getInsetsRight(), columnModel.getBorderSpacing() / 2);
    final long width = computeCellWidth(tableCellRenderBox);
    nodeContext.setArea(x, insetsLeft, insetsRight, width);
    return true;
  }
View Full Code Here

Examples of org.swingml.model.TableColumnModel

*/
public class TableHeaderCellRenderer extends DefaultTableCellRenderer {

    public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JTableModel model = (JTableModel) table.getModel();
        TableColumnModel columnModel = (TableColumnModel) model.getColumns().get(column);
        LabelDecorator.decorateLabel(this, columnModel, table.getFont());

        setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));

        // Set alignment
        int alignment = JLabel.LEFT;
        if (columnModel.getAlignment().equalsIgnoreCase(Constants.RIGHT)) {
            alignment = JLabel.RIGHT;
        } else if (columnModel.getAlignment().equalsIgnoreCase(Constants.CENTER)) {
            alignment = JLabel.CENTER;
        }
        setHorizontalAlignment(alignment);

        setValue(value);
View Full Code Here

Examples of org.teiid.cdk.core.model.TableColumnModel

    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setFont(JFaceResources.getTextFont());

    tableColumns = new ArrayList<TableColumnModel>();
    TableColumnModel column = new TableColumnModel("");
    column.setAlignment(SWT.LEFT);
    column.setDataType(TableColumnModel.DataType.STRING);
    column.setEditable(false);
    tableColumns.add(column);

    column = new TableColumnModel(DESCRIPTION);
    column.setColumnName("description");
    column.setAlignment(SWT.LEFT);
    column.setDataType(TableColumnModel.DataType.STRING);
    tableColumns.add(column);

    column = new TableColumnModel(CONFIG_PROPERTY_NAME);
    column.setColumnName("config-property-name");
    column.setAlignment(SWT.LEFT);
    column.setDataType(TableColumnModel.DataType.STRING);
    tableColumns.add(column);

    column = new TableColumnModel(CONFIG_PROPERTY_TYPE);
    column.setColumnName("config-property-type");
    column.setAlignment(SWT.LEFT);
    column.setDataType(TableColumnModel.DataType.DROPDOWN);
    column.setDropdownValues(CONFIG_PROPERTY_TYPES);
    tableColumns.add(column);

    column = new TableColumnModel(CONFIG_PROPERTY_VALUE);
    column.setColumnName("config-property-value");
    column.setAlignment(SWT.LEFT);
    column.setDataType(TableColumnModel.DataType.STRING);
    tableColumns.add(column);

    columnNames = AppUtil.initTableWithCellEditors(tableColumns, tableViewer);
    tableViewer.setCellModifier(new ConfigPropertyCellEditor(this));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.