Since this is quite the change, I've taken the opportunity to rewrite smaller adjoining pieces to make more sense. Move methods from classes, and so on. These changes are, however, only on the code level, no other functionality will be introduced by this patch. Change-Id: I56f19c5af7dc4ccfd2fa4c9098f06e77dbfa12fbtags/7.2.0.beta1
* @return the number of rows in the current row container | * @return the number of rows in the current row container | ||||
*/ | */ | ||||
public int getRowCount(); | public int getRowCount(); | ||||
/** | |||||
* The default height of the rows in this RowContainer. | |||||
* | |||||
* @param px | |||||
* the default height in pixels of the rows in this RowContainer | |||||
* @throws IllegalArgumentException | |||||
* if <code>px < 1</code> | |||||
*/ | |||||
public void setDefaultRowHeight(int px) throws IllegalArgumentException; | |||||
/** | |||||
* Returns the default height of the rows in this RowContainer. | |||||
* | |||||
* @return the default height of the rows in this RowContainer, in pixels | |||||
*/ | |||||
public int getDefaultRowHeight(); | |||||
} | } |
grid.calculateColumnWidths(); | grid.calculateColumnWidths(); | ||||
} | } | ||||
})); | })); | ||||
addComponent(new Button("Randomize row heights", | |||||
new Button.ClickListener() { | |||||
@Override | |||||
public void buttonClick(ClickEvent event) { | |||||
grid.randomizeDefaultRowHeight(); | |||||
} | |||||
})); | |||||
} | } | ||||
@Override | @Override |
void setColumnWidth(int index, int px); | void setColumnWidth(int index, int px); | ||||
void calculateColumnWidths(); | void calculateColumnWidths(); | ||||
void randomRowHeight(); | |||||
} | } |
*/ | */ | ||||
package com.vaadin.tests.widgetset.client.grid; | package com.vaadin.tests.widgetset.client.grid; | ||||
import com.google.gwt.user.client.Random; | |||||
import com.vaadin.client.ui.AbstractComponentConnector; | import com.vaadin.client.ui.AbstractComponentConnector; | ||||
import com.vaadin.shared.ui.Connect; | import com.vaadin.shared.ui.Connect; | ||||
import com.vaadin.shared.ui.grid.ScrollDestination; | import com.vaadin.shared.ui.grid.ScrollDestination; | ||||
public void calculateColumnWidths() { | public void calculateColumnWidths() { | ||||
getWidget().calculateColumnWidths(); | getWidget().calculateColumnWidths(); | ||||
} | } | ||||
@Override | |||||
public void randomRowHeight() { | |||||
getWidget().getHeader().setDefaultRowHeight( | |||||
Random.nextInt(20) + 20); | |||||
getWidget().getBody().setDefaultRowHeight( | |||||
Random.nextInt(20) + 20); | |||||
getWidget().getFooter().setDefaultRowHeight( | |||||
Random.nextInt(20) + 20); | |||||
} | |||||
}); | }); | ||||
} | } | ||||
return escalator.getHeader(); | return escalator.getHeader(); | ||||
} | } | ||||
public RowContainer getBody() { | |||||
return escalator.getBody(); | |||||
} | |||||
public RowContainer getFooter() { | public RowContainer getFooter() { | ||||
return escalator.getFooter(); | return escalator.getFooter(); | ||||
} | } |
public void calculateColumnWidths() { | public void calculateColumnWidths() { | ||||
rpc().calculateColumnWidths(); | rpc().calculateColumnWidths(); | ||||
} | } | ||||
public void randomizeDefaultRowHeight() { | |||||
rpc().randomRowHeight(); | |||||
} | |||||
} | } |