[oXygen-user] Tables with width in percents

Mike Starov
Fri Jun 24 11:21:58 CDT 2011


Thanks a lot. Sending null does the trick. 

Here is what I ended up with. If width is fixed I pass it through if it is percents then I send null. That way I keep the resizing functionality on fixed width tables.

@Override
    public AuthorTableColumnWidthProvider createAuthorTableColumnWidthProvider()
    {
        return new CALSandHTMLTableCellInfoProvider()
        {
            @Override
            public WidthRepresentation getTableWidth(String tableCellsTagName)
            {
                WidthRepresentation toReturn = super.getTableWidth(tableCellsTagName);
                if( toReturn != null && !toReturn.getWidthRepresentation().contains("%") )
                    return toReturn;
                return null;
            }
        };
    }


-----Original Message-----
From:  [mailto:] On Behalf Of Radu Coravu
Sent: Wednesday, June 22, 2011 10:59 PM
To: oXygen User ML
Subject: Re: [oXygen-user] Tables with width in percents

Hi Mike,

You can try to modify the 
"ro.sync.ecss.extensions.docbook.DocBookExtensionsBundleBase" and modify 
the method:

> public AuthorTableColumnWidthProvider createAuthorTableColumnWidthProvider()

like:

> /**
>    * @see ro.sync.ecss.extensions.api.ExtensionsBundle#createAuthorTableColumnWidthProvider()
>    */
>   @Override
>   public AuthorTableColumnWidthProvider createAuthorTableColumnWidthProvider() {
>     return new CALSandHTMLTableCellInfoProvider() {
>       /**
>        * @see ro.sync.ecss.extensions.commons.table.support.CALSandHTMLTableCellInfoProvider#getTableWidth(java.lang.String)
>        */
>       @Override
>       public WidthRepresentation getTableWidth(String tableCellsTagName) {
>         return null;
>       }
>     };
>   }


As in the Docbook CSS the width is also specified as a property for the 
table there should be no need in this case to return a fixed width in 
the "AuthorTableColumnWidthProvider".

Regards,
Radu

Radu Coravu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 6/23/2011 12:59 AM, Mike Starov wrote:
> What if I Override the getTableWidth() method in CALSTableCellInfoProvider and make it return a pixel value vs percentage all the time. I would need access to window dimension/viewport. Then I could easily calculate the pixel value and return it as WidthRepresentation(pixelValue, true);
>
> Is something like that possible?
>
> -----Original Message-----
> From:  [mailto:] On Behalf Of Radu Coravu
> Sent: Monday, June 20, 2011 7:10 AM
> To: 
> Subject: Re: [oXygen-user] Tables with width in percents
>
> Hi Mike,
>
> So you have a custom implementation of the Docbook schemas which allow
> you to specify the "width" on a table with a "frame" attribute.
> We analyzed this situation (the table size is properly computed and
> displayed but the columns do not take the additional space) which seems
> to be a bug in Oxygen and we'll try to come up with a fix in the next
> version (probably it September this year).
> Unfortunately I cannot give you a workaround for now.
>
> Regards,
> Radu
>
> Radu Coravu
> <oXygen/>   XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
> On 6/17/2011 6:43 PM, Mike Starov wrote:
>> Hello all.
>>
>> I am working on customizing DocBook for our publishing department. I
>> have a difficulty displaying tables in Author mode with "width" set in
>> percents. The table itself is displayed fine with width corresponding to
>> % of the page set in width attribute, but the columns are displayed as
>> much narrower. There is a big chunk of empty space on the right that's
>> not taken up but the columns.
>>
>> As soon as I change tables width to a set value like 500 the columns
>> expand and take up the whole table space.
>>
>> Example below. Try pasting it and seeing how it gets displayed in
>> oXygen. I know that DocBook schema bundled with Oxygen complains about
>> width attribute but it is supported by HTML tables and there are rules
>> for it in CSS.
>>
>> How can I fix this. I tried playing with CSS but could not find any
>> solution. I looked at the API and there is some interfaces that seem to
>> be able to help with this but It seems pretty complicated. I need some
>> help getting started.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <sect1xmlns="http://docbook.org/ns/docbook"version="5.0">
>> <title>First section</title>
>> <para>
>> <tableframe="all"width="80%">
>> <title>This is table with % width</title>
>> <tgroupcols="4">
>> <colspeccolname="c1"colnum="1"colwidth="1.0*"/>
>> <colspeccolname="c2"colnum="2"colwidth="1.0*"/>
>> <thead>
>> <row>
>> <entry>H</entry>
>> <entry>A</entry>
>> </row>
>> </thead>
>> <tbody>
>> <row>
>> <entry>1</entry>
>> <entry>2</entry>
>> </row>
>> </tbody>
>> </tgroup>
>> </table>
>> <tableframe="all"width="500">
>> <title>This is table with fixed width</title>
>> <tgroupcols="4">
>> <colspeccolname="c1"colnum="1"colwidth="1.0*"/>
>> <colspeccolname="c2"colnum="2"colwidth="1.0*"/>
>> <thead>
>> <row>
>> <entry>H</entry>
>> <entry>A</entry>
>> </row>
>> </thead>
>> <tbody>
>> <row>
>> <entry>1</entry>
>> <entry>2</entry>
>> </row>
>> </tbody>
>> </tgroup>
>> </table>
>> <tableframe="all"width="80%">
>> <caption>Nother table HTML</caption>
>> <colwidth="50%"/>
>> <colwidth="50%"/>
>> <thead>
>> <tr>
>> <th>A</th>
>> <th>B</th>
>> </tr>
>> </thead>
>> <tbody>
>> <tr>
>> <td/>
>> <td/>
>> </tr>
>> </tbody>
>> </table>
>> <tableframe="all"width="500">
>> <caption>Nother table HTML fixed width</caption>
>> <colwidth="50%"/>
>> <colwidth="50%"/>
>> <thead>
>> <tr>
>> <th>A</th>
>> <th>B</th>
>> </tr>
>> </thead>
>> <tbody>
>> <tr>
>> <td/>
>> <td/>
>> </tr>
>> </tbody>
>> </table>
>> </para>
>> </sect1>
>>
>> Sincerely,
>>
>> Mike Starovoytov
>>
>> Software Engineer
>>
>> CME Resource
>>
>> 1482 Stone Point Drive, Suite 120
>>
>> Roseville, CA 95661-2839
>>
>> Telephone: 800-232-4238, extension 193
>>
>> Fax: (916) 783-6067
>>
>> Email: 
>>
>>
>>
>> _______________________________________________
>> oXygen-user mailing list
>> 
>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>
>
>
> _______________________________________________
> oXygen-user mailing list
> 
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>
>
>
_______________________________________________
oXygen-user mailing list

http://www.oxygenxml.com/mailman/listinfo/oxygen-user






More information about the oXygen-user mailing list