I lost the "..." in my table cells

Hi,
I have a JTable with a custom table cell renderer which I program as such inorder to allow an individual cell to render the value ( in this case, text ), in multiple fonts and colors :
MyCellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent() {
else if ( value instanceof String ) {
String s = "<html> ";
String[] pieces = ((String)value).split("\\.");
for(int i = 0; i < pieces.length - 1; i++ )
s += pieces[i] + ".";
s = s + "<B>" + pieces[pieces.length -1] + "</B>" + "</html>";
((JLabel)cell).setHorizontalAlignment(JLabel.LEFT);
((JLabel)cell).setText(s);
((JLabel)cell).setBorder(new EmptyBorder(0,10,0,0));
return cell;
and that works great. The problem is, before, if the cell value string was longer than the column heading, the value would have a "..." at the end to indicate there was more to show. Is there some way I can get this back, and preserve the HTML tag code?
thanks in advance

From the random code you posted, it looks like you only have two separate pieces of text in you renderer. If so, then heres a hack you might be able to use:
     class MultiLabelRenderer implements TableCellRenderer
          private JPanel panel;
          private JLabel red;
          private JLabel blue;
          public MultiLabelRenderer()
               panel = new JPanel(new BorderLayout());
               red = new JLabel();
               red.setForeground(Color.RED);
               blue = new JLabel();
               blue.setForeground(Color.BLUE);
          public Component getTableCellRendererComponent(
               JTable table, Object value, boolean isSelected,
               boolean hasFocus, final int row, final int column)
               String text = value.toString();
               red.setText( text.substring(0,1) );
               blue.setText( text.substring(1) );
               panel.removeAll();
               int columnWidth = table.getColumnModel().getColumn(column).getWidth();
               int redWidth = red.getPreferredSize().width;
               if (redWidth > columnWidth)
                    panel.add(red);
               else
                    panel.add(red, BorderLayout.WEST);
                    panel.add(blue);
               if (isSelected)
                    panel.setBackground( table.getSelectionBackground() );
               else
                    panel.setBackground( table.getBackground() );
               return panel;
     }

Similar Messages

  • How Do I Change the Padding in Table Cells

    Hi, I am trying to set up a table that will allow text to fill the entire cell. I know that if I double click an individual cell, the left and right boundaries of the cell will be displayed on the ruler. However, I can't select multiple cells (even in a column) to adjust the boundaries. By default, all cells are created with no padding on the left, but half an inch on the right. I want no padding on the right as well. I know I can change the the tab for the table with the text inspector, after the fact.
    So, #1. How can I change the default right cell wrap for all cells in a table?
    Additionally, I know how to get rid of the padding above the text (via text property "instant margins"), but I also need to eliminate the padding at the bottom of the text. When I adjust the instant margin, it just moves the text the upper-left corner of the cell, but does not change the vertical size of the cell. I can change the individual row height by grabbing the border and dragging it up, but, again, this is a pain for large table. I know I can also change the overall cell height by dragging the lower table boundary.
    #2. How do I change the default cell height so the cell is tight against the text, regardless of the font size, for all cells in a table?
    Any help or suggestion will be greatly appreciated.
    Thanks
    Gary

    Thanks for the reply.
    Unfortunately, those options will not do what I need.
    If I turn off "Wrap text", the text overflows the cell and the text in the adjacent cell to the right will hidden. I still want the text to wrap, just not half an inch from the right border.
    And the "Resize to fit" changes the cell width, which I want to keep the cell at a static width.
    One workaround I found, was to modify the table as needed, using text properties, and then save the table as the table default. Unfortunately, that overwrites the factory default, and new table's tabs in other templates (all other properties seem to be retained)
    The second option that seems to work, is to save my entire document as a template. That seems to hold all the properties for graphics, tables, etc.
    A bit kludgy, but those methods seem to do the trick.
    Now, how do I get the default table properties back?
    Gary

  • Can't change the background of table cells on a page with CSS

    New CSS guy here, so excuse me if I sound stupid! I built up
    a site with DW8 using CSS for basic page formatting. The site is a
    new version of an old one I did in GoLive. I copied/pasted a fairly
    large table onto the new site in DW, and the table came in fine,
    the text was now the font and style of the main style sheet. But, I
    can't format the table itself now. The header rows were filled blue
    with white text, as an example.
    I can change the bg color down in the toolbar like old times,
    but nothing actually changes on the screen. I'm assuming it's being
    overridden somehow by my CSS style sheet?
    What would I have to do to get back this formatting
    functionality?
    here is an example page:
    http://www.curtlo.com/prototype/pricing.html

    > The header rows were
    > filled blue with white text, as an example.
    There is no such style on this page.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "synterx" <[email protected]> wrote in
    message
    news:eig96t$oir$[email protected]..
    > New CSS guy here, so excuse me if I sound stupid! I
    built up a site with
    > DW8
    > using CSS for basic page formatting. The site is a new
    version of an old
    > one I
    > did in GoLive. I copied/pasted a fairly large table onto
    the new site in
    > DW,
    > and the table came in fine, the text was now the font
    and style of the
    > main
    > style sheet. But, I can't format the table itself now.
    The header rows
    > were
    > filled blue with white text, as an example.
    >
    > I can change the bg color down in the toolbar like old
    times, but nothing
    > actually changes on the screen. I'm assuming it's being
    overridden somehow
    > by
    > my CSS style sheet?
    >
    > What would I have to do to get back this formatting
    functionality?
    >
    > here is an example page:
    >
    >
    http://www.curtlo.com/prototype/pricing.html
    >

  • Does SSRS dynamically set the alignment of table cells based on the majority of cell types in the column???

    This is the first time I've run into this, but it appears that SSRS is setting the text-align based on the other cells in the column.  I have cells being set with either a dataset item of type System.Double or to "--" when Is Nothing evaluates
    to true.  I never noticed before that if the majority of the cells in the column are Nothing, then the few that aren't Nothing get aligned to the left along with all of the "--" text items.  And now I also see columns where the opposite
    is also happening, where if the majority of the cells in the column are numeric values, then everything is aligned right, even the few "--" items there.  I'm only using Default TextAlign and VerticalAlign, and no Indent, SpaceAfter or SpaceBefore,
    nor any concatenated text or embedded preserved spaces.
    Has anyone else in the SSRS universe seen this, and does anyone know why or have a good workaround for it?
    Thanks in advance : )

    Are you viewing the report in html format or are you looking in some other format like Excel,CSV etc?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Table cell formatting : please allow 'Horizontal autosizing' with 'at least' option like the vertical. Or is it in the pipeline already ?

    I suspect it has been asked by others, but can't find it in the archives. I need it for table cells with diagonals, and they need to fit like a glove.

    Hi,
    if the content is in a table cell (<td>), simply use valign="top" in the Region HTML table cell attributes.
    "Vertical align" is not intended to align text in a block, but an in-line component in another in-line component (for example a picture next to text).
    Maybe you have to play with margins.
    PS : more information here for example : http://evolt.org/article/rdf/17/60369/
    Yann.

  • Line Binding with table Cell issue

    Hello,
    In my application I need to map data from one table to another table. please see snap from below link
    http://www.pixhost.org/show/3449/12902612_column-linking.png
    if you see the snap you will come to know that I have Map Name "Pankti" from Left Table to Name "Isabella" from right Table.
    I have used my custom tableView Control.
    I have Bind Line cordinates as below
    line.startXProperty().bind(lefttb.widthProperty().add(lefttb.layoutXProperty()));
    line.startYProperty().bind(lefttb.lastcell.getTableRow().layoutYProperty().add(lefttb.lastcell.getTableRow().heightProperty().add(lefttb.lastcell.getTableRow().heightProperty().add(-12))));
    line.endXProperty().bind(righttb.layoutXProperty());
    line.endYProperty().bind(righttb.lastcell.getTableRow().layoutYProperty().add(righttb.lastcell.getTableRow().heightProperty().add(righttb.lastcell.getTableRow().heightProperty().add( -12))));
    Here lefftb = LeftTableView
    righttb = RightTableView
    lastcell is a selected cell of tableview
    I have added these control in Group Container.
    MyProblem is :
    When I scroll in any tableview then the relationship between data are lost and Line had start showing wrong relationship.
    in above example if i scrolled RightTableview then see the result from Below Links
    http://www.pixhost.org/show/3800/12903076_column-map1.png
    http://www.pixhost.org/show/3800/12903157_column-map2.png
    http://www.pixhost.org/show/1297/12903283_column-map3.png
    So what should i do so that my Line always show correct relationship??
    Please download my sample code from
    http://www.freefilehosting.net/columnmapsample
    or
    http://www.filefactory.com/file/4w3dpn0l27rj/n/ColumnMapSample.rar
    Thank You,
    Ronak

    Hi Roank ,
    I think your approach of mapping the table using TableCell is not correct because the tablecell is updated everytime you scroll,click and other events. Although I can't give you full guide but the algorithm must be something like this:
    + Use the index of table cell or item Object instead of using the tableCell.
    + The index of cell is get from cell.getIndex();
    Implementation
    + If the mapping is to be done then you must first save the index of two table in a Map<integer,integer> .
    + Now update the line of mapping only if the index matches in the cellfactory (during update of the table cell).
      Otherwise the line x,y must be set to the last known x,y position of that tablerow indexI think this way the things goes correctly. One thing to remember that tablecell is always updated.
    Thanks
    Narayan

  • Straddled FM Table Cells Not Merged in WebHelp

    Using TCS2 on Win XP, generating WebHelp — my straddled table cells in FM are not merged in WebHelp.
    Is this a known problem, or is there a way to make this work?
    Thanks!

    Hi Mike,
    I'm confused to where you applied the vertical alignment. Normally, I would set this for the table cells and not the table.
    CSS has indeed an order in rendering: There is a point system for determining the CSS to apply. See http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-understanding-css-specific ity/ for a short introduction.
    And as an extra to the point system, the place where the styling is present, also determines the styling. Browsers use the following hierarchy (in descending order)
    User style sheet defined in the browser.
    Inline styling.
    Style block in page.
    External style sheet
    You can overwrite styling from a lower order using the !important declaration. You can use this to make sure that inline styling will not be able to overwrite styles from your style sheet. (Unless the inline styles use !important themselves.) Example:
    table.mytable td {
         vertical-align: middle !important;
    This will make all the content of table cells in the table with the class mytable to be vertically centered.
    Greet,
    Willam

  • How to get name of table cell ? Also, how to set name and label property on table itself?

    I am trying to use below API:
    PMString tableName = "myTable";
    ErrorCode error = Utils<Facade::IPageItemNameFacade>()->SetUserAssignedPageItemName(tableUIDRef, tableName);
    But this is not setting up the table name, also I am getting error = 1.
    Also, I am not getting the API to get the name of table cell(which is the read only property)

    Hello kapoor_aman27,
    a table is not a page item. The page item name is stored in the interface IPageItemName of the kDrawablePageItemBoss. So you must get the page item of your table and set the name of the page item.
    Markus

  • Vertical alignment in table cells not working in generated output

    Using RH9 WebHelp. I have created a simple table style. Because I could not find out how to make cell vertical alignment (top, center, bottom)  part of the style definition, I have been applying it manually to individual whole tables using the cell alignment properties.
    This worked fine for a while, but at some point I noticed that even though the tables look right in Design view, with top-aligned cells contents, it gets hosed in generating output and all tables now come with vertically centred cell contents even through the in-line formatting for top alignment is still there in the code.
    Any ideas?

    Hi Mike,
    I'm confused to where you applied the vertical alignment. Normally, I would set this for the table cells and not the table.
    CSS has indeed an order in rendering: There is a point system for determining the CSS to apply. See http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-understanding-css-specific ity/ for a short introduction.
    And as an extra to the point system, the place where the styling is present, also determines the styling. Browsers use the following hierarchy (in descending order)
    User style sheet defined in the browser.
    Inline styling.
    Style block in page.
    External style sheet
    You can overwrite styling from a lower order using the !important declaration. You can use this to make sure that inline styling will not be able to overwrite styles from your style sheet. (Unless the inline styles use !important themselves.) Example:
    table.mytable td {
         vertical-align: middle !important;
    This will make all the content of table cells in the table with the class mytable to be vertically centered.
    Greet,
    Willam

  • Colspan and rowspan attributes in table cells

    Is there a way to add 'colspan' or 'rowspan' attributes to a cell in a table using the RoboHelp UI? Of course, it's very simple to just edit the HTML directly, but I'm preparing documents that will be used in the future by executives, and like most executives they are barely computer-literate.

    Hi there
    In the RoboHelp HTML UI, the author selects the affected cells and chooses to merge them by either clicking the Table menu and choosing Table > Merge Cells or by clicking the Merge Selected Table Cells icon in the Tables and Borders toolbar.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 moments from now - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcererStone Blog
    RoboHelp eBooks

  • Formatting table cells

    I would like to how to know how to set eg. the background of a cell in table or to set the cell non-editting. I tried to solve this problem like this:
    for (int i = 0;
    i < zinsstrukturVec.size();
    i++)
    ((JTextField)((DefaultCellEditor) jTableZinsstruktur.getCellEditor(i,4)).getComponent()).
    setHorizontalAlignment(SwingConstants.RIGHT);
    but it do not work.
    thank you!
    Tri D.

    Look at the tutorials for Table Cell Renderers

  • Firing event when pressing table cell

    Hi,
    Is it possible firing an event when double click the web dynpro table cell?
    Fired event must be called with parameter with value inside cell.
    Is it possible?
    Thanks.

    Hi
    What TablecelllEdito  you want to use here. If it is LinkToAction then map the parameter with its action.
    Code for this is
    wdContext.nodeTestNode().setSelected(i, true);
    //Here i is the parameter of type Node Element.
    Best Regards
    Satish Kumar

  • Does edting a table cell update the defaulttablemodel??

    hi I am a bit confused by the documentation I have read.. I just want to confirm wheither editing a cell in a JTable should update a value in the underlying model(a defaultTableModel in my case) only by declaring the the below..
    <code>
    Object data[][] = // table contents
    DefaultTableModel dtmodel= new DefaultTableModel(data,column_headers);
    JTable table = new JTable(dtmodel);
    </code>
    or do I have to add an editor or a listener..
    thank you

    The sequence is as follows:
    After cell is completed (by focus lost), the value is passed to the setValueAt(Value,Row,Column) method implemented by your Abstract TableModel type class (e.g. DefaultTableModel). DefaultTableModel stores this value for that cell so that next time repaint on table happens same value is returned for that cell by getValueAt(row,column) method in TableModel. This will also call the tableChanged method of any TableModelListener attached to the TableModel.
    Hope you are clear about the flow of actions.

  • How to highlight the table cell color in respective colors as needed per the requirements??

    var aData = [
        {notificationNo: "10000000", description: "Maintenance for boiler", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "ordered"},
        {notificationNo: "10000010", description: "Genreal Maintenance for boiler", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "notordered"},
        {notificationNo: "10000011", description: "boiler Maintenance", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "ordered"},
        {notificationNo: "10000012", description: "Pump breakdown", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "ordered"},
        {notificationNo: "10000013", description: "External service boiler", location: "G001-STG-UTLR-BLR", equipmentNo: "100000053", orderStatus: "notordered"},
    jQuery.sap.require("sap.ui.model.json.JSONModel");
    var oEnterpriseAsset_NotificationConsole;
    sap.ui.model.json.JSONModel.extend("EAM_Notification_Console", {
        CreateNotificationConsole:function(){
            oEnterpriseAsset_NotificationConsole = this;
                var oTable = new sap.ui.table.Table({
                //title: "Table Example",
                visibleRowCount: 7,
                firstVisibleRow: 3,
                selectionMode: sap.ui.table.SelectionMode.Single,
            /*    toolbar: new sap.ui.commons.Toolbar({items: [
                    new sap.ui.commons.Button({text: "Button in the Toolbar", press: function() { alert("Button pressed!"); }})
                extension: [
                    new sap.ui.commons.Button({text: "Button in the Extension Area", press: function() { alert("Button pressed!"); }})
            }).addStyleClass("tableform");;
            oTable.addColumn(new sap.ui.table.Column({
            label: new sap.ui.commons.Label({text: "Notification"}),
            template: new sap.ui.commons.Link().bindProperty("text", "notificationNo").bindProperty("href", "href",
                    function(aValue)
            //    sortProperty: "notificationNo",
                //filterProperty: "notificationNo",
                width: "200px"
            oTable.addColumn(new sap.ui.table.Column({
                label: new sap.ui.commons.Label({text: "Description"}),
                template: new sap.ui.commons.Link().bindProperty("text", "description").bindProperty("href", "href"),
                //sortProperty: "notificationNo",
                //filterProperty: "notificationNo",
                //width: "200px"
            var oModel = new sap.ui.model.json.JSONModel();
            oModel.setData({modelData: aData});
            oTable.setModel(oModel);
            oTable.bindRows("/modelData");
        var idForTable= "DimTable"
            //alert("id of tbale " + idForTable);
            var htmlOutput = '<table id=' + idForTable + ' name="DimTab" style="border: 1px solid black;margin-left:15px;" cellpadding=6 cellspacing=0><tr style="background-color:#E5E5E5"><td><b>Dimension</b></td><td><b>Value</b></td></tr>';
            for(var i=0;i<aData.length;i++)
             alert(aData[i].notificationNo);
            htmlOutput += '<tr style="display:none;"><td style="border-right:1px solid #e5e5e5;">Contract No</td><td>'+ aData[i].notificationNo+'</td></tr>';
            htmlOutput += '<tr style="display:none;"><td  style="border-right:1px solid #e5e5e5;">Unit No</td><td>'+ aData[i].description+'</td></tr>';
            htmlOutput += '</table>';   
             var html2 = new sap.ui.core.HTML({
                 // static content
                 //content : "<div style='position:relative;background-color:white;'>Weather</div><script src='//www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/builtin_weather.xml&synd=open&w=320&h=200&title=__MSG_weather_title__&lang=en&country=ALL&border=http%3A%2F%2Fwww.gmodules.com%2Fig%2Fimages%2F&output=js'></script>",
            content : htmlOutput,
                  //2 wrkng sydney content : '<div id="cont_Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx"><div id="spa_Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx"><a id="a_Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx" href="http://www.weather-wherever.co.uk/australia/sydney_v37463/" target="_blank" style="color:#333;text-decoration:none;">Weather forecast</a> © weather</div><script type="text/javascript" src="http://widget.weather-wherever.co.uk/js/Mzc0NjN8NXwxfDF8NHxlZGY1ZjV8M3xGRkZGRkZ8Y3wx"></script></div>',
                  //content : '<div style="margin-left:-10px;margin-top:10px;width:100%;"><LINK rel="StyleSheet" href="http://weatherandtime.net/new_wid/w_5/style.css" type="text/css" media="screen"><div class="ww_5" id="ww_5_2119"><div class="l_b"></div><div class="c_b"><div class="day" id="d_0"><span class="den"></span><br><span class="date"></span><br><span class="temp"></span><div class="pict"></div><span class="press"></span><br><span class="hum"></span><br><span class="vet"></span><br></div><div class="day" id="d_1"><span class="den"></span><br><span class="date"></span><br><span class="temp"></span><div class="pict"></div><span class="press"></span><br><span class="hum"></span><br><span class="vet"></span><br></div><div class="day" id="d_2"><span class="den"></span><br><span class="date"></span><br><span class="temp"></span><div class="pict"></div><span class="press"></span><br><span class="hum"></span><br><span class="vet"></span><br></div><div class="cl"></div><div class="links"><a target="_blank" title="Pune Weather forecast" href="http://weatherandtime.net/en/Asia/India/Pune-weather.html">Pune Weather forecast</a><br><a style="font-size:12px !important;color:#12A0D7 !important;text-decoration:none !important;" href="http://weatherandtime.net/en/widgets-gallery.html" title="weather"></a></div></div><div class="r_b"></div></div><script type="text/javascript" src="http://weatherandtime.net/w_5.js?city=2119&lang=en&type=2&day=3"></script></div>',
              // initially behaves the same as Sample 1
                 preferDOM : false,
                 // use the afterRendering event for 2 purposes
        return     oTable;
    /* In the screen shot as u can see.. I have to highlight the table cell in green color and red color for ordered and unordered status(which is binded to a json data) respectively....anyone please help??

    Hi Abhi,
                   Check this link it may helpHow I made highlight of specific values in Table

  • How can I make a table cell extend beyond the page?  The text disappears when the cell becomes larger than the page.

    How can I make a table cell extend beyond a page?  The text disappears when the cell becomes bigger than the page.  I want the table to continue to the next page.

    As a student, you might be able to get Office for Mac from the college bookstore at a substantial discount. Otherwise, I think your best option for documents that need to be shared with Office users is to get one of the free Office clones such as LibreOffice.

Maybe you are looking for

  • How to set the tasks as cancelled

    Guys , I had a scenario , where i have written a setObjectStatus adapter which sets the status of RO as Revoked. So i have provisioned a resource to a user and did some updates on resource profile as well , the status of the RO is provisioned and the

  • Goods Receipt posting issue

    Hi Guru,   I know it's an old question to rise but I forgot how to do it. Please help. When doing goods receipt shows--posting only possible in periods 2006/12 and 2006/11 in company code 3000. Thanks,Cindy

  • How do I get rid of a dropped pin that comes up everytime I try to send a new message?

    Every time I try to send a new message the dropped pin comes up in the text box? I deleted the pin on my maps and it still appears. It's so frustrating.

  • 5530 XM error

    Hi, when i turn on my Nokia 5530 XM i get an eror : "Home screen: function doesn't work on this device" . What's the reason of this error and maybe i could fix it on my own?

  • Need help on complex configuration

    hi all, i share internet access with my neighbour. in order to do it i bought two airport express base station and configured them using wds. the main station is installed in my neighbour apartment; the remote station is installed in my apartment and