@Test public void testRenderCenteredText() throws Exception { final BaseGridCell<String> cell = new BaseGridCell<>(new BaseGridCellValue<>(VALUE)); RendererUtils.getCenteredCellText(cellContext, cell); assertCenteredRendering(text); assertNotRenderedPlaceHolder(placeHolderText); }
public static Group getCenteredCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); final Group g = GWT.create(Group.class); String value = gridCell.getValue().getValue(); final Text t; if (!StringUtils.isEmpty(value)) { t = theme.getBodyText(); } else { value = gridCell.getValue().getPlaceHolder(); t = theme.getPlaceholderText(); } t.setText(value); t.setListening(false); t.setX(context.getCellWidth() / 2); t.setY(context.getCellHeight() / 2); g.add(t); return g; }
RendererUtils { public static Group getCenteredCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); final Group g = GWT.create(Group.class); String value = gridCell.getValue().getValue(); final Text t; if (!StringUtils.isEmpty(value)) { t = theme.getBodyText(); } else { value = gridCell.getValue().getPlaceHolder(); t = theme.getPlaceholderText(); } t.setText(value); t.setListening(false); t.setX(context.getCellWidth() / 2); t.setY(context.getCellHeight() / 2); g.add(t); return g; } }
RendererUtils { public static Group getCenteredCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); final Group g = GWT.create(Group.class); String value = gridCell.getValue().getValue(); final Text t; if (!StringUtils.isEmpty(value)) { t = theme.getBodyText(); } else { value = gridCell.getValue().getPlaceHolder(); t = theme.getPlaceholderText(); } t.setText(value); t.setListening(false); t.setX(context.getCellWidth() / 2); t.setY(context.getCellHeight() / 2); g.add(t); return g; }  }
RendererUtils { public static Group getCenteredCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); final Group g = GWT.create(Group.class); String value = gridCell.getValue().getValue(); final Text t; if (!StringUtils.isEmpty(value)) { t = theme.getBodyText(); } else { value = gridCell.getValue().getPlaceHolder(); t = theme.getPlaceholderText(); } t.setText(value); t.setListening(false); t.setX(context.getCellWidth() / 2); t.setY(context.getCellHeight() / 2); g.add(t); return g; }  static Group getExpressionCellText(final GridBodyCellRenderContext context,
                                              final GridCell<String> gridCell); static Group getCenteredCellText(final GridBodyCellRenderContext context,
                                            final GridCell<String> gridCell); static Group getNameAndDataTypeCellText(final InformationItemCell.HasNameAndDataTypeCell hasNameAndDataTypeCell,
                                                   final GridBodyCellRenderContext context); static Group getExpressionHeaderText(final EditableHeaderMetaData headerMetaData,
                                                final GridHeaderColumnRenderContext context); static Group getValueAndDataTypeHeaderText(final ValueAndDataTypeHeaderMetaData headerMetaData,
                                                      final GridHeaderColumnRenderContext context,
                                                      final double blockWidth,
                                                      final double blockHeight); static Group getEditableHeaderText(final EditableHeaderMetaData headerMetaData,
                                              final GridHeaderColumnRenderContext context,
                                              final double blockWidth,
                                              final double blockHeight); static Group getEditableHeaderPlaceHolderText(final EditableHeaderMetaData headerMetaData,
                                                         final GridHeaderColumnRenderContext context,
                                                         final double blockWidth,
                                                         final double blockHeight); static double getExpressionTextLineHeight(final GridRendererTheme theme); }
RendererUtils { public static Group getCenteredCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); final Group g = GWT.create(Group.class); String value = gridCell.getValue().getValue(); final Text t; if (!StringUtils.isEmpty(value)) { t = theme.getBodyText(); } else { value = gridCell.getValue().getPlaceHolder(); t = theme.getPlaceholderText(); } t.setText(value); t.setListening(false); t.setX(context.getCellWidth() / 2); t.setY(context.getCellHeight() / 2); g.add(t); return g; }  static Group getExpressionCellText(final GridBodyCellRenderContext context,
                                              final GridCell<String> gridCell); static Group getCenteredCellText(final GridBodyCellRenderContext context,
                                            final GridCell<String> gridCell); static Group getNameAndDataTypeCellText(final InformationItemCell.HasNameAndDataTypeCell hasNameAndDataTypeCell,
                                                   final GridBodyCellRenderContext context); static Group getExpressionHeaderText(final EditableHeaderMetaData headerMetaData,
                                                final GridHeaderColumnRenderContext context); static Group getValueAndDataTypeHeaderText(final ValueAndDataTypeHeaderMetaData headerMetaData,
                                                      final GridHeaderColumnRenderContext context,
                                                      final double blockWidth,
                                                      final double blockHeight); static Group getEditableHeaderText(final EditableHeaderMetaData headerMetaData,
                                              final GridHeaderColumnRenderContext context,
                                              final double blockWidth,
                                              final double blockHeight); static Group getEditableHeaderPlaceHolderText(final EditableHeaderMetaData headerMetaData,
                                                         final GridHeaderColumnRenderContext context,
                                                         final double blockWidth,
                                                         final double blockHeight); static double getExpressionTextLineHeight(final GridRendererTheme theme); static final double EXPRESSION_TEXT_PADDING; static final String FONT_STYLE_TYPE_REF; static final double SPACING; }