Put back ORG since it's such a de facto standard non-standard attribute

git-svn-id: https://zxing.googlecode.com/svn/trunk@1722 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2011-03-06 10:01:18 +00:00
parent ff5a939fbf
commit 0aeafb7fbd

View file

@ -30,14 +30,14 @@ import com.google.gwt.user.client.ui.Widget;
public class ContactInfoGenerator implements GeneratorSource { public class ContactInfoGenerator implements GeneratorSource {
Grid table = null; Grid table = null;
TextBox name = new TextBox(); TextBox name = new TextBox();
//TextBox company = new TextBox(); TextBox company = new TextBox();
TextBox tel = new TextBox(); TextBox tel = new TextBox();
TextBox url = new TextBox(); TextBox url = new TextBox();
TextBox email = new TextBox(); TextBox email = new TextBox();
TextBox address = new TextBox(); TextBox address = new TextBox();
TextBox address2 = new TextBox(); TextBox address2 = new TextBox();
TextBox memo = new TextBox(); TextBox memo = new TextBox();
TextBox[] widgets = {name, tel, url, email, address, address2, memo}; TextBox[] widgets = {name, company, tel, url, email, address, address2, memo};
public ContactInfoGenerator(ChangeListener changeListener, public ContactInfoGenerator(ChangeListener changeListener,
KeyPressHandler keyListener) { KeyPressHandler keyListener) {
@ -53,7 +53,7 @@ public class ContactInfoGenerator implements GeneratorSource {
public String getText() throws GeneratorException { public String getText() throws GeneratorException {
String name = getNameField(); String name = getNameField();
//String company = getCompanyField(); String company = getCompanyField();
String tel = getTelField(); String tel = getTelField();
String url = getUrlField(); String url = getUrlField();
String email = getEmailField(); String email = getEmailField();
@ -64,16 +64,16 @@ public class ContactInfoGenerator implements GeneratorSource {
// Build the output with obtained data. // Build the output with obtained data.
// note that some informations may just be "" if they were not specified. // note that some informations may just be "" if they were not specified.
//return getVCard(name, company, tel, url, email, address, memo); //return getVCard(name, company, tel, url, email, address, memo);
return getMeCard(name, tel, url, email, address, address2, memo); return getMeCard(name, company, tel, url, email, address, address2, memo);
} }
private String getMeCard(String name, String tel, String url, private String getMeCard(String name, String company, String tel, String url,
String email, String address, String address2, String memo) { String email, String address, String address2, String memo) {
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();
output.append("MECARD:"); output.append("MECARD:");
name = name.replace(",", ""); // remove commas -- reserved char in MECARD name = name.replace(",", ""); // remove commas -- reserved char in MECARD
output.append("N:").append(name).append(';'); output.append("N:").append(name).append(';');
//maybeAppend(output, "ORG:", company); // Not standard; don't generate maybeAppend(output, "ORG:", company); // Not standard; don't generate
maybeAppend(output, "TEL:", tel); maybeAppend(output, "TEL:", tel);
maybeAppend(output, "URL:", url); maybeAppend(output, "URL:", url);
maybeAppend(output, "EMAIL:", email); maybeAppend(output, "EMAIL:", email);
@ -141,9 +141,9 @@ public class ContactInfoGenerator implements GeneratorSource {
return parseTextField("Name", name); return parseTextField("Name", name);
} }
//private String getCompanyField() throws GeneratorException { private String getCompanyField() throws GeneratorException {
// return parseTextField("Company", company); return parseTextField("Company", company);
//} }
private String getTelField() throws GeneratorException { private String getTelField() throws GeneratorException {
String input = Validators.filterNumber(tel.getText()); String input = Validators.filterNumber(tel.getText());
@ -198,18 +198,20 @@ public class ContactInfoGenerator implements GeneratorSource {
table.setText(0, 0, "Name"); table.setText(0, 0, "Name");
table.setWidget(0, 1, name); table.setWidget(0, 1, name);
table.setText(1, 0, "Phone number"); table.setText(1, 0, "Company");
table.setWidget(1, 1, tel); table.setWidget(1, 1, company);
table.setText(2, 0, "Email"); table.setText(2, 0, "Phone number");
table.setWidget(2, 1, email); table.setWidget(2, 1, tel);
table.setText(3, 0, "Address"); table.setText(3, 0, "Email");
table.setWidget(3, 1, address); table.setWidget(3, 1, email);
table.setText(4, 0, "Address 2"); table.setText(4, 0, "Address");
table.setWidget(4, 1, address2); table.setWidget(4, 1, address);
table.setText(5, 0, "Website"); table.setText(5, 0, "Address 2");
table.setWidget(5, 1, url); table.setWidget(5, 1, address2);
table.setText(6, 0, "Memo"); table.setText(6, 0, "Website");
table.setWidget(6, 1, memo); table.setWidget(6, 1, url);
table.setText(7, 0, "Memo");
table.setWidget(7, 1, memo);
name.addStyleName(StylesDefs.INPUT_FIELD_REQUIRED); name.addStyleName(StylesDefs.INPUT_FIELD_REQUIRED);
return table; return table;
@ -217,7 +219,7 @@ public class ContactInfoGenerator implements GeneratorSource {
public void validate(Widget widget) throws GeneratorException { public void validate(Widget widget) throws GeneratorException {
if (widget == name) getNameField(); if (widget == name) getNameField();
//if (widget == company) getCompanyField(); if (widget == company) getCompanyField();
if (widget == tel) getTelField(); if (widget == tel) getTelField();
if (widget == email) getEmailField(); if (widget == email) getEmailField();
if (widget == address) getAddressField(); if (widget == address) getAddressField();