public void edit(RecipeTO pRecipe) { nameTextBox.setText(pRecipe.getName()); nameTextBox.setReadOnly(false); for (int i = 0; i < category.getItemCount(); i++) { if (pRecipe.getCategory().equals(category.getItemText(i))) { category.setSelectedIndex(i); } } for (int i = 0; i < cuisine.getItemCount(); i++) { if (pRecipe.getCuisine().equals(cuisine.getItemText(i))) { cuisine.setSelectedIndex(i); } } for (int i = 0; i < occasion.getItemCount(); i++) { if (pRecipe.getOccasion().equals(occasion.getItemText(i))) { occasion.setSelectedIndex(i); } } for (int i = 0; i < serves.getItemCount(); i++) { if (pRecipe.getServes().equals(serves.getItemText(i))) { serves.setSelectedIndex(i); } } ingredients.setText(pRecipe.getIngredients()); directions.setText(pRecipe.getDirections()); }
public void fillForm(Member member) { header.setText("Mitglied bearbeiten"); importantDisclosurePanel.setOpen(true); additionalDisclosurePanel.setOpen(true); forenameTextBox.setText(member.getForename()); surnameTextBox.setText(member.getSurname()); barcodeTextBox.setText("" + member.getBarcodeID()); createMemberPanel.remove(barcodeInputPanel); streetTextBox.setText(member.getStreet()); zipcodeTextBox.setText("" + member.getZipcode()); cityTextBox.setText(member.getCity()); birthTextBox1.setSelectedIndex(Integer.parseInt("" + member.getBirthDay())); birthTextBox2.setSelectedIndex(Integer.parseInt("" + member.getBirthMonth())); int temp = Integer.parseInt("" + (member.getBirthYear())) - 2009; birthTextBox3.setSelectedIndex(-temp); phoneTextBox.setText(member.getPhone()); // TODO for (int i = 0; i < beltsizeListBox.getItemCount(); i++) { if (beltsizeListBox.getItemText(i).equals(member.getBeltsize())) { beltsizeListBox.setSelectedIndex(i); } } // beltsizeListBox.setSelectedIndex(i); // beltsizeTextBox.setText(member.getBeltsize()); mobilephoneTextBox.setText(member.getMobilephone()); faxTextBox.setText(member.getFax()); emailTextBox.setText(member.getEmail()); homepageTextBox.setText(member.getHomepage()); diseasesTextBox.setText(member.getDiseases()); noteTextBox.setText(member.getNote()); imageUrl = member.getPicture(); if (member.getAccountForename().equals(member.getForename())) { accountOwnerForenameTextBox.setText(constants.likeAbove()); accountOwnerForenameTextBox.setReadOnly(true); likeAbove.setValue(true); } else { accountOwnerForenameTextBox.setText(member.getAccountForename()); } if (member.getAccountSurname().equals(member.getSurname())) { accountOwnerSurnameTextBox.setText(constants.likeAbove()); accountOwnerSurnameTextBox.setReadOnly(true); likeAbove2.setValue(true); } else { accountOwnerSurnameTextBox.setText(member.getAccountSurname()); } accountNumberTextBox.setText(member.getAccountNumber()); bankNameTextBox.setText(member.getBankName()); bankNumberTextBox.setText(member.getBankNumber()); }
public void createEntryTextArea( final FlowPanel flowPanel, String entryStringBuilder, ScrollPanel scrollPanel) { String carriageReturn_LineFeed = "\r\n"; String lines[] = entryStringBuilder.split("\\r?\\n"); String stringBuilder = new String(); for (int i = 0; i < lines.length; i++) { String line = lines[i]; if (line.trim().startsWith("<criteriaReference")) { if (stringBuilder.length() > 0) { TextArea entryTextArea = new TextArea(); entryTextArea.setStyleName("textarea_noborder"); entryTextArea.addStyleName("entry_background"); entryTextArea.setText(stringBuilder); flowPanel.add(entryTextArea); entryTextArea.setReadOnly(true); entryTextArea.setWidth("100%"); entryTextArea.setHeight("100%"); entryTextArea.setVisibleLines(getLineCount(stringBuilder) + 1); } stringBuilder = new String(); // find more lines until the end tag </criteriaReference> String critRefStringBuilder = new String(); while (!line.trim().startsWith("</criteriaReference>")) { critRefStringBuilder += (carriageReturn_LineFeed + line); i++; line = lines[i]; } if (line.trim().startsWith("</criteriaReference>")) { critRefStringBuilder += (carriageReturn_LineFeed + line); createCritRefTextArea(flowPanel, scrollPanel, critRefStringBuilder); } } else { stringBuilder += (carriageReturn_LineFeed + line); } } if (stringBuilder.length() > 0) { TextArea entryTextArea = new TextArea(); entryTextArea.setStyleName("textarea_noborder"); entryTextArea.addStyleName("entry_background"); entryTextArea.setText(stringBuilder); flowPanel.add(entryTextArea); entryTextArea.setReadOnly(true); entryTextArea.setWidth("100%"); entryTextArea.setHeight("100%"); entryTextArea.setVisibleLines(getLineCount(stringBuilder) + 1); } }
protected void clearCells() { managerHTML.setText(""); dateCreatedHTML.setText(""); // workingSetMode.setEnabled(true); // workingSetMode.setSelectedIndex(0); // workingSetName.setEnabled(true); filterPanel.setFilter(new AssessmentFilter()); workingSetName.setText(""); description.setEnabled(true); description.setText(""); notes.setEnabled(true); notes.setText(""); people.enable(); people.clearItemsInList(); }
public void appendToConsole(String text) { console.setText(console.getText() + text); if (console.getText().length() > 0) { console.setCursorPos(console.getText().length() - 1); console.getElement().setScrollTop(console.getElement().getScrollHeight()); } }
void insertText(String ins) { int i = text.getCursorPos(); String left = text.getText().substring(0, i); String right = text.getText().substring(i, text.getText().length()); text.setText(left + ins + right); this.data.content = text.getText(); }
private void updateCounter() { int size = taNotes.getText().length(); if (size > Message.MAX_LENGTH_MESSAGE) { taNotes.setText(taNotes.getText().substring(0, Message.MAX_LENGTH_MESSAGE)); } lblCounter.setText(size + "/" + Message.MAX_LENGTH_MESSAGE); }
public void copyContent(ClipboardContent content) { final TextArea copyArea = createClipboardTextArea(); if (content.isSupported(ContentKinds.TEXT)) { copyArea.setText(content.get(ContentKinds.TEXT)); } else { copyArea.setText(content.toString()); } copyArea.selectAll(); new Timer() { @Override public void run() { RootPanel.get().remove(copyArea); $(myTarget).focus(); } }.schedule(20); }
private void resetUI() { dbInstructionArea.setText(""); dbInstructionArea.setVisible(false); includeDbScriptBox.setValue(false); selectionListbox.clear(); selectionWidget.reset(); notificationEmailBox.setText(""); }
private CellList<String> configureUserList() { ArrayList<String> team = User.getStrTeam(); userList.setText(""); // Create a cell to render each value. TextCell textCell = new TextCell(); // Create a CellList that uses the cell. CellList<String> cellList = new CellList<String>(textCell); cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); // Add a selection model to handle user selection. final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>(); cellList.setSelectionModel(selectionModel); selectionModel.addSelectionChangeHandler( new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { String selected = selectionModel.getSelectedObject(); if (selected != null) { String str = userList.getText(); if (str.contains(selected)) { // Remove the user that is already in the // textarea String strArray[] = str.split(","); String temp = ""; for (int i = 0; i < strArray.length; i++) { if (!strArray[i].equals(selected)) { if (i != 0) { temp = temp.concat(","); } temp = temp.concat(strArray[i]); } } userList.setText(temp); } else { // Add the user to the textarea if (str.isEmpty()) { userList.setText(selected); } else { userList.setText(str + ", " + selected); } } } selectionModel.setSelected(selected, false); selectionModel.clear(); } }); // Set the total row count. This isn't strictly necessary, but it // affects paging calculations, so its good habit to keep the row count // up to date. cellList.setRowCount(team.size(), true); // Push the data into the widget. cellList.setRowData(0, User.getStrTeam()); return cellList; }
@Override public void debug(String tag, String message) { if (logLevel >= LOG_DEBUG) { checkLogLabel(); log.setText(log.getText() + "\n" + tag + ": " + message + "\n"); log.setCursorPos(log.getText().length() - 1); System.out.println(tag + ": " + message + "\n"); } }
public void setData(String[] data) { final int baseName = 12; final int basePrice = baseName + Constants.NO_OF_EXTRAS_IN_UI; final int basePriceValue = basePrice + Constants.NO_OF_EXTRAS_IN_UI; tbKeyId.setText(data[0]); String imageKey = data[1]; if (imageKey != null) { imgItem.setUrl(GWT.getHostPageBaseURL() + "serveBlob?id=" + data[1]); imgItem.setVisible(true); } tbName.setText(data[2]); taDescription.setText(data[3]); editingExistingData = true; if (data[4] != null) { rbSinglePrice.setValue(true); rbSinglePrice.setFormValue("single"); dbSinglePrice.setValue(Double.parseDouble(data[basePriceValue])); } else { rbMultiplePrice.setValue(true); rbMultiplePrice.setFormValue("multiple"); if (data[5] != null) { cbSmall.setValue(true); dbSmallPrice.setValue(Double.parseDouble(data[basePriceValue + 1])); } if (data[6] != null) { cbMedium.setValue(true); dbMediumPrice.setValue(Double.parseDouble(data[basePriceValue + 2])); } if (data[7] != null) { cbLarge.setValue(true); dbLargePrice.setValue(Double.parseDouble(data[basePriceValue + 3])); } if (data[8] != null) { cbTapa.setValue(true); dbTapaPrice.setValue(Double.parseDouble(data[basePriceValue + 4])); } if (data[9] != null) { cbHalf.setValue(true); dbHalfPrice.setValue(Double.parseDouble(data[basePriceValue + 5])); } if (data[10] != null) { cbFull.setValue(true); dbFullPrice.setValue(Double.parseDouble(data[basePriceValue + 6])); } } if (data[11] != null) { tbExtrasName.setText(data[11]); } for (int i = 0; i < Constants.NO_OF_EXTRAS_IN_UI; i++) { String name = data[baseName + i]; if (name != null) { tbExtras[i].setText(name); tbExtrasPrices[i].setText(data[basePrice + i]); } } }
@Override public void error(String tag, String message) { if (logLevel >= LOG_ERROR) { checkLogLabel(); log.setText(log.getText() + "\n" + tag + ": " + message); log.setCursorPos(log.getText().length() - 1); System.err.println(tag + ": " + message); } }
public void updateViewFromState() { customSqlBox.setText(savedSqlCondition); showInvalid.setChecked(savedShowInvalid); filterList.clear(); for (FilterData filterData : savedFilters) { filterList.addWidget(filterFactory.getFilterWidgetFromData(filterData)); } }
@Override public void error(String tag, String message, Throwable exception) { if (logLevel >= LOG_ERROR) { checkLogLabel(); log.setText(log.getText() + "\n" + tag + ": " + message + "\n" + exception.getMessage()); log.setCursorPos(log.getText().length() - 1); System.err.println(tag + ": " + message + "\n" + exception.getMessage() + "\n"); System.out.println(getStackTrace(exception)); } }
/** * Instantiates a new mobile select painel. * * @param rpcServiceArg the rpc service that this panel will use */ public SendSMSPanel(AnacomServiceAsync rpcServiceArg, Anacom anacom) { GWT.log("presentationserver.client.view.SelectMobilePanel::constructor()"); this.rpcService = rpcServiceArg; this.anacom = anacom; this.mainPanel = new VerticalPanel(); this.title = new Label("Send SMS"); this.sendSMSPanel = new HorizontalPanel(); this.sendSMSButton = new Button("Send SMS"); this.toNumberTextBox = new TextBox(); this.messageSMSTextBox = new TextArea(); // Set label style this.title.setStyleName("h1"); toNumberTextBox.setText("Enter the destination cellphone number"); messageSMSTextBox.setText("Enter the desired message"); // Add to panel this.mainPanel.add(title); this.mainPanel.add(sendSMSPanel); sendSMSPanel.add(toNumberTextBox); sendSMSPanel.add(messageSMSTextBox); sendSMSPanel.add(sendSMSButton); // Add the container panel to super painel this.add(this.mainPanel); this.toNumberTextBox.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { setToNumberTextBox(""); } }); this.messageSMSTextBox.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { setMessageSMSTextBox(""); } }); getSendSMSButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { sendSMS(); } }); }
public DbMessage(MessageType messageType, String messageInfo) { this.messageType = messageType; setWidget(uiBinder.createAndBindUi(this)); initMessage(); textArea.setText(messageInfo); this.setModal(true); this.setAnimationEnabled(true); // this.setGlassEnabled(true); this.center(); this.show(); }
/** Refreshes the debug text areas if the text in the rich text area has been changed. */ public void refreshData() { String currentHTML = editor.getRichTextEditor().getTextArea().getHTML(); if (previousHTML.equals(currentHTML)) { return; } previousHTML = currentHTML; dirtyHTMLTextArea.setText(currentHTML); cleaner.clean( currentHTML, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { cleanHTMLTextArea.setText(caught.toString()); } @Override public void onSuccess(String result) { cleanHTMLTextArea.setText(result); } }); converter.fromHTML( currentHTML, editor.getConfig().getSyntax(), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { wikiTextArea.setText(caught.toString()); } @Override public void onSuccess(String result) { wikiTextArea.setText(result); } }); converter.fromHTML( currentHTML, "event/1.0", new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { eventsTextArea.setText(caught.toString()); } @Override public void onSuccess(String result) { eventsTextArea.setText(result); } }); }
/** * Use this constructor only when you are subclassing TextAreaFieldWidget and need the special * case provided by the willEncapsulate parameter. * * @param fieldDef the FieldDef that is the Model for this TextAreaFieldWidget * @param willEncapsulate this parameter should be true only if you are subclassing text box and * plan to wrap it in another widget. If true, you must call initWidget() in the subclass and * TextAreaFieldWidget will not call it. This parameter is rarely used */ protected TextAreaInputField(FieldDef fieldDef, boolean willEncapsulate) { _fieldDef = fieldDef; _textArea = new TextArea(); _textArea.setSize("250px", "135px"); addHandlers(); if (!willEncapsulate) initWidget(_textArea); _textArea.setTitle(_fieldDef.getShortDesc()); if (_fieldDef.getDefaultValueAsString() != null) { _textArea.setText(_fieldDef.getDefaultValueAsString()); } }
@Override public void clear() { rewardsName.setTitle(""); /* 增加请选择下拉选项 */ // rewardsType.setSelectedIndex(0); rewardsDefinition.setText(""); standard.setText(""); startTime.setValue(null); peopleSizeLimit.setValue(""); frequency = null; settingText.setText(""); autoCbx.setValue(false, true); specialCbx.setValue(false, true); birthRadio.setValue(false, true); // nextPublicTime.setValue(null); nextRewardsTime.setValue(null); // lastRewardsTime.setText(""); // 清空设定规则为为设定 // setIsAmountLevel("未设定"); }
/* (non-Javadoc) * @see org.ebayopensource.turmeric.policy.adminui.client.view.policy.PolicyCreateView#clear() */ @Override public void clear() { super.clear(); for (int i = 0; i < extraFieldsGrid.getRowCount(); i++) { Widget widget = extraFieldsGrid.getWidget(i, 1); if (widget != null && widget instanceof CheckBox) { ((CheckBox) widget).setValue(false); } else if (widget != null && widget instanceof TextBox) { ((TextBox) widget).setText(""); } else if (widget != null && widget instanceof TextArea) { ((TextArea) widget).setText(""); } else if (widget != null && widget instanceof ListBox) { ((ListBox) widget).setSelectedIndex(-1); } } }
public XmlFileWidget(final RuleAsset asset, final RuleViewer viewer) { super(asset, viewer); this.asset = asset; text = new TextArea(); text.setHeight("300px"); text.setWidth("600px"); if (asset.content != null) { RuleContentText xmlContent = (RuleContentText) asset.content; text.setText(xmlContent.content); } layout.addRow(text); // TODO: add tree representation of the document }
/* (non-Javadoc) * @see org.ebayopensource.turmeric.policy.adminui.client.view.policy.PolicyCreateView#initializeExtraFields() */ protected void initializeExtraFields() { rlExtraFields = PolicyExtraFieldsUtil.getRLExtraFields(); extraFieldsGrid = new Grid(rlExtraFields.size() + 1, 3); for (ExtraField extraField : rlExtraFields) { extraFieldsGrid.setWidget(extraField.getOrder(), 0, new Label(extraField.getLabelName())); if (extraField.getFieldType() != null && "CheckBox".equalsIgnoreCase(extraField.getFieldType())) { CheckBox chBox = new CheckBox(); chBox.setEnabled(true); extraField.setCheckBox(chBox); extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getCheckBox()); } else if (extraField.getFieldType() != null && "TextBox".equalsIgnoreCase(extraField.getFieldType())) { TextBox txBox = new TextBox(); txBox.setText(""); txBox.setWidth(extraField.getLenghtBox()); extraField.setTextBox(txBox); extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getTextBox()); } else if (extraField.getFieldType() != null && "TextArea".equalsIgnoreCase(extraField.getFieldType())) { TextArea txArea = new TextArea(); txArea.setText(""); txArea.setWidth(extraField.getLenghtBox()); // txArea.setEnabled(false); extraField.setTextArea(txArea); extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getTextArea()); } else if (extraField.getFieldType() != null && "ListBox".equalsIgnoreCase(extraField.getFieldType())) { ListBox lsBox = new ListBox(); for (int i = 0; i < extraField.getListBox().getItemCount(); i++) { lsBox.addItem(extraField.getListBox().getItemText(i)); } extraField.setListBox(lsBox); extraFieldsGrid.setWidget(extraField.getOrder(), 1, extraField.getListBox()); } } }
public void insertText(final String text, final boolean isSpecialPaste) { String textToInsert = text; final int i = textArea.getCursorPos(); final String left = textArea.getText().substring(0, i); final String right = textArea.getText().substring(i, textArea.getText().length()); int cursorPosition = left.toCharArray().length; if (isSpecialPaste) { int p = text.indexOf("|"); if (p > -1) { cursorPosition += p; textToInsert = textToInsert.replaceAll("\\|", ""); } } textArea.setFocus(true); textArea.setText(left + textToInsert + right); textArea.setCursorPos(cursorPosition); }
private void showVersionInfo(String json) { DefaultWindow window = new DefaultWindow("Management Model Versions"); window.setWidth(480); window.setHeight(360); window.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) {} }); TextArea textArea = new TextArea(); textArea.setStyleName("fill-layout"); textArea.setText(json); window.setWidget(textArea); window.setGlassEnabled(true); window.center(); }
private void setWidgetValuesFromEditElement(MapDrawingObject element) { selectMsg.setVisible(false); editPanel.setVisible(true); editLabel.setText("Editing: " + element.getType()); code.setText(editElement.getCode()); description.setText(editElement.getDescription()); if (element.getType().equals("point")) { pointFields.setVisible(true); zone.setText(editElement.getZone()); easting.setText(editElement.getEasting()); northing.setText(editElement.getNorthing()); height.setText(editElement.getHeight()); latitude.setText(editElement.getLatitude()); longitude.setText(editElement.getLongitude()); } else { pointFields.setVisible(false); } }
public DefaultRuleContentWidget(RuleAsset a, int visibleLines) { asset = a; data = (RuleContentText) asset.getContent(); if (data.content == null) { data.content = ""; } text = new TextArea(); text.setWidth("100%"); text.setVisibleLines((visibleLines == -1) ? 16 : visibleLines); text.setText(data.content); text.getElement().setAttribute("spellcheck", "false"); // NON-NLS text.setStyleName("default-text-Area"); // NON-NLS text.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { data.content = text.getText(); makeDirty(); } }); text.addKeyDownHandler( new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) { int pos = text.getCursorPos(); insertText("\t"); text.setCursorPos(pos + 1); text.cancelKey(); text.setFocus(true); } } }); initWidget(text); }
void insertText(String ins, boolean isSpecialPaste) { text.setFocus(true); int i = text.getCursorPos(); String left = text.getText().substring(0, i); String right = text.getText().substring(i, text.getText().length()); int cursorPosition = left.toCharArray().length; if (isSpecialPaste) { int p = ins.indexOf("|"); if (p > -1) { cursorPosition += p; ins = ins.replaceAll("\\|", ""); } } text.setText(left + ins + right); this.data.content = text.getText(); text.setCursorPos(cursorPosition); }
public void createCritRefTextArea( final FlowPanel flowPanel, final ScrollPanel scrollPanel, String critRefStringBuilder) { final TextArea critReftextArea = new TextArea(); critReftextArea.setStyleName("textarea_noborder"); critReftextArea.addStyleName("criteriaRef_background"); critReftextArea.setText(critRefStringBuilder); flowPanel.add(critReftextArea); critReftextArea.setReadOnly(true); critReftextArea.setWidth("100%"); critReftextArea.setHeight("100%"); critReftextArea.setVisibleLines(critRefStringBuilder.split("\\r?\\n").length + 1); critReftextArea.setTitle("Double click to go see the entry."); critReftextArea.addDoubleClickHandler( new DoubleClickHandler() { @Override public void onDoubleClick(DoubleClickEvent event) { handleTextAreaClick(flowPanel, event, critReftextArea, scrollPanel); } }); }
/** * Creates a new debugger for the given editor. * * @param editor The WYSIWYG editor being debugged. */ public WysiwygEditorDebugger(WysiwygEditor editor) { this.editor = editor; FlowPanel panel = new FlowPanel(); panel.setWidth("100%"); panel.add(editor.getUI()); String width = "400px"; String height = "220px"; dirtyHTMLTextArea = new TextArea(); dirtyHTMLTextArea.setWidth(width); dirtyHTMLTextArea.setHeight(height); panel.add(dirtyHTMLTextArea); cleanHTMLTextArea = new TextArea(); cleanHTMLTextArea.setWidth(width); cleanHTMLTextArea.setHeight(height); panel.add(cleanHTMLTextArea); wikiTextArea = new TextArea(); wikiTextArea.setWidth(width); wikiTextArea.setHeight(height); panel.add(wikiTextArea); eventsTextArea = new TextArea(); eventsTextArea.setWidth(width); eventsTextArea.setHeight(height); panel.add(eventsTextArea); // get the transformed HTML Content dirtyHTMLTextArea.setText(editor.getRichTextEditor().getTextArea().getHTML()); initWidget(panel); timer = new Timer(); timer.addTimerListener(this); timer.scheduleRepeating(4000); }