Disabling columns in JTable
Hello everybody,
do you know how i should disable (meaning display like a disable component - e.g. a button) every element of a certain column, in a JTable?
Tx a lot!
Marzio
Hi,
Implement a TableCellRenderer and set it for the column...
JTable table = new JTable();
int index = 1; // Index of the column in question
table.getColumnModel().getColumn(index).setCellRenderer(new MyRenderer());
class MyRenderer extendes DefaultTableCellRenderer {
protected void setValue(Object value) {
// make your visual changes here!!!
// if not enough, overload getTableCellRendererComponent instead
// and implement TableCellRenderer instead of extending...
}Yours, Johan
Similar Messages
-
Disabling a single Column in JTable
I want to disable just one column on my JTable so that the user is not able to sort on that column. Has anyone done this?
Thanks,
SIt's difficult to give a definitive answer when you don't explain how you are sorting but most JTable sorting is done by detecting a mouse click and determining which column the click location corresponds to. Just add some logic to recognize you disabled column and bypass sorting code.
Cheers
DB -
Not null and enable or disable column in tabular form
Hi,
Using apex version 4.1 and working on tabular form.
ACT_COA_SEGMENT_MAS is Master table
and
ACT_SEGMENT_VALUES_MAS is detail table
I have entered 8 rows in master table and PARENT_SEGMENT_ID is column in master table which is null able. If i specified PARENT_SEGMENT_ID with value in master table then in detail table there is column PARENT_ID that should not be null and enable.
How i can enable or disable column when in master table PARENT_SEGMENT_ID column is null then in detail table PARENT_ID column should disable and vice versa.
I have created tabular form on Detail table. before insert into the tabular form Check in master table in first entry if PARENT_SEGMENT_ID is not null in first row of master table then in tabular form PARENT_ID should enable and not null able in corresponding to this first row id's lines in tabular form.
Same should check for second row in master table if PARENT_SEGMENT_ID is not null then entered rows with PARENT_ID into tabular form corresponding to 2nd id in master table should not nullable and column should enable in tabular form.
Thanks & Regards
Vedant
Edited by: Vedant on Jan 9, 2013 9:12 PMVedant,
You need to create you own manual tabular form and not use the wizard.
Using APEX_ITEM api you should be build you own form and you will be able to control how you wan to display the rows. (See Link [Apex Item Help|http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_item.htm#CACEEEJE] )
select case when PRIMARY_TABLE_COLUMN is null then APEX_ITEM.DISPLAY_AND_SAVE(3 , DETAIL_COLUMN ) else APEX_ITEM.TEXT(2,detail_column) end "ALIAS" from detail table
Hope that help.
Vivek -
Enable/Disable Column in a Advanced Bean Table
Hi,
I have 2 columns that needs to be enabled/disabled on a standard oa page PO Lines summary page.
I went through couple of blogs/forums and found 2 approaches :-
Approach 1
1) Extended the standard VO POLinesMerge.
2) Added a attribute column DeriveDisplayFlag of type VARCHAR2 . This call a database function and will return Y or N
3) Added a attribute of type ShowAdditionalColumn boolean. the get method of this attribute returns TRUE if DeriveDisplayFlag is 'Y' otherwise returns FALSE.
4) created a substitution for the custom VO
5) uploaded the substitution to mds.
6) copied the xml/class files to $JAVA_TOP/..
7) Bounced entire middle tier
8) using personalization, entered a SPEL command on the rendered property. I know rendered will hide/show the column but for time being I just want this to work.
But this fails :-
oracle.apps.fnd.framework.OAException: Message not found. Application: FND, Message Name: FND_VIEWOBJECT_NOT_FOUND. Tokens: VONAME = XXPBPoLinesMergeVO; APPLICATION_MODULE = oracle.apps.po.document.server.DocumentAM;
I am not aware how to get around this. Can someone help please?
Approach 2
1) steps 1 to 6 from Approach 1.
2) trying to extend controller class OrderLinesTableRNCO. But have couple of questions. This iis a advanced bean table so how should i reference individual record and the column that i need to disable/enable ?
Conceptual questions
Also, when i am entering a new record at what point in time the 2 new attribute will derive its value? the 2 attributes are dependent on the Item number column but i have not created a dependency between the attributes and Item# column.
Will the controller logic fire for every column while i am entering a new record?
Thanks.Hi Anil,
Thanks for the response. I have given up that i will get reply on this post.
I have done the substitution and upload the jpx to umsing importer.
But you are correct may be i might have done something wrong. Can you please help me. I can send you the files if you can review and let me know it will be great.
Also, will this approach work since PO Lines is a advanced bean table ?
One of the experts suggested to use Bound values. I am not sure how to implement it though?
I have went and told back to my business team that I am not able to do this so now they have asked me to enable/disable columns based on a dff value on po header. I thought this will be easier by extending the controller class on PO Lines table but that too is not working.
Can you help me please ?
Here is my code to extend the controller class :-
package xxpb.oracle.apps.po.webui;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean;
import oracle.apps.fnd.framework.webui.beans.table.OAColumnBean;
import oracle.apps.fnd.framework.webui.beans.table.OASortableHeaderBean;
import oracle.apps.fnd.framework.webui.beans.table.OATableBean;
import oracle.apps.po.document.order.webui.OrderLinesTableRNCO;
public class XXPBOrderLinesTableRNCO extends OrderLinesTableRNCO
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OAAdvancedTableBean tableBean =
(OAAdvancedTableBean)webBean.findIndexedChildRecursive("LinesTableRN");
OAMessageLovInputBean poLineLov =
(OAMessageLovInputBean)tableBean.findIndexedChildRecursive("XXPBSecondaryUOMLOV");
poLineLov.setDisabled(false);
} -
Disable column in tabular form
Hi,
I am working on apex4.1 ,working on tabular form . i want to disable columns in tabular form.
I Have debit and credit column in tabular form.These columns are multiply by exchange rate.
if i have multiplication of Debit_prod =debit*Exchange_rate then
credit column should be disable, and if Multiplication of cr_prod =Credit*Exchange_rate
then dr column should be disable.
Thanks in advance.
Thanks & Regards
Vedant
Edited by: Vedant on Sep 20, 2012 4:14 AMHi,
Thanks for reply.
I am entering the value in tabular form. As i fill debit or credit column of the tabular form,Then if value in the debit column i have entered ,then on press tab control switch to exchange rate column , credit column should not be enterable and vice versa.
Thanks & Regards
Vedant -
Hiding a column in jtable made from DefaultTableModel.
I have made my jtable from DefaultTableModel.
I want to keep one column in the jtable as hidden storing some data containing neccessary information like the "path of the file"
which need not be shown to the user.
Please tell me how I can hide one column in the Jtable.
please provide siome link or code for the same.
Tia,
Sarwadayanandabv wrote:
[http://search.sun.com/search/onesearch/index.jsp?qt=hide+column%2B+JTable&rfsubcat=&col=developer-forums]
My thought exactly.
db -
How to set different renderers to different cells in same column of JTable?
Hello Friends,
I need your help again...
Does any body knows, how to set different renderer's for different cells of same column in JTable..??
For ex.
Col1 Col2 Col3 Col4
A A A A
A A A B
A A A C
A A A D
Where A B C D would be different Renderers. I want set exactly same ,,, ie. one column with different renderer at different cell positions..
Right now i m setting renderer using statement bellow :
table.getColumnModel().getColumn(int).setCellRenderer(rederer_Instance);But with this, effect in the last renderer is applicable whole column....
Can any body help me out ?????????
please refer this thread for similar kind of discussion...
http://forums.sun.com/thread.jspa?forumID=57&threadID=571445Thanks
SuyogPlease refer to the first reply of [this thread|http://forums.sun.com/thread.jspa?forumID=57&threadID=571445] for the answer. If you have a specific problem implementing it, post you code with a specific question.
-
Add and remove columns from JTable
Help me please!
A try to remove column from JTable. It's removed, but when I try to add column in table, then I get all old (removed early) columns + new column....
I completely confused with it.....
Here is my code for remove column:
class DelC implements ActionListener
public void actionPerformed (ActionEvent e )
int [] HowManyColDelete = table.getSelectedColumns();
if (HowManyColDelete.length !=0)
TableColumnModel tableCModel = table.getColumnModel();
for (int i = HowManyColDelete.length-1; i>-1; i--)
table.getColumnModel().removeColumn (tableCModel.getColumn (HowManyColDelete [ i ]));
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
}It's little ex for me, I just try understand clearly how it's work (table models i mean). Here is code. All action with tables take place through menu items.
My brain is boiled, I've try a lot of variants of code, but did't get right result :((
It's code represent problem, which I've describe above. If you'll try remove column and then add it again, it will be ma-a-a-any colunms...
I understand, that my code just hide columns, not delete from table model....
But now I have not any decision of my problem...
Thanks a lot for any help. :)
import javax.swing.*;
import java.awt.*;
import javax.swing.table.*;
import java.awt.event.*;
import javax.swing.table.DefaultTableModel;
class JTableF extends JFrame
Object [] [] data = new Object [0] [2];
JTable table;
DefaultTableModel model;
String [] columnNames = {"1", "2"};
TableColumnModel cm;
JTableF()
super("Table features");
setDefaultLookAndFeelDecorated( true );
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
JMenuBar MBar = new JMenuBar();
JMenu [] menus = {new JMenu("A"), new JMenu("B")};
JMenuItem [] menu1 = {new JMenuItem("Add row"), new JMenuItem("Delete row", 'D'), new JMenuItem("Add column"), new JMenuItem("Delete column")};
menu1 [ 0 ].addActionListener(new AddL());
menu1 [ 1 ].addActionListener(new DelL());
menu1 [ 2 ].addActionListener(new AddC());
menu1 [ 3 ].addActionListener(new DelC());
for (int i=0; i<menu1.length; i++)
menus [ 0 ].add( menu1 [ i ]);
for (int i=0; i<menus.length; i++)
MBar.add(menus );
JPanel panel = new JPanel ();
model = new DefaultTableModel( data, columnNames );
table = new JTable (model);
cm = table.getColumnModel();
panel.add (new JScrollPane(table));
JButton b = new JButton ("Add row button");
b.addActionListener(new AddL());
panel.add (b);
setJMenuBar (MBar);
getContentPane().add(panel);
pack();
setLocationRelativeTo (null);
setVisible (true);
class DelC implements ActionListener
public void actionPerformed (ActionEvent e )
int [] HowManyColDelete = table.getSelectedColumns();
if (HowManyColDelete.length !=0)
TableColumnModel tableCModel = table.getColumnModel();
for (int i = HowManyColDelete.length-1; i>-1; i--)
int vizibleCol = table.convertColumnIndexToView(HowManyColDelete [ i ]);
tableCModel.removeColumn (tableCModel.getColumn (vizibleCol));
//cm = tableCModel;
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
class AddC implements ActionListener
public void actionPerformed (ActionEvent e)
//table.setColumnModel(cm);
Object NewColumnName = new String();
NewColumnName = JOptionPane.showInputDialog ("Input new column name", "Here");
int i = model.getRowCount();
int j = model.getColumnCount();
Object [] newData = new Object [ i ];
model.addColumn ( NewColumnName, newData);
class AddL implements ActionListener
public void actionPerformed (ActionEvent e)
int i = model.getColumnCount();
Object [] Row = new Object [ i ];
model.addRow ( Row );
class DelL implements ActionListener
public void actionPerformed (ActionEvent e)
int [] HowManyRowsDelete = table.getSelectedRows();
if (HowManyRowsDelete.length !=0)
for (int k = HowManyRowsDelete.length-1; k>-1; k--)
model.removeRow (HowManyRowsDelete[k]);
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Row is not selected!");
public static void main (String [] args)
javax.swing.SwingUtilities.invokeLater(new Runnable()
public void run()
JTableF inst = new JTableF(); -
Keyboard Access For a Column in JTable with default editor as JComboBox
I want to get Key board access for a column in JTable.
The user should be able to select from a drop down list for the column with default
editor set as JComboBox.
Presently,it works fine with mouse,also I am able to focus it with Keyboard using
ALT+Up keys,but how to make drop down list appear.
Plz help,it's urgent.
Thanks in AdvanceHi,
In addition to setting DO_SUM = 'X' you need to specify function in H_FTYPE field. It should be set to 'AVG' in your case.
ls_fielcat-do_sum = 'X'.
ls_fieldcat-h_ftype = 'AVG. -
Webdynpro ABAP ALV in SAP ECC6 - EHP4: To disable Column Selection
Hi All,
We are using SAP ECC6 EHP4 and for Webdynpro ABAP application, after each column a vertical white line is appearing, and I need to hide this..
SAP suggested us to disable COLUMN SELECTION I have tried the below code but still I am not able to get this done..
Can you please suggest the appropriate method to achieve the same.
Code:
* show tab COLUMN SELECTION in Settings page
CALL METHOD wd_this->alv_conf_table->if_salv_wd_std_functions~set_column_selection_allowed
EXPORTING value = ABAP_false..
here alv_conf_table refers to CL_SALV_WD_CONFIG_TABLE.
Thanks in advance.
Thanks
Srinivas
Edited by: Srinivas Manchi on Apr 22, 2010 11:35 AM
Edited by: Srinivas Manchi on Apr 22, 2010 1:06 PMYou have to disable the DDic binding on the column before your override text will show up:
data: l_ref_cmp_usage type ref to if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
l_ref_cmp_usage->create_component( ).
endif.
data l_salv_wd_table type ref to iwci_salv_wd_table.
l_salv_wd_table = wd_this->wd_cpifc_alv( ).
data l_table type ref to cl_salv_wd_config_table.
l_table = l_salv_wd_table->get_model( ).
data l_column type ref to cl_salv_wd_column.
l_column = l_table->if_salv_wd_column_settings~get_column( 'POSTING_DATE' ).
data l_header type ref to cl_salv_wd_column_header.
l_header = l_column->get_header( ).
l_header->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_text
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
l_header->set_text( `Posting Date` ). -
How to disable columns while displaying
Hi,
How to disable columns from the page which we don't want to show to the users.For example Users will search by "Invoice No" but they don't want to see again Invoice No on the results page.
Appreciate your quick response.
Thks.Check out Dev Guide
Chapter 4: Implementing Specific UI Features -> Search -> Declarative Implementation: Auto Customization Criteria
With this Query Bean option you can separate the Search region from the results table. You map the items in the search region to the items in the result region. You can mark the item in the result table as Rendered=No. OAF will run the query against this item even though it's not displayed. -
OBIEE - How to selectively hide or disable columns on a dashboard prompt?
Hello! I need some help with OBIEE dashboard Prompts. Any help will be highly appreciated!
Question 1. How to selectively hide or disable columns on a dashboard prompt or the entire prompt? There seems to be no "hide" or "dsable" options on
prompts.
Question 2. How to synchronize 2 different prompts on the same dashboard?
The application is this: There are total of 2 tabs on a dashboard ("tab_1" and "tab_2"). Each tab uses different prompts ("pr_1" and "pr_2"), having just one first drop down column in common ("Product_id").
The desired functionality is this: user selects "Product_id" on the first tab's prompt, which filters its reports (on "Go") and also propagates to the second tab. When user clicks on the second tab, the reports there are already filtered (or begin filtering) by "product_id", selected on the first tab.
Question 3. How to prevent the reports from retrieving when switching to a different tab on a dshboard? Specifying dummy default values in the prompt does
not seem to preven reports from retrieving, which still takes time.
Thank you very much!
RogerRegarding Question 2:
What you need to have is a Dashboard scope dashboard prompt for Product_ID (i.e., Don't use the column prompt from the prompt tab within the Request.)
1) Create the dashboard prompt, put it on tab1 and save the prompt to a presentation variable, say prmtProdID. Set the scope to "dashboard." (This is the default, by the way.) If you create a dashboard prompt and set the scope to "dashboard," then the prompt values selected will hold true across dashboard pages.
2) On tab2, go to your report and in Criteria mode, apply a filter to the Product_ID column making it equal to the PV. (Click the filter icon, Add>Variable>Presentation Variable and type prmtProdID. Save.)
When the user selects a Product_ID on tab1 of your dashboard and hits "Go," not only will it filter your report on tab1, when you go to tab2 the report here will be filtered with the same value selected in the prompt on tab2.
Regarding Question 3:
If you implement 2, you cannot implement 3. You can't have it both ways. Not for the same scenario. But if you want to know how to do it in general, read this:
http://obieeone.com/2009/08/24/how-to-stop-queries-to-automatically-fire-off-once-entering-dashboarddashboard-page/ -
Serial number column in Jtable
Apologies for this distraction.
I read at this forum about a year ago how to add a s/n column in Jtable such that all the nos are automatically updated/adjusted when a row is added/deleted. the count starts from the top down serially and unaffected by sorting.
pls help!thanks a million BaltimoreJohn and especially camickr whose solutions to problems have been most helpful. applying the referenced post, i worked around the problem by resetting the values of the column having the serial number, based on table rowCount every time there is an operation on it(deleting, addition etc)
-
Problem with Hiding Columns in JTable
Hi.
Who knows how to hide column in JTable.
I try to get column:
MyTab.getColumnModel().getColumn(i)But there is no methods like SetVisible(false)
What to DO???http://www.google.com/search?hl=en&q=%2Bhide+%2Bcolumn+%2Bjtable&btnG=Google+Search
-
Programmatically Sorting columns in JTable
Hi,
How can I programmatically sort a particular column in JTable without having to click on column header.
Thanks.to sort the desired column w/o click on header
int columnIndexToSort = 1;
RowSorter.SortKey sortKey = new RowSorter.SortKey(columnIndexToSort,SortOrder.ASCENDING);
ArrayList alist = new ArrayList(1);
alist.add(sortKey);
((DefaultRowSorter)table.getRowSorter()).setSortable(columnIndexToSort , true);
((DefaultRowSorter)table.getRowSorter()).setSortKeys(alist);
((DefaultRowSorter)table.getRowSorter()).sort();expecting dukestars..
Maybe you are looking for
-
Deleting a single field from existing Layout - Update
Hi, We need to amend our custom integrator's layout by removing a field from the layout. However, in Desktop Integration - "Define Layout" - we do not have any option to delete a field (options are - Move Up/down, Read only, width,Frozen pane) (Makin
-
Pro CC stops suddenly stops showing video, instead previews and renders a black screen
Hi, I've been working on a video project for a few days now, and then suddenly, this morning, when I opened Premiere, all of my video was shown as black, and also rendered as black. All video files are AVI files generated by litecam HD, they are all
-
Hallo, wenn ich auf ein PDF Dokument klicke, öffnet sich Acrobat mit einem nicht näher bezeichneten Fehler (siehe screenshot). Ich muss meinst 4-5 mal wieder neu auf das Dokument klicken, bis es dann endlich angezeigt wird. Manchmal geht es überhaupt
-
RSS feeds become nod-editable after creation.
I have been using the RSS feature to aggregate content to specific courses/tabs in the iTunesU site. 1. We are using an http basic authentication to gain access to the feed. 2. The check for updates daily dialog is checked. 3. However, when we attemp
-
Importing and Managing Digital Movie Files in Aperture
It's been a while since this topic was addressed (Dec 2006 http://discussions.apple.com/thread.jspa?messageID=3639422&tstart=0#3644525) and now days most prosumer SLR can record short videos. Furthermore, although Aperture is indeed a pro App designe