BuilderDrawer() { if (drawerResource != null) { Embedded drawerBkg = new Embedded(null, drawerResource); addComponent(drawerBkg, "top:0px;left:0px"); } content = new TextArea(); // only shows if no focus, and if we don't have focus, it's not normally showing // content.setInputPrompt("Type here to add to this card chain."); content.setWordwrap(true); content.setImmediate(true); content.setTextChangeEventMode(TextChangeEventMode.LAZY); content.setTextChangeTimeout(500); // cause exception w/ 2 windows? // content.setDebugId(CardTypeManager.getCardContentDebugId(ct)); content.setId( CardDebug.getCardContentDebugId(ct)); // CardTypeManager.getCardContentDebugId(ct)); content.addTextChangeListener(new characterTypedHandler()); content.setWidth(CARDLISTHEADER_DRAWER_TEXT_W); content.setHeight(CARDLISTHEADER_DRAWER_TEXT_H); content.addStyleName("m-white-background"); addComponent(content, CARDLISTHEADER_DRAWER_TEXT_POS); count = new Label("0/140"); count.setWidth(CARDLISTHEADER_DRAWER_COUNT_W); count.setHeight(CARDLISTHEADER_DRAWER_COUNT_H); count.addStyleName("m-cardbuilder-count-text"); addComponent(count, CARDLISTHEADER_DRAWER_COUNT_POS); cancelButt = new NativeButton("cancel"); cancelButt.setWidth(CARDLISTHEADER_DRAWER_CANCEL_W); cancelButt.setHeight(CARDLISTHEADER_DRAWER_CANCEL_H); cancelButt.addStyleName("borderless"); cancelButt.addStyleName("m-cardbuilder-button-text"); cancelButt.addClickListener(new CancelHandler()); addComponent(cancelButt, CARDLISTHEADER_DRAWER_CANCEL_POS); submitButt = new NativeButton("submit"); // cause exception w/ 2 windows? // submitButt.setDebugId(CardTypeManager.getCardSubmitDebugId(ct)); submitButt.setId( CardDebug.getCardSubmitDebugId(ct)); // CardTypeManager.getCardSubmitDebugId(ct)); submitButt.setWidth(CARDLISTHEADER_DRAWER_OKBUTT_W); submitButt.setHeight(CARDLISTHEADER_DRAWER_OKBUTT_H); submitButt.addStyleName("borderless"); submitButt.addStyleName("m-cardbuilder-button-text"); submitButt.addClickListener(new CardPlayHandler()); addComponent(submitButt, CARDLISTHEADER_DRAWER_OKBUTT_POS); setWidth(CARDLISTHEADER_DRAWER_W); setHeight(CARDLISTHEADER_DRAWER_H); }
private void createEditorArea() { Panel editorArea = new Panel(); GridLayout grid = new GridLayout(2, 3); grid.setSizeFull(); grid.setSpacing(true); keyLabel = new Label(); keyLabel.setValue(Messages.getString("PropertiesEditor_NO_SELECTION_LABEL")); // $NON-NLS-1$ grid.addComponent(keyLabel, 0, 0, 1, 0); grid.setColumnExpandRatio(0, 1.0f); grid.setColumnExpandRatio(1, 1.0f); orignal = new TextArea(); orignal.setRows(3); orignal.setReadOnly(true); orignal.setWidth(100, TextArea.UNITS_PERCENTAGE); grid.addComponent(orignal); translated = new TextArea(); translated.setRows(3); translated.setInvalidCommitted(true); translated.setWidth(100, TextArea.UNITS_PERCENTAGE); translated.setNullRepresentation(""); // $NON-NLS-1$ translated.addListener((TextChangeListener) this); translated.setWriteThrough(true); translated.setImmediate(true); translated.setTextChangeEventMode(TextChangeEventMode.LAZY); translated.setTextChangeTimeout(500); grid.addComponent(translated); orignalComment = new TextArea(); orignalComment.setReadOnly(true); orignalComment.setWidth(100, TextArea.UNITS_PERCENTAGE); orignalComment.setRows(3); orignalComment.setNullRepresentation(""); // $NON-NLS-1$ grid.addComponent(orignalComment); translatedComment = new TextArea(); translatedComment.setImmediate(true); translatedComment.setWidth(100, TextArea.UNITS_PERCENTAGE); translatedComment.setRows(3); translatedComment.setNullRepresentation(""); // $NON-NLS-1$ translatedComment.setInputPrompt( Messages.getString("PropertiesEditor_COMMENT_INPUT_PROMPT")); // $NON-NLS-1$ translatedComment.setWriteThrough(true); translatedComment.addListener((TextChangeListener) this); grid.addComponent(translatedComment); safeButton = new Button(); safeButton.setEnabled(false); safeButton.setCaption( Messages.getString("PropertiesEditor_SAVE_BUTTON_CAPTION")); // $NON-NLS-1$ safeButton.addListener( new ClickListener() { @Override public void buttonClick(ClickEvent event) { setDirty(false); PropertyPersistenceService propertyPersistence = MainDashboard.getCurrent().getPropertyPersistence(); propertyPersistence.saveProperties(descriptor, target); layout .getWindow() .showNotification( Messages.getString("PropertiesEditor_SAVED_CONFIRMATION_DIALOG_TITLE"), descriptor.getLocation().lastSegment()); // $NON-NLS-1$ } }); editorArea.setContent(grid); HorizontalLayout buttonArea = new HorizontalLayout(); buttonArea.setSpacing(true); layout.addComponent(editorArea); layout.setExpandRatio(editorArea, 0); buttonArea.addComponent(safeButton); Button editTemplate = new Button( Messages.getString("PropertiesEditor_EDIT_TEMPLATE_BUTTON_CAPTION")); // $NON-NLS-1$ editTemplate.addListener( new ClickListener() { @Override public void buttonClick(ClickEvent event) { BreadCrumb crumb = MainDashboard.getCurrent().getBreadcrumbs(); crumb.walkTo("?master"); // $NON-NLS-1$ } }); buttonArea.addComponent(editTemplate); layout.addComponent(buttonArea); layout.setExpandRatio(buttonArea, 0); }