Where color() method gets called. Can you provide TwoAxisFlexTable.ui.xml source?
On Dec 15 2009, 1:28 pm, mma <marco.m.al...@gmail.com> wrote: > Hi! > > I'm currently trying to create a widget that extends FlexTable in way > the style of the row and column header cells (row=0 and col=0, > respectively) is different from the other (regular) cells. > > In order to do this, i'm following the approach: > - Created TwoAxisFlexTable.java and TwoAxisFlexTable.ui.xml using the > eclipse plugin provided by google (code below) > - Changed the java file in order to extend FlexTable instead of > extending Composite (and erased the initwidget() part) > - Included a new xmlns in the ui.xml file in order to recognize the > TwoAxisFlexTable class from the java file > - Added a Style type in the ui.xml file and the respective interface > in java file > > All is working fine, but the is code is breaking (null exception) when > I try to set the style. > > I'm not an experienced programmer, so I imagine that the problem i'm > facing has a trivial solution... > > Thanks, > M. > > --- ui.xml --- > > <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> > <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" > xmlns:g="urn:import:com.google.gwt.user.client.ui" > xmlns:t="urn:import:com.mobeo.experiments.client.ui"> > > <ui:style > type='com.mobeo.experiments.client.ui.TwoAxisFlexTable.Style'> > .axisrow {border-bottom: solid thin grey; text-align: center;} > .axiscol {border-right: solid thin grey; text-align: center;} > .regular {text-align: center;} > </ui:style> > <g:HTMLPanel> > <t:TwoAxisFlexTable></t:TwoAxisFlexTable> > </g:HTMLPanel> > </ui:UiBinder> > > -- java --- > > package com.mobeo.experiments.client.ui; > > import com.google.gwt.core.client.GWT; > import com.google.gwt.resources.client.CssResource; > import com.google.gwt.uibinder.client.UiBinder; > import com.google.gwt.uibinder.client.UiField; > import com.google.gwt.user.client.ui.FlexTable; > import com.google.gwt.user.client.ui.Widget; > > public class TwoAxisFlexTable extends FlexTable { > > private static TwoAxisFlexTableUiBinder uiBinder = GWT.create > (TwoAxisFlexTableUiBinder.class); > > interface TwoAxisFlexTableUiBinder extends > UiBinder<Widget, TwoAxisFlexTable> { > } > > interface Style extends CssResource { > String axisrow(); > String axiscol(); > String regular(); > } > > @UiField Style style; > > public TwoAxisFlexTable() { > super(); > } > > void color () { > int rowsize = super.getRowCount(); > if (rowsize == 0) return; > for (int row = 0; row < rowsize; row ++) { > int colsize = super.getCellCount(row); > System.out.println("Recoloring... row: " + row + " # > col: " + > colsize); > if (colsize != 0) { > for (int col = 0; col < colsize; col ++) { > System.out.println("Recoloring... > row: " + row + " col: " + col); > > // CODE BREAKS IN THE STATEMENT > BELOW > if (row == 0) > getCellFormatter().setStyleName(row, col, > style.axisrow()); > else if (col == 0) > getCellFormatter().setStyleName(row, col, > style.axiscol()); > else > getCellFormatter().setStyleName(row, col, style.regular()); > } > } > } > > } > > } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.