Package DisplayProject.controls

Examples of DisplayProject.controls.OutlineFieldJTree


        params.put( "modifier", new ParameterHolder(modifiers) );

        // Set nodes and rows and columns on relevant controls

        if (pControl != null && pControl instanceof OutlineFieldJTree) {
            OutlineFieldJTree tree = (OutlineFieldJTree)pControl;
            OutlineField control = (OutlineField)tree.getOutlineField();

            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based and used Craig's new method. We need to translate
            // the X-offset by the amount the tree is indented.
            params.put("column", new ParameterHolder(control.getColumnIndex(X + OutlineField.cHEADER_MARGIN_LEFT) + 1));
            params.put( "node", new ParameterHolder(((OutlineFieldJTree)pControl).getLastSelectedPathComponent()) );
            params.put( "row", new ParameterHolder(((OutlineFieldJTree)pControl).getRowForLocation(X, Y)+1) ); //CONV_REM: dc - added row parameter

        }
        else if (pControl != null && pControl instanceof JListView) {
            params.put( "node", new ParameterHolder(((JListView)pControl).getCurrentNode()) );
            params.put( "row", new ParameterHolder(0) );
            params.put( "column", new ParameterHolder(0) );
        }
        else if (pControl != null && pControl instanceof ListView) {
            ListView list = (ListView)pControl;
            params.put( "node", new ParameterHolder(((ListView)pControl).getCurrentNode()) );
            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based
            // TF:26/3/08:getSelectedRow has changed to be 1-based itself, so we need to change this back to remove the +1
            params.put( "row", new ParameterHolder(list.getSelectedRow()));
//            qq_Params.put( "column", new ParameterHolder(0) );
            params.put( "column", new ParameterHolder(list.getTable().getSelectedColumn()+1) );//CONV_REM:dq Need the column that was selected, not a 0.
        }
        else if (pControl != null && pControl instanceof JTable)
        {
            JTable table = (JTable)pControl;
            if (table.getModel() instanceof TableSorter) {
                DisplayNode dn = ((DisplayNode)((ArrayFieldModel)((TableSorter)table.getModel()).getTableModel()).getData().get(table.getSelectedRow()));
                params.put( "node", new ParameterHolder(dn) );
            }
            else {
                params.put( "node", new ParameterHolder(null) );
            }
            // TF:23/9/07:We need to return the X and Y coordinates with respect to the cell, not the table. Also, we need
            // to change the child to the renderer or editor for that cell.
            Point loc = new Point(X, Y);
            int row = table.rowAtPoint(loc);
            int column = table.columnAtPoint(loc);
            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based
            params.put( "row", new ParameterHolder(row+1) );
            params.put( "column", new ParameterHolder(column+1) );

            // make sure we have a valid cell, just in case they click outside the table, eg in the empty scroll pane.
            if (row >= 0 && column >= 0) {
                Rectangle cellBounds = table.getCellRect(row, column, false);
                X -= cellBounds.x;
                Y -= cellBounds.y;

                TableCellRenderer renderer = table.getCellRenderer(row, column);
                if (renderer != null) {
                    Component c = renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column);
                    params.put("child", new ParameterHolder(c));
                }
            }
        }
        else if (pControl != null && pControl instanceof JTree)
        {
          JTree tree = (JTree) pControl;
            int currentRow = getRowForLocation(Y, tree);
            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based
            params.put( "row", new ParameterHolder(currentRow+1) );
            TreePath path = tree.getPathForRow(currentRow);
            if (path != null) {
              params.put("node", new ParameterHolder(path.getLastPathComponent()));
            }
            else {
              params.put("node", new ParameterHolder(null));
View Full Code Here


        params.put( "modifier", new ParameterHolder(modifiers) );

        // Set nodes and rows and columns on relevant controls

        if (pControl != null && pControl instanceof OutlineFieldJTree) {
            OutlineFieldJTree tree = (OutlineFieldJTree)pControl;
            OutlineField control = (OutlineField)tree.getOutlineField();

            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based and used Craig's new method. We need to translate
            // the X-offset by the amount the tree is indented.
            params.put("column", new ParameterHolder(control.getColumnIndex(X + OutlineField.cHEADER_MARGIN_LEFT) + 1));
            params.put( "node", new ParameterHolder(((OutlineFieldJTree)pControl).getLastSelectedPathComponent()) );
            params.put( "row", new ParameterHolder(((OutlineFieldJTree)pControl).getRowForLocation(X, Y)+1) ); //CONV_REM: dc - added row parameter

        }
        else if (pControl != null && pControl instanceof JListView) {
            params.put( "node", new ParameterHolder(((JListView)pControl).getCurrentNode()) );
            params.put( "row", new ParameterHolder(0) );
            params.put( "column", new ParameterHolder(0) );
        }
        else if (pControl != null && pControl instanceof ListView) {
            ListView list = (ListView)pControl;
            params.put( "node", new ParameterHolder(((ListView)pControl).getCurrentNode()) );
            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based
            // TF:26/3/08:getSelectedRow has changed to be 1-based itself, so we need to change this back to remove the +1
            params.put( "row", new ParameterHolder(list.getSelectedRow()));
//            qq_Params.put( "column", new ParameterHolder(0) );
            params.put( "column", new ParameterHolder(list.getTable().getSelectedColumn()+1) );//CONV_REM:dq Need the column that was selected, not a 0.
        }
        else if (pControl != null && pControl instanceof JTable)
        {
            JTable table = (JTable)pControl;
            if (table.getModel() instanceof TableSorter) {
                DisplayNode dn = ((DisplayNode)((ArrayFieldModel)((TableSorter)table.getModel()).getTableModel()).getData().get(table.getSelectedRow()));
                params.put( "node", new ParameterHolder(dn) );
            }
            else {
                params.put( "node", new ParameterHolder(null) );
            }
            // TF:23/9/07:We need to return the X and Y coordinates with respect to the cell, not the table. Also, we need
            // to change the child to the renderer or editor for that cell.
            Point loc = new Point(X, Y);
            int row = table.rowAtPoint(loc);
            int column = table.columnAtPoint(loc);
            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based
            params.put( "row", new ParameterHolder(row+1) );
            params.put( "column", new ParameterHolder(column+1) );

            // make sure we have a valid cell, just in case they click outside the table, eg in the empty scroll pane.
            if (row >= 0 && column >= 0) {
                Rectangle cellBounds = table.getCellRect(row, column, false);
                X -= cellBounds.x;
                Y -= cellBounds.y;

                TableCellRenderer renderer = table.getCellRenderer(row, column);
                if (renderer != null) {
                    Component c = renderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column);
                    params.put("child", new ParameterHolder(c));
                }
            }
        }
        else if (pControl != null && pControl instanceof JTree)
        {
          JTree tree = (JTree) pControl;
            int currentRow = getRowForLocation(Y, tree);
            // TF:27/9/07:Made the row and column 1-based indexes instead of 0-based
            params.put( "row", new ParameterHolder(currentRow+1) );
            TreePath path = tree.getPathForRow(currentRow);
            if (path != null) {
              params.put("node", new ParameterHolder(path.getLastPathComponent()));
            }
            else {
              params.put("node", new ParameterHolder(null));
View Full Code Here

TOP

Related Classes of DisplayProject.controls.OutlineFieldJTree

Copyright © 2018 www.massapicom. 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.