Table with a textArea editor doesn't stop editing

I need to have a table with TextArea as editor (to show the information) but it must be changed through a Dialog and return to the render (also a textArea)
The problem is when after modify the information with the editor I call fireEditingStopped(); and it doesn't return to the render it remains in editor so I can modify the text and when I change of cell It returns to the text put by the editor. I need that the user can't change the text showed in the textArea only be modified through the Dialog.
In the next code I isolated the problem, so the Editor change the original text with "NEW VALUE" simulating the action of Dialog (which is not included).
Thanks a lot and thanks for the patience for my bad English.
public class TableWithTextArea extends javax.swing.JFrame {
    public TableWithTextArea() {
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.FlowLayout());
        this.getContentPane().add(new MyTabla());
        pack();
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TableWithTextArea().setVisible(true);
    class MyTabla extends javax.swing.JTable {
        public MyTabla() {
            this.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
            this.setModel(new javax.swing.table.DefaultTableModel(
                    new Object [][] {
                        {"A HOLA MUNDO", "B HOLA MUNDO", "C HOLA MUNDO", "D HOLA MUNDO"},
                        {"E HOLA MUNDO", "F HOLA MUNDO", "G HOLA MUNDO", "H HOLA MUNDO"},
                        {"I HOLA MUNDO", "J HOLA MUNDO", "K HOLA MUNDO", "L HOLA MUNDO"},
                        {"M HOLA MUNDO", "N HOLA MUNDO", "O HOLA MUNDO", "P HOLA MUNDO"}
                    new String [] {
                        "Title 1", "Title 2", "Title 3", "Title 4"
        public javax.swing.table.TableCellEditor getCellEditor(int row, int column) {
                return new StringEditor(this);
        //CLASS StringEditor
        class StringEditor extends javax.swing.AbstractCellEditor
                                 implements javax.swing.table.TableCellEditor {
            private final static long serialVersionUID = 10092;
            javax.swing.JTable tabla;
            javax.swing.JTextArea editTextArea;
            String theValue = "";
            public StringEditor(MyTabla tabla) {
                super();
                this.tabla = tabla;
                editTextArea = new javax.swing.JTextArea();
                editTextArea.setLineWrap(true);
                editTextArea.setWrapStyleWord(true);
                editTextArea.setAutoscrolls(true);
            @Override
            public Object getCellEditorValue() {
                return theValue;
            @Override
            public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, Object value, boolean isSelected, int row, int column) {
                editTextArea.setLineWrap(true);
                theValue = "NEW VALUE";
                editTextArea.setText(this.theValue);
                fireEditingStopped(); //IT'S NOT WORKING
                return editTextArea;
}

Thanks a lot.
It does just what I need, I read it before but I thought that it wasn't the solution to my problem.
I'll study your code to understand what I did wrong.

Similar Messages

  • Updateble table with HTMLDB_ITEM.TEXTAREA  not save text area field?

    I use
    updateble table with HTMLDB_ITEM.TEXTAREA that does not save text area field?
    select a,b,
    case when cond1 then APEX_ITEM.TEXTAREA(3, A_COLUMN,4,50)
    recards
    Edited by: sak on Dec 21, 2009 4:24 PM

    Sak,
    Unless I'm misunderstanding your situation, you've wandered outside the abilities of the automatic DML process to update your table. As soon as you use APEX_ITEM objects in your SELECT, you need to write your own table insert/update/delete processes to handle the updated values. The Advanced Apex documentation gives some basic examples for this, but I struggled with it the first time (because I was using a checkbox, which is handled differently than the other types).
    For more assistance, try searching this forum for "APEX_ITEM".
    Good luck,
    Stew

  • Table with Linktoaction cell editor VS ALV with Link to action cell editor

    Hi,
    i am replacing table UI with ALV, i am encountering series of problems one of them is below.
    when i click on linktoaction cell in table i can see wdevent has context_element which is element reference, which is being used in action handler to perform some logic...
    however when i replace with alv where i displayed one column with link to action cells using CL_SALV_WD_UIE_LINK_TO_ACTION class, however when i click on any particular cell i only get information related to that cell like column name, attribute name, value and position.
    however as i said i need context element reference to work with which is not coming with alv.
    please suggest.

    yes, that is right, you have to get the context element from the node based on the Index you get.

  • The table with Name of 'Table Name' does not exist.An error occurred when loading the Model.

    The table with Name of 'Table Name' does not exist.An error occurred when loading the Model.
    We get this error when we try to check the properties of an analysis server using SQL Server Management studio(right click the instance name
    and check properties). We have resolved this issue twice by Stopping the SQL Server analysis service,removing db folders from Analysis Server Data folder and starting the services back on. The db folder that we removed was advised by the BI team.
    The SQL Server Analysis Server is 2012 SP1

    Hi RB_ORIPW,
    The table with name of 'XXX' doesn't exist.
    An error occurred when loading the model(Micorsoft.AnalysisServices)
    If I understanding correctly, you encounter the error randomly, now what you want it that avoid this issue completely, other than stop the services, detele the db filder and restart the services, right?
    The error might be caused by that the data file is corrupted. However, we cannot give you the exact reason that cause this issue. You can troubleshoot this issue by using the Windows Event logs and msmdsrv.log.
    You can access Windows Event logs via "Administrative Tools" --> "Event Viewer".  SSAS error messages will appear in the application log.
    The msmdsrv.log file for the SSAS instance that can be found in \log folder of the instance. (C:\Program Files\Microsoft SQL Server\MSAS10.MSSQLSERVER\OLAP\Log)
    Here is a blog about data collection for troubleshooting Analysis Services issues, please see:
    Data collection for troubleshooting Analysis Services issues
    Besides, here is fix that describe the similar issue, and it was fixed in Cumulative Update 7 for SQL Server 2012 SP1, please refer to the link below to see the details.
    http://support.microsoft.com/kb/2897263/en-us
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • How to create a table with muse?

    How can I create a table with muse?

    Muse doesn't natively support building tables at this time.
    However, you can add HTML table through Object -> Insert HTML option as a way around that.
    http://www.w3schools.com/html/html_tables.asp
    You could even try aligning a few text boxes with/without Stroke applied to create an editable tabular look in Design mode.
    Thanks,
    Vinayak

  • I am having a painful problem with itunes 10, everytime I go into the itunes store to search for a song, even if I type one letter in it will instantly launch into search mode and doesn't stop, so I'm unable to find

    I am having a painful problem with itunes 10, everytime I go everytime I go into the itunes store to search for a song, even if I type one letter Itunes will instantly launch into search mode and doesn't stop, so because I can never get past putting in the first letter or two, I'm unable to search and download any songs. I am on the latest Imac Intel core i7 Mac OS X, can anybody help?
    Thankyou.
    Beckyg.

    Having this problem too: IT'S REALLY REALLY ANNOYING!!! Anyone have an idea how to sort this?

  • How can I edit excel with my iPad?  Doesn't let me see pivot tables or drill downs...

    How can I edit excel with my iPad?  Doesn't let me see pivot tables or drill downs...

    Read https://discussions.apple.com/thread/4956673?start=0&tstart=0
    Allan

  • I have Photoshop Elements 11 installed on my PC, and now it flickers on startup of the Editor, then closes on its own with a message saying it has stopped working.

    Photoshop Elements 11 has been working for over a year, and now suddenly it flickers on startup, then closes with a message saying it has stopped working.
    Is there a repair option to fix it?

    I have already copied my photographs to the a library manager but when I tried to reuse iphoto and import the photos back into iphoto, it would not let me.
    You can't "copy" your photos to the "library manager", there is just no way to any such thing.
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • When I try to watch a video, the video gets all blurry and mixes with the other pages I'm using, and it doesn't stop throughout the video..what should I do?

    When I try to watch a video, the video gets all blurry and mixes with the other pages I'm using, and it doesn't stop throughout the video..what should I do?

    Hello Gemese,
    After reviewing your post, I have located an article that can help in this situation. It contains a number of troubleshooting steps and helpful advice concerning audio issues:
    iPhone: No sound or distorted sound from speaker
    http://support.apple.com/kb/ts5180
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • Size of combobox in JTable with custom cell editor

    Hi All -
    I have a JTable that displays a combobox in certain cells. I have a custom table model, renderer, and editor. All of that works fine. I render the combobox with the renderer, and then return the combobox as an editor in the editor so that it can drop down and actually be of use. My problem is - I set the size of the combobox with a setBounds call in the renderer, I add it to a panel, and return the panel - because I dont want the combobox to take up the entire space of the cell. This approach fails in the editor. The setBounds and setSize calls have no effect. As soon as you click the combobox, the editor takes over and all of a sudden the combobox resizes to the entire area of the cell. I assume this is because in the editor you arent actually placing anything - your simply returning the "editing form" of the component.
    So - anybody know of a way to work around this? Worst case, I could just allow the combobox to use the entire area of the cell - but it makes it uglier so I figured I would run it by the forums.
    Eric

    Rather than just redirect you to my previous answer from ages ago, I'll just give it again. :-)
    You can actually do this, but you have to get tricky. By default, the dropdown's width will be the same width as the cell... but it doesn't have to be that way. Essentially what you have to do is override the UI (MetalComboBoxUI) for the combo component. In your new customized UI component subclass (that you set the combo to use), modify the the createPopup() method of this UI class, and add your own logic to set the size of the popup before you return it.
    Ideally the size would be based on the computed max width of a rendered item shown in the combo, but really you could set it to whatever just to see how it works.

  • The PSE 10 process doesn't stop after closing the application. Why??

    On Windows 7, the PSE 10 process doesn't stop when closing the  application, therefore the PSE 10 app. will not restart once it is closed. The user must stop the process from task manager or reboot before PSE 10 can be restarted on a Windows 7 machine. The forum suggestion to double-click the exe (instead of the shortcut) as a solution, obviously isn't a solution and can't work. There are no updates to PSE 10 and the only access to any support is through this forum. There have been complaints about this on blogs all over the Internet. Why can't Adobe come up with a fix/update or if they have where is it posted?

    First of all, there is no difference between the files on the disk and those downloaded as the trial. The only difference is that one comes with a serial number and the other does not. You can put your serial number into the trial version and it will then be activated. The only way the disk would behave differently is if there is some physical flaw (scratches, warping, etc). Usually such damage will cause the installation to fail, it's pretty difficult for such damage to modify the files in such a way that they still install but behave differently.
    If you are dropping a file on the shortcut and the Photoshop Elements Editor is opening but the file is not, there could be a few different things going on there. Check your shortcut properties first: does it go to PhotoshopElementsEditor.exe or Photoshop Elements 10.0.exe? If the former, then there are probably some missing support files. If the latter, this is the Welcome Screen, which has likely been configured to launch the Editor automatically. However, you would be sending the file to the Welcome Screen, which doesn't do anything with the file. It is not capable of passing the file off to the Editor, only capable of launching it.
    Also, double-clicking a shortcut is generally the exact same thing as double-clicking the file the shortcut points to, but you can add modifiers to shortcuts to make them behave differently.

  • Query to insert a row in a table with same values except 1 field.

    Suppose I have a table with 100 columns(fields).
    I want to insert a row with 99 fileds being the same as previous ones except one fileld being different.
    The table doesn't have any constraints.
    Kindly suggest a query to solve the above purpose..

    And for much more lazy people, a desc of table is shorter to write. :-)
    Then copy & paste into any editor, then mode column to add a comma after every column name in one shot.Or have the system do it for you. Be lazy.
    SELECT Column_Name || ',' FROM User_Tab_Columns where Table_Name = '';
    Indeed, it can be converted to a script called desc(.sql)
    SELECT Column_Name || ',' FROM User_Tab_Columns where Table_Name = '&1' ORDER BY Column_Id;
    Then desc or @desc.

  • Selection in table with Master Column

    Hi,
    can anybody explain me how selection works in table with MasterColumn (TreeByNestingTableColumn)?
    I've created a table with several columns and the "master" one behaves differently from others.
    First of all, leaf elements of master column are not clickable (i.e. I don't receive notification "onLeadSelect" from the table, when user clicks in the cell of leaf element of the column). With expandable elements I receive loadchildren event and can react on selection.
    I'm using TextView as cell editor, will try LinkToAction, may be it will resolve situation, but it's rather workaround as solution
    Second, getLeadSelection doesn't work anymore for the table - it works with indexes of top level elements only.
    However onLeadSelect action brings me selected row number, which I somehow should map to the tree.
    I.e. when I get "25" as selected element, I recursively traverse context node to find 25th element. Which is rather slow operation as for any selection I have to reiterate whole structure and I hope that visual appearance is similar to context element order.
    May be there is simplier ways to get selected element by its index in "flat" list?
    And one another strange thing: first click on the table sends me onLeadSelect "0", but highlight points to the element user clicked - not necessary first one.
    Context node is "single" selection, initLeadSelect=true,
    selection = 0..1 (with 1..1 setTreeSelection doesn't work - method I want to use to be able to select a node in hierarchy on my own)
    all quite similar to other tables I have, which works well. Just the problems with the table, where Master Column is used.
    Thank you!
    Best regards,
    Nick

    >Valery's proposal was to perform reverse traverse from current element to root and summarize parent element indexes.
    It seems to work:
    in method, which sets selection I applied
    // we need to know index of the element not in whole context, but in scope of table-relevant node
    int index = getIndexInContext(selElement, wdContext.currentXXXElement());
    IContextElement curContext = wdContext.currentContextElement();
    int firstVisibleRow = curContext.getTableFirstVisibleRow();
    int visibleRows = curContext.getTableVisibleRows();
    if (index < firstVisibleRow || index > firstVisibleRow + visibleRows) {
    curContext.setTableFirstVisibleRow(index);
    and method getIndexInContext looks as:
        private int getIndexInContext (IWDNodeElement element, IWDNodeElement root) {
              int index = element.index();
              if (element == root) {
                   return index;
              IWDNodeElement parent = element.node().getParentElement();
              if (parent == null) {
    // do whatever you like here for error diagnostic
                   myMsgMgr.reportException("Internal Error: getIndexInContext - element is not under passed root", false);
                   return 0;
              // +1 - every level adds 1 (otherwise indexes of first children of hierarchy will be 0)
              return  index + getIndexInContext(parent, root) + 1;
    Best regards,
    Nick

  • Problem sorting JTable with custom cell editor

    Greetings,
    I have created a JTable with a JComboBox as the cell editor for the first column. However, I couldn't simply set the default cell editor for the column to be a JComboBox, since the values within the list were different for each row. So instead, I implemented a custom cell editor that is basically just a hashtable of cell editors that allows you to have a different editor for each row in the table (based on the ideas in the EachRowEditor I've seen in some FAQs - see the code below). I also used a custom table model that is essentially like the JDBCAdapter in the Java examples that populates the table with a query to a database.
    The problem comes when I try to sort the table using the TableSorter and TableMap classes recommended in the Java Tutorials on JTables. All of the static (uneditable) columns in the JTable sort fine, but the custom cell editor column doesn't sort at all. I think that the problem is that the hashtable storing the cell editors never gets re-ordered, but I can't see a simple way to do that (how to know the old row index verses the new row index after a sort). I think that I could implement this manually, if I knew the old/new indexes...
    Here's the code I use to create the JTable:
    // Create the Table Model
    modelCRM = new ContactTableModel();
    // Create the Table Sorter
    sorterCRM = new TableSorter(modelCRM);
    // Create the table
    tblCRM = new JTable(sorterCRM);
    // Add the event listener for the sorter
    sorterCRM.addMouseListenerToHeaderInTable(tblCRM);
    Then, I populate the column for the custom cell editor like this:
    // Add the combo box for editing company
    TableColumn matchColumn = getTable().getColumn("Match");
    RowCellEditor rowEditor = new RowCellEditor();
    // loop through and build the combobox for each row
    for (int i = 0; i < getTable().getRowCount(); i++) {
    JComboBox cb = new JComboBox();
    cb.addItem("New");
    //... code to populate the combo box (removed for clarity)
    rowEditor.add(i,new DefaultCellEditor(cb, i))); //TF
    } // end for
    matchColumn.setCellEditor(rowEditor);
    Any ideas how to do this, or is there a better way to either sort the JTable or use a combobox with different values for each row? Please let me know if more code would help make this clearer...
    Thanks,
    Ted
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    public class RowCellEditor implements TableCellEditor
    protected Hashtable editors;
    protected TableCellEditor editor, defaultEditor;
    public RowCellEditor()
    editors = new Hashtable();
    defaultEditor = new DefaultCellEditor(new JTextField());
    public void add(int row, TableCellEditor editor)
    editors.put(new Integer(row), editor);
    public Component getTableCellEditorComponent(JTable table,
    Object value,
    boolean isSelected,
    int row,
    int column)
    editor = (TableCellEditor) editors.get(new Integer(row));
    if (editor == null)
    editor = defaultEditor;
    return editor.getTableCellEditorComponent(table,
    value,
    isSelected,
    row,
    column);
    public Object getCellEditorValue() {
    return editor.getCellEditorValue();
    public boolean stopCellEditing() {
    return editor.stopCellEditing();
    public void cancelCellEditing() {
    editor.cancelCellEditing();
    public boolean isCellEditable(EventObject anEvent) {
    return true; //TF
    //return editor.isCellEditable(anEvent);
    public void addCellEditorListener(CellEditorListener l) {
    editor.addCellEditorListener(l);
    public void removeCellEditorListener(CellEditorListener l) {
    editor.removeCellEditorListener(l);
    public boolean shouldSelectCell(EventObject anEvent) {
    return editor.shouldSelectCell(anEvent);
    -------------------

    Well, I found a solution in another post
    (see http://forum.java.sun.com/thread.jsp?forum=57&thread=175984&message=953833#955064 for more details).
    Basically, I use the table sorter to translate the row index for the hashtable of my custom cell editors. I did this by adding this method to the sorter:
    // This method is used to get the correct row for the custom cell
    // editor (after the table has been sorted)
    public int translateRow(int sortedRowIndex)
    checkModel();
    return indexes[sortedRowIndex];
    } // end translateRow()
    Then, when I create the custom cell editor, I pass in a reference to the sorter so that when the getTableCellEditorComponent() method is called I can translate the row to the newly sorted row before returning the editor from the hashtable.

  • Can't update a sql-table with a space

    Hello,
    In a transaktion I'm getting some Values from a SAP-ERP System via JCO.
    I update a sql-table with this values with a sql-query command.
    But sometimes the values I get from SAP-ERP are empty (space) and I'm not able to update the sql-table because of a null-value exception. (The column doesn't allow null-values). It seems that MII thinks null and space are the same.
    I tried to something like this when passing the value to the sql-query parameter but it didn't work:
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", " ")
    this works but I don't want to have a "_"
    stringif( Repeater_Result.Output{/item/SCHGT} == "X", "X", "_")
    Any suggestions?
    thank you.
    Matthias

    The problem is Oracle doesn't know the space function. But it knows a similar function: NVL --> replaces a null value with something else. So this statement works fine for me:
    update marc set
    LGort = '[Param.3]',
    dispo = '[Param.4]',
    schgt = NVL('[Param.5]', ' '),
    dismm = '[Param.6]',
    sobsl = NVL('[Param.7]',' '),
    fevor = '[Param.8]'
    where matnr = '[Param.1]' and werks = '[Param.2]'
    If Param.5 or Param.7 is null Oracle replaces it with a space in every other case it is the parameter itself.
    Christian, thank you for your hint with the space function. So I remembered the NVL-function.
    Regards
    Matthias

Maybe you are looking for

  • Electronic Bank Statement - post bank charges

    Hi, I have requirement which during upload the bank statement,  the item of bank charges should post to 2 difference GL expense based on vendor code, for example :  bank charges for payment transfer vendor A  post to GL 479000,   but for vendor B pos

  • Acrobat won't open

    I just installed the Master Collection and everything works fine except for Acrobat. When I open the program and try to use it, I get the following message: "A serious error has been detected and Adobe Acrobat 8.1.0 Professional cannot continue. Plea

  • Change language (uix jsp)

    How can I change language in uix jsp application? I want labels like NEXT, PREVIOUS,... in language otjer than US!

  • Command line interface to Crystal?   Batch job to refresh report data?

    Hi All. I have some users who do certain work and then want to print an updated report.  However they only have the report viewer.  As they work at night, they can't ask me to refresh the report. Is there a facility to schedule jobs like this in Crys

  • Flashhelp, Safari and Intel-based Macs

    I'm having problems with my Flashhelp project properly displaying on Intel-based Macintoshes in Safari. The project displays all of the flash-based UI elements, but doesn't display the topic matter itself. The exact same projects work fine with Firef