Examples of TableColumnModel


Examples of javax.swing.table.TableColumnModel

        public void mouseClicked(MouseEvent event)
        {
            if( event.isPopupTrigger() == true )
                return; // dont allow right click sorts

            TableColumnModel colModel = getColumnModel();
            int index = colModel.getColumnIndexAtX(event.getX());
            int modelIndex = colModel.getColumn(index).getModelIndex();

            SortedTableModel<T> model = getModel();

            boolean isSortable = false;
            if( model != null && model.isSortable(modelIndex) )
View Full Code Here

Examples of javax.swing.table.TableColumnModel

     * charge of adding and removing the tablecolumn.
     */
private void createPopupMenu() {
        //Iterator it = mapTableColumnColumnKeeper.keySet().iterator();
        popupMenu = new JPopupMenu();
        TableColumnModel tcModel = this.getTable().getColumnModel();
        // int nbCol = tcModel.getColumnCount();

        //int nbCol = mapTableColumnColumnKeeper.keySet().size();
        for (Iterator entries = mapTableColumnColumnKeeper.entrySet().iterator(); entries.hasNext();) {
            // TableColumn column = tcModel.getColumn(i);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

     * redisplayed (even if they were hidden).
     *
     * @param ganttLanguage
     */
    public void languageChanged(GanttLanguage.Event changeEvent) {
        TableColumnModel tcm = this.getTable().getColumnModel();
        reloadColumns();
        //this.createPopupMenu();
//        Component tcomp[] = popupMenu.getComponents();
//
//        // The following is to check in popup menu those columns which were checked
View Full Code Here

Examples of javax.swing.table.TableColumnModel

      this.initHotKeyListener();
     
      addNewDownloadsTable.setAutoResizeMode( JTable.AUTO_RESIZE_NEXT_COLUMN);
      int tableWidth = getWidth();
     
      TableColumnModel headerColumnModel = addNewDownloadsTable.getTableHeader().getColumnModel();
      int defaultColumnWidthRatio[] = addNewDownloadsTableModel.getDefaultColumnWidthRatio();
      for(int i = 0 ; i < defaultColumnWidthRatio.length ; i++) {
        headerColumnModel.getColumn(i).setMinWidth(5);
        int ratio = tableWidth * defaultColumnWidthRatio[i] /100;
        headerColumnModel.getColumn(i).setPreferredWidth(ratio);
      }

    } catch (final Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of javax.swing.table.TableColumnModel

        final TableSorter sorter = this;
        final JTable tableView = table;
        tableView.setColumnSelectionAllowed(false);
        MouseAdapter listMouseListener = new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                TableColumnModel columnModel = tableView.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = tableView.convertColumnIndexToModel(viewColumn);
                if (e.getClickCount() == 1 && column != -1) {
                    //System.out.println("Sorting ...");
                    int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
                    boolean ascending = (shiftPressed == 0);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

        final TableSorter sorter = this;
        final JTable tableView = table;
        tableView.setColumnSelectionAllowed(false);
        MouseAdapter listMouseListener = new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                TableColumnModel columnModel = tableView.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = tableView.convertColumnIndexToModel(viewColumn);
                if (e.getClickCount() == 1 && column != -1) {
                    int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
                    boolean ascending = (shiftPressed == 0);
                    sorter.sortByColumn(column, ascending);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

        final TableSorter sorter = this;
        final JTable tableView = table;
        tableView.setColumnSelectionAllowed(false);
        MouseAdapter listMouseListener = new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                TableColumnModel columnModel = tableView.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = tableView.convertColumnIndexToModel(viewColumn);
                if (e.getClickCount() == 1 && column != -1) {
                    //System.out.println("Sorting ...");
                    int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
                    boolean ascending = (shiftPressed == 0);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

        //handler removes item to shopping cart
        table.addMouseListener( new TableSelectionHandler( ) );
        ListSelectionModel tableSelectionModel = table.getSelectionModel( );
        tableSelectionModel
                           .setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
        TableColumnModel tableColumnModel = table.getColumnModel( );
        //notice we have a custom renderer for each column as both columns
        // point to the same underlying object
        tableColumnModel.getColumn( 0 ).setCellRenderer( new NameRenderer( ) );
        tableColumnModel.getColumn( 1 ).setCellRenderer( new PriceRenderer( ) );
        tableColumnModel.getColumn( 1 ).setMaxWidth( 50 );

        JScrollPane tablePane = new JScrollPane( table );
        tablePane.setPreferredSize( new Dimension( 150, 100 ) );
        tableContainer.add( tablePane );
View Full Code Here

Examples of javax.swing.table.TableColumnModel

    mainTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    mainTable.setGridColor(Color.LIGHT_GRAY);
    mainTable.setIntercellSpacing(new Dimension(3, 3));
    mainTable.setDefaultRenderer(String.class, new JPdfSelectionTableRenderer());

    TableColumnModel mainTableColModel = mainTable.getColumnModel();
    mainTableColModel.getColumn(AbstractPdfSelectionTableModel.PASSWORD).setCellEditor(
        new DefaultCellEditor(new JPasswordField()));

    TableColumn tc = mainTableColModel.getColumn(AbstractPdfSelectionTableModel.ROW_NUM);
    tc.setPreferredWidth(25);
    tc.setMaxWidth(35);

    // header tooltip
    JPdfSelectionToolTipHeader toolTipHeader = new JPdfSelectionToolTipHeader(mainTableColModel);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

        m_table.addMouseListener(new MouseAdapter()
        {
            @Override
            public void mouseClicked(MouseEvent ev)
            {
                TableColumnModel colModel = m_table.getColumnModel();
                int colIndex = colModel.getColumnIndexAtX(ev.getX()), index;
                if (colIndex >= 0)
                {
                    if ((index = colModel.getColumn(colIndex).getModelIndex()) >= 0)
                    {
                        int tag = JExifDataModel.m_colTag[index];
                        if (tag == JExifTag.GPSTAG_TAG_MAPLINK)
                        {
                            if ((index = m_table.getSelectedRow()) >= 0)
                            {
                                JIfdData data = m_tableData.getRowData(index);
                                if (data.isTagPresent(tag))
                                {
                                    float latitude = data.getGPSLatitude();
                                    if (data.getGPSLatitudeRef().equals("S"))
                                        latitude = -latitude;
                                    float longitude = data.getGPSLongitude();
                                    if (data.getGPSLongitudeRef().equals("W"))
                                        longitude = -longitude;
                                    String title, str;
                                    Date date = JIfdData.getDateFromString(data.getDigitizedDateTime());
                                    if (date == null)
                                        date = data.getFileDate();
                                    SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
                                    StringBuffer strBuf = new StringBuffer();
                                    sdf.format(date, strBuf, new FieldPosition(0));
                                    String strDate = strBuf + ", " + DateFormat.getDateInstance(DateFormat.LONG).format(date);
                                    String strTime = DateFormat.getTimeInstance(DateFormat.MEDIUM).format(date);
                                    String fileName = data.getFullFileName();
                                    title = String.format(Main.getString("data_gps_title"), fileName, strDate, strTime);
                                    String laStr = JExifDataModel.getTagValue(data, JExifTag.GPSTAG_TAG_LATITUDE).toString();
                                    String loStr = JExifDataModel.getTagValue(data, JExifTag.GPSTAG_TAG_LONGITUDE).toString();
                                    String alStr = "";
                                    if (data.isTagPresent(JExifTag.GPSTAG_TAG_ALTITUDE))
                                        alStr = JExifDataModel.getTagValue(data, JExifTag.GPSTAG_TAG_ALTITUDE).toString();
                                    String info = String.format(Main.getString("data_gps_info"), fileName, strDate, strTime, laStr, loStr, alStr);
                                    try
                                    {
                                        title = URLEncoder.encode(title, "UTF-8");
                                    }
                                    catch (UnsupportedEncodingException ex)
                                    {}
                                    try
                                    {
                                        info = URLEncoder.encode(info, "UTF-8");
                                    }
                                    catch (UnsupportedEncodingException ex)
                                    {}
                                    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
                                    int size_w = (int)(dim.width * 0.66f);
                                    int size_h = (int)(dim.height * 0.66f);

                                    String url = "";
                                    Locale loc = Locale.getDefault();
                                    Locale.setDefault(Locale.US);
                                    int width = colModel.getColumn(colIndex).getWidth()/3;

                                     int offset = 0;
                                    for(int i = 0; i < colIndex; i++)
                                        offset += colModel.getColumn(i).getWidth();
                                    offset = ev.getX() - offset;

                                    if (offset < width)
                                        url = String.format(Main.getString("data_gps_gmlinkhttp"), latitude, longitude, latitude, longitude, "hybrid", 15, info, title, size_w, size_h);
                                    else if (offset >= width && offset < 2*width)
 
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.