diff --git a/src/BusinessCardManagement.java b/src/BusinessCardManagement.java index cc0e717..8d8ee08 100644 --- a/src/BusinessCardManagement.java +++ b/src/BusinessCardManagement.java @@ -35,7 +35,7 @@ public void updateFromState(String scId, String wid, int state, String company_, String company, String representative_, String representative, String position_, String position, String establishment_, String establishment, String address1_, String address1, String address2_, String address2, String businessdescription1_, String businessdescription1, String businessdescription2_, String businessdescription2, String companyoverview_, String companyoverview, String URL_, String URL) { Map temp_if15; if ((((state==0)&&!company_.equals(""))&&!(this.value.containsKey(company_)))) { - this.value.put(company_,new BusinessCardManagementElement(address2_, address1_, establishment_, position_, businessdescription1_, representative_, URL_, companyoverview_, businessdescription2_)); + this.value.put(company_,new BusinessCardManagementElement(representative_, position_, establishment_, address1_, address2_, businessdescription1_, businessdescription2_, companyoverview_, URL_)); temp_if15 = this.value; } else { temp_if15 = this.value; @@ -57,7 +57,7 @@ public void updateFromState2(String scId, String wid, int state, String company_, String representative_, String position_, String establishment_, String address1_, String address2_, String businessdescription1_, String businessdescription2_, String companyoverview_, String URL_) { Map temp_if14; if ((((state==0)&&!company_.equals(""))&&!(this.value.containsKey(company_)))) { - this.value.put(company_,new BusinessCardManagementElement(address2_, address1_, establishment_, position_, businessdescription1_, representative_, URL_, companyoverview_, businessdescription2_)); + this.value.put(company_,new BusinessCardManagementElement(representative_, position_, establishment_, address1_, address2_, businessdescription1_, businessdescription2_, companyoverview_, URL_)); temp_if14 = this.value; } else { temp_if14 = this.value; @@ -79,7 +79,7 @@ public void updateFromState3(String scId, String wid, int state, String editcompany_, String editcompany, String editrepresentative_, String editrepresentative, String editposition_, String editposition, String editestablish_, String editestablish, String editaddress1_, String editaddress1, String editaddress2_, String editaddress2, String editbusiness1_, String editbusiness1, String editbusiness2_, String editbusiness2, String editcompanydetail_, String editcompanydetail, String editURL_, String editURL) { Map temp_if16; if ((((state==0)&&!editcompany_.equals(""))&&this.value.containsKey(editcompany_))) { - this.value.put(editcompany_,new BusinessCardManagementElement(editaddress2_, editaddress1_, editestablish_, editposition_, editbusiness1_, editrepresentative_, editURL_, editcompanydetail_, editbusiness2_)); + this.value.put(editcompany_,new BusinessCardManagementElement(editrepresentative_, editposition_, editestablish_, editaddress1_, editaddress2_, editbusiness1_, editbusiness2_, editcompanydetail_, editURL_)); temp_if16 = this.value; } else { temp_if16 = this.value; @@ -99,7 +99,7 @@ this.widget.updateDataFromBusinessCardManagement2(scId, wid, this.getValue(), w4ca84254d30c423ab8e449171a5b5123, searchScreen); } public void addBusinessCardManagement(String scId, String wid, String representative, String position, String establishment, String address1, String address2, String businessDescription1, String businessDescription2, String companyOverview, String URL, String companyName) { - this.value.put(companyName,new BusinessCardManagementElement(address2, address1, establishment, position, businessDescription1, representative, URL, companyOverview, businessDescription2)); + this.value.put(companyName,new BusinessCardManagementElement(representative, position, establishment, address1, address2, businessDescription1, businessDescription2, companyOverview, URL)); String searchCriteriaScreen = this.searchCriteriaScreen.getValue(); String result = this.result.getValue(); this.widget = screenTemplates.getScreenTemplate(searchCriteriaScreen).getWidgets1().getWidget1(result); diff --git a/src/BusinessCardManagementElement.java b/src/BusinessCardManagementElement.java index 354b98a..f6f651f 100644 --- a/src/BusinessCardManagementElement.java +++ b/src/BusinessCardManagementElement.java @@ -2,25 +2,36 @@ public class BusinessCardManagementElement { private String representative; - private String URL; - private String address1; - private String companyOverview; + private String position; + private String establishment; + private String address1; private String address2; - private String position; private String businessDescription2; private String businessDescription1; - private String establishment; + private String companyOverview; + private String URL; + public BusinessCardManagementElement(String representative, String position, String establishment, String address1, String address2, String businessDescription1, String businessDescription2, String companyOverview, String URL) { + this.representative = representative; + this.position = position; + this.establishment = establishment; + this.address1 = address1; + this.address2 = address2; + this.businessDescription1 = businessDescription1; + this.businessDescription2 = businessDescription2; + this.companyOverview = companyOverview; + this.URL = URL; + } public Map getValue() { Map temp_nil0 = new HashMap<>(); - temp_nil0.put("address2",this.getAddress2()); - temp_nil0.put("businessDescription1",this.getBusinessDescription1()); - temp_nil0.put("companyOverview",this.getCompanyOverview()); - temp_nil0.put("establishment",this.getEstablishment()); - temp_nil0.put("businessDescription2",this.getBusinessDescription2()); + temp_nil0.put("代表者",this.getRepresentative()); + temp_nil0.put("役職",this.getPosition()); + temp_nil0.put("設立",this.getEstablishment()); + temp_nil0.put("住所1",this.getAddress1()); + temp_nil0.put("住所2",this.getAddress2()); + temp_nil0.put("事業内容1",this.getBusinessDescription1()); + temp_nil0.put("事業内容2",this.getBusinessDescription2()); + temp_nil0.put("会社概要",this.getCompanyOverview()); temp_nil0.put("URL",this.getURL()); - temp_nil0.put("address1",this.getAddress1()); - temp_nil0.put("position",this.getPosition()); - temp_nil0.put("representative",this.getRepresentative()); return temp_nil0; } public String getRepresentative() { @@ -29,63 +40,52 @@ public void changeRepresentativeOfBusinessCardManagement(String companyName, String newRepresentative) { this.representative = newRepresentative; } - public String getURL() { - return this.URL; - } - public void changeURLOfBusinessCardManagement(String companyName, String newURL) { - this.URL = newURL; - } + public String getPosition() { + return this.position; + } + public void changePositionOfBusinessCardManagement(String companyName, String newPosition) { + this.position = newPosition; + } + public String getEstablishment() { + return this.establishment; + } + public void changeEstablishmentOfBusinessCardManagement(String companyName, String newEstablishment) { + this.establishment = newEstablishment; + } public String getAddress1() { return this.address1; } public void changeAddress1OfBusinessCardManagement(String companyName, String newAddress1) { this.address1 = newAddress1; } - public String getCompanyOverview() { - return this.companyOverview; - } - public void changeCompanyOverviewOfBusinessCardManagement(String companyName, String newCompanyOverview) { - this.companyOverview = newCompanyOverview; - } public String getAddress2() { return this.address2; } public void changeAddress2OfBusinessCardManagement(String companyName, String newAddress2) { this.address2 = newAddress2; } - public String getPosition() { - return this.position; - } - public void changePositionOfBusinessCardManagement(String companyName, String newPosition) { - this.position = newPosition; - } + public String getBusinessDescription1() { + return this.businessDescription1; + } + public void changeBusinessDescription1OfBusinessCardManagement(String companyName, String newBusinessDescription1) { + this.businessDescription1 = newBusinessDescription1; + } public String getBusinessDescription2() { return this.businessDescription2; } public void changeBusinessDescription2OfBusinessCardManagement(String companyName, String newBusinessDescription2) { this.businessDescription2 = newBusinessDescription2; } - public String getBusinessDescription1() { - return this.businessDescription1; - } - public void changeBusinessDescription1OfBusinessCardManagement(String companyName, String newBusinessDescription1) { - this.businessDescription1 = newBusinessDescription1; - } - public String getEstablishment() { - return this.establishment; - } - public void changeEstablishmentOfBusinessCardManagement(String companyName, String newEstablishment) { - this.establishment = newEstablishment; - } - public BusinessCardManagementElement(String address2, String address1, String establishment, String position, String businessDescription1, String representative, String uRL, String companyOverview, String businessDescription2) { - this.address2 = address2; - this.address1 = address1; - this.establishment = establishment; - this.position = position; - this.businessDescription1 = businessDescription1; - this.representative = representative; - this.URL = uRL; - this.companyOverview = companyOverview; - this.businessDescription2 = businessDescription2; - } + public String getCompanyOverview() { + return this.companyOverview; + } + public void changeCompanyOverviewOfBusinessCardManagement(String companyName, String newCompanyOverview) { + this.companyOverview = newCompanyOverview; + } + public String getURL() { + return this.URL; + } + public void changeURLOfBusinessCardManagement(String companyName, String newURL) { + this.URL = newURL; + } } \ No newline at end of file diff --git a/src/ScreenTemplates.java b/src/ScreenTemplates.java index 7a21c48..3a86ac7 100644 --- a/src/ScreenTemplates.java +++ b/src/ScreenTemplates.java @@ -6,31 +6,31 @@ private Map value = new HashMap<>(); { Map temp_json5 = new HashMap<>(); - temp_json5.put("representative", "_"); - temp_json5.put("担当者1", "_"); - temp_json5.put("position", "_"); - temp_json5.put("address2", "_"); - temp_json5.put("address1", "_"); - temp_json5.put("電話番号1", "_"); - temp_json5.put("establishment", "_"); - temp_json5.put("businessDescription1", "_"); - temp_json5.put("companyOverview", "_"); - temp_json5.put("URL", "_"); - temp_json5.put("businessDescription2", "_"); + temp_json5.put("代表者", "_"); + temp_json5.put("役職", "_"); + temp_json5.put("設立", "_"); + temp_json5.put("住所1", "_"); + temp_json5.put("住所2", "_"); + temp_json5.put("事業内容1", "_"); + temp_json5.put("事業内容2", "_"); + temp_json5.put("会社概要", "_"); + temp_json5.put("URL", "_"); + temp_json5.put("担当者1", "_"); + temp_json5.put("電話番号1", "_"); Map temp_json4 = new HashMap<>(); temp_json4.put("_", temp_json5); List temp_list1 = new ArrayList<>(); + temp_list1.add("代表者"); + temp_list1.add("役職"); + temp_list1.add("設立"); + temp_list1.add("住所1"); + temp_list1.add("住所2"); + temp_list1.add("事業内容1"); + temp_list1.add("事業内容2"); + temp_list1.add("会社概要"); + temp_list1.add("URL"); + temp_list1.add("担当者1"); temp_list1.add("電話番号1"); - temp_list1.add("担当者1"); - temp_list1.add("URL"); - temp_list1.add("会社概要"); - temp_list1.add("事業内容2"); - temp_list1.add("事業内容1"); - temp_list1.add("住所2"); - temp_list1.add("住所1"); - temp_list1.add("設立"); - temp_list1.add("役職"); - temp_list1.add("代表者"); Map temp_json3 = new HashMap<>(); temp_json3.put("type", "table"); temp_json3.put("text", ""); @@ -122,27 +122,27 @@ temp_json17.put("width", 160); temp_json17.put("height", 38); Map temp_json20 = new HashMap<>(); - temp_json20.put("address2", "_"); - temp_json20.put("address1", "_"); - temp_json20.put("establishment", "_"); - temp_json20.put("position", "_"); - temp_json20.put("businessDescription1", "_"); - temp_json20.put("representative", "_"); - temp_json20.put("companyOverview", "_"); + temp_json20.put("代表者", "_"); + temp_json20.put("役職", "_"); + temp_json20.put("設立", "_"); + temp_json20.put("住所1", "_"); + temp_json20.put("住所2", "_"); + temp_json20.put("事業内容1", "_"); + temp_json20.put("事業内容2", "_"); + temp_json20.put("会社概要", "_"); temp_json20.put("URL", "_"); - temp_json20.put("businessDescription2", "_"); Map temp_json19 = new HashMap<>(); temp_json19.put("_", temp_json20); List temp_list2 = new ArrayList<>(); + temp_list2.add("代表者"); + temp_list2.add("役職"); + temp_list2.add("設立"); + temp_list2.add("住所1"); + temp_list2.add("住所2"); + temp_list2.add("事業内容1"); + temp_list2.add("事業内容2"); + temp_list2.add("会社概要"); temp_list2.add("URL"); - temp_list2.add("会社概要"); - temp_list2.add("事業内容2"); - temp_list2.add("事業内容1"); - temp_list2.add("住所2"); - temp_list2.add("住所1"); - temp_list2.add("設立"); - temp_list2.add("役職"); - temp_list2.add("代表者"); Map temp_json18 = new HashMap<>(); temp_json18.put("type", "table"); temp_json18.put("text", "table"); @@ -501,27 +501,27 @@ temp_json61.put("width", 229); temp_json61.put("height", 70); Map temp_json64 = new HashMap<>(); - temp_json64.put("address2", "_"); - temp_json64.put("address1", "_"); - temp_json64.put("establishment", "_"); - temp_json64.put("position", "_"); - temp_json64.put("businessDescription1", "_"); - temp_json64.put("representative", "_"); - temp_json64.put("companyOverview", "_"); + temp_json64.put("代表者", "_"); + temp_json64.put("役職", "_"); + temp_json64.put("設立", "_"); + temp_json64.put("住所1", "_"); + temp_json64.put("住所2", "_"); + temp_json64.put("事業内容1", "_"); + temp_json64.put("事業内容2", "_"); + temp_json64.put("会社概要", "_"); temp_json64.put("URL", "_"); - temp_json64.put("businessDescription2", "_"); Map temp_json63 = new HashMap<>(); temp_json63.put("_", temp_json64); List temp_list3 = new ArrayList<>(); + temp_list3.add("代表者"); + temp_list3.add("役職"); + temp_list3.add("設立"); + temp_list3.add("住所1"); + temp_list3.add("住所2"); + temp_list3.add("事業内容1"); + temp_list3.add("事業内容2"); + temp_list3.add("会社概要"); temp_list3.add("URL"); - temp_list3.add("会社概要"); - temp_list3.add("事業内容2"); - temp_list3.add("事業内容1"); - temp_list3.add("住所2"); - temp_list3.add("住所1"); - temp_list3.add("設立"); - temp_list3.add("役職"); - temp_list3.add("代表者"); Map temp_json62 = new HashMap<>(); temp_json62.put("type", "table"); temp_json62.put("text", ""); diff --git a/src/SwingPresenter.java b/src/SwingPresenter.java index 6a3d9d6..dab6412 100644 --- a/src/SwingPresenter.java +++ b/src/SwingPresenter.java @@ -2,6 +2,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.Component; @@ -16,6 +17,7 @@ private Main main; private JPanel mainPanel; private Map components = new HashMap<>(); + private String curScreenId; public SwingPresenter(Main main, JPanel mainPanel) { this.main = main; @@ -26,8 +28,8 @@ Map widgets = (Map) value.get("widgets"); boolean layout = (boolean) value.get("layout"); String prevScreenId = (String) prevValue.get("screenId"); - String screenId = (String) value.get("screenId"); - if (screenId.equals(prevScreenId)) { + curScreenId = (String) value.get("screenId"); + if (curScreenId.equals(prevScreenId)) { return; } mainPanel.removeAll(); @@ -363,7 +365,22 @@ } public void setTable(String scId, String wid, Map> data) { - } + if (!curScreenId.equals(scId)) return; + if (!(components.get(wid) instanceof JTable)) return; + JTable table = (JTable) components.get(wid); + TableModel tableModel = table.getModel(); + int i = 0; + for(String dataKey : data.keySet()) { + Map rowData = data.get(dataKey); + int j = 0; + for(String cellvalue : rowData.keySet()) { + tableModel.setValueAt(rowData.get(cellvalue), i, j); + j++; + } + i++; + } + table.setModel(tableModel); + } public void setLayout(boolean layout) { if (layout) {