@Test public void testBuildStyle() { tested.setFontFamily(FONT_FAMILY); tested.setFontSize(FONT_SIZE); tested.setMultiline(true); tested.setTextBoxInternalAlignment(InlineTextEditorBoxViewImpl.ALIGN_MIDDLE); assertEquals(buildStyleString(InlineTextEditorBoxViewImpl.ALIGN_MIDDLE, BOX_WIDTH, BOX_HEIGHT, FONT_FAMILY, FONT_SIZE), tested.buildStyle(BOX_WIDTH, BOX_HEIGHT)); }
String buildStyle(final double width, final double height) { StringBuilder style = new StringBuilder(); if (textBoxAlignment.equalsIgnoreCase(ALIGN_MIDDLE)) { style.append(ALIGN_MIDDLE_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_LEFT)) { style.append(ALIGN_LEFT_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_TOP)) { style.append(TEXT_ALIGN_CENTER); } style.append("max-width: " + width + "px;" + "max-height: " + height + "px;" + "width: " + width + "px;"); style.append("font-family: \"" + fontFamily + "\";" + "font-size: " + fontSize + "px;"); return style.toString(); }
InlineTextEditorBoxViewImpl extends AbstractInlineTextEditorBoxView implements InlineEditorBoxView,
                   IsElement { String buildStyle(final double width, final double height) { StringBuilder style = new StringBuilder(); if (textBoxAlignment.equalsIgnoreCase(ALIGN_MIDDLE)) { style.append(ALIGN_MIDDLE_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_LEFT)) { style.append(ALIGN_LEFT_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_TOP)) { style.append(TEXT_ALIGN_CENTER); } style.append("max-width: " + width + "px;" + "max-height: " + height + "px;" + "width: " + width + "px;"); style.append("font-family: \"" + fontFamily + "\";" + "font-size: " + fontSize + "px;"); return style.toString(); } }
InlineTextEditorBoxViewImpl extends AbstractInlineTextEditorBoxView implements InlineEditorBoxView,
                   IsElement { String buildStyle(final double width, final double height) { StringBuilder style = new StringBuilder(); if (textBoxAlignment.equalsIgnoreCase(ALIGN_MIDDLE)) { style.append(ALIGN_MIDDLE_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_LEFT)) { style.append(ALIGN_LEFT_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_TOP)) { style.append(TEXT_ALIGN_CENTER); } style.append("max-width: " + width + "px;" + "max-height: " + height + "px;" + "width: " + width + "px;"); style.append("font-family: \"" + fontFamily + "\";" + "font-size: " + fontSize + "px;"); return style.toString(); } @Inject  InlineTextEditorBoxViewImpl(final TranslationService translationService);  InlineTextEditorBoxViewImpl(final TranslationService translationService,
                                       final Div editNameBox,
                                       final Div nameField,
                                       final Command showCommand,
                                       final Command hideCommand); }
InlineTextEditorBoxViewImpl extends AbstractInlineTextEditorBoxView implements InlineEditorBoxView,
                   IsElement { String buildStyle(final double width, final double height) { StringBuilder style = new StringBuilder(); if (textBoxAlignment.equalsIgnoreCase(ALIGN_MIDDLE)) { style.append(ALIGN_MIDDLE_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_LEFT)) { style.append(ALIGN_LEFT_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_TOP)) { style.append(TEXT_ALIGN_CENTER); } style.append("max-width: " + width + "px;" + "max-height: " + height + "px;" + "width: " + width + "px;"); style.append("font-family: \"" + fontFamily + "\";" + "font-size: " + fontSize + "px;"); return style.toString(); } @Inject  InlineTextEditorBoxViewImpl(final TranslationService translationService);  InlineTextEditorBoxViewImpl(final TranslationService translationService,
                                       final Div editNameBox,
                                       final Div nameField,
                                       final Command showCommand,
                                       final Command hideCommand); @PostConstruct @Override void initialize(); @Override void init(Presenter presenter); @Override void setTextBoxInternalAlignment(final String alignment); @Override void setMultiline(final boolean isMultiline); @Override void setPlaceholder(final String placeholder); @Override void setFontSize(final double size); @Override void setFontFamily(final String fontFamily); @Override void show(final String name, final double width, final double height); @Override void rollback(); }
InlineTextEditorBoxViewImpl extends AbstractInlineTextEditorBoxView implements InlineEditorBoxView,
                   IsElement { String buildStyle(final double width, final double height) { StringBuilder style = new StringBuilder(); if (textBoxAlignment.equalsIgnoreCase(ALIGN_MIDDLE)) { style.append(ALIGN_MIDDLE_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_LEFT)) { style.append(ALIGN_LEFT_STYLE); } else if (textBoxAlignment.equalsIgnoreCase(ALIGN_TOP)) { style.append(TEXT_ALIGN_CENTER); } style.append("max-width: " + width + "px;" + "max-height: " + height + "px;" + "width: " + width + "px;"); style.append("font-family: \"" + fontFamily + "\";" + "font-size: " + fontSize + "px;"); return style.toString(); } @Inject  InlineTextEditorBoxViewImpl(final TranslationService translationService);  InlineTextEditorBoxViewImpl(final TranslationService translationService,
                                       final Div editNameBox,
                                       final Div nameField,
                                       final Command showCommand,
                                       final Command hideCommand); @PostConstruct @Override void initialize(); @Override void init(Presenter presenter); @Override void setTextBoxInternalAlignment(final String alignment); @Override void setMultiline(final boolean isMultiline); @Override void setPlaceholder(final String placeholder); @Override void setFontSize(final double size); @Override void setFontFamily(final String fontFamily); @Override void show(final String name, final double width, final double height); @Override void rollback(); static final String CARET_RETURN; static final String TEXT_ALIGN_CENTER; static final String TEXT_ALIGN_LEFT; static final String ALIGN_MIDDLE_STYLE; static final String ALIGN_LEFT_STYLE; static final String ALIGN_MIDDLE; static final String ALIGN_LEFT; static final String ALIGN_TOP; static final String DEFAULT_FONT_FAMILY; static final double DEFAULT_FONT_SIZE; }