Monday, June 28, 2010

setCellVerticalAlignment for a HorizontalPanel

I have unsuccessfully tried 3 different ways to set the vertical
alignment of a cell in a horizontal panel. I want the image and the
label to have the same vertical alignment. Currently, the image lies
lower than the label. Here is what I have tried:

public class AlertComponent extends HorizontalPanel {

public AlertComponent(int occurrenceOfGroupData, int
occurrenceOfGroupTask, int occurrenceOfGroupGlobal) {

Image imageGroupData = new Image();
final SimplePanel starGroupData = new SimplePanel();

setCellVerticalAlignment(starGroupData,HasVerticalAlignment.ALIGN_MIDDLE);
Label dataAlertLabel = new Label();
starGroupData.add(dataAlertLabel);
.
.
.

I have also tried to vertically align the label in the SimplePanel:

Image imageGroupData = new Image();
final SimplePanel starGroupData = new SimplePanel();
Label dataAlertLabel = new Label();
starGroupData.add(dataAlertLabel);

setCellVerticalAlignment(dataAlertLabel,HasVerticalAlignment.ALIGN_MIDDLE);


Lastly, I have also tried to set the style of a column:

public class AlertComponent extends HorizontalPanel {

public AlertComponent(int occurrenceOfGroupData, int
occurrenceOfGroupTask, int occurrenceOfGroupGlobal) {
setCellVerticalAlignment((Element)
this.getTable().getLastChild().getLastChild(),
HasVerticalAlignment.ALIGN_MIDDLE);
.
.
.

This will set the style of the table row and if I try to go one child
further by saying
this.getTable().getLastChild().getLastChild().getLastChild() I get a
Javascript error.

Does anyone know how I can get the label and the image to have the
same vertical alignment in a horizontal panel?

--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment