diff --git a/src/BusinessCardManagement.java b/src/BusinessCardManagement.java index 8bd7add..13c1da6 100644 --- a/src/BusinessCardManagement.java +++ b/src/BusinessCardManagement.java @@ -94,8 +94,22 @@ } public void updateFromState3(String scId, String wid, int state, String company_, String representative_, String position_, String establish_, String address1_, String address2_, String business1_, String business2_, String companydetail_, String URL_, String contactPerson1_, String position1_, String tel1_, String email1_, String contactPerson2_, String position2_, String tel2_, String email2_, String contactPerson3_, String position3_, String tel3_, String email3_, String contactPerson4_, String position4_, String tel4_, String email4_) { Map temp_if16; - if ((((state==0)&&!company_.equals(""))&&this.value.containsKey(company_))) { - this.value.put(company_,new BusinessCardManagementElement(representative_, position_, establish_, address1_, address2_, business1_, business2_, companydetail_, URL_, contactPerson1_, position1_, tel1_, email1_, contactPerson2_, position2_, tel2_, email2_, contactPerson3_, position3_, tel3_, email3_, contactPerson4_, position4_, tel4_, email4_)); + if ((state==0)&&!company_.isEmpty()) { + String w2d109ad3739d4744a1874ac179fc38b9 = this.w2d109ad3739d4744a1874ac179fc38b9.getValue(); + String companyList = this.companyList.getValue(); + this.widget = screenTemplates.getScreenTemplate(companyList).getWidgets1().getWidget1(w2d109ad3739d4744a1874ac179fc38b9); + String prevCompany = this.widget.getText(); + if (!company_.equals(prevCompany)) { + if (this.value.containsKey(company_)) { + JPanel mainPanel = screen.getPresenter().getMainPanel(); + JOptionPane.showMessageDialog(mainPanel, "会社名は既に存在します。"); + } else { + this.value.remove(prevCompany); + this.value.put(company_, new BusinessCardManagementElement(representative_, position_, establish_, address1_, address2_, business1_, business2_, companydetail_, URL_, contactPerson1_, position1_, tel1_, email1_, contactPerson2_, position2_, tel2_, email2_, contactPerson3_, position3_, tel3_, email3_, contactPerson4_, position4_, tel4_, email4_)); + } + } else { + this.value.put(company_, new BusinessCardManagementElement(representative_, position_, establish_, address1_, address2_, business1_, business2_, companydetail_, URL_, contactPerson1_, position1_, tel1_, email1_, contactPerson2_, position2_, tel2_, email2_, contactPerson3_, position3_, tel3_, email3_, contactPerson4_, position4_, tel4_, email4_)); + } temp_if16 = this.value; } else { temp_if16 = this.value; diff --git a/src/CurScreen.java b/src/CurScreen.java index 783832e..1beb3cf 100644 --- a/src/CurScreen.java +++ b/src/CurScreen.java @@ -1,3 +1,4 @@ +import javax.swing.*; import java.util.*; public class CurScreen { @@ -55,12 +56,22 @@ ScreenTemplate screenTemplate = screenTemplates.getScreenTemplate(this.value); this.screen.updateFromCurScreen(this.value, screenTemplate.getValue()); } - public void updateFromState5(String scId, String wid, int state, String company_, String representative_, String position_, String establish_, String address1_, String address2_, String business1_, String business2_, String companydetail_, String URL_, Map> businessCardManagement) { + public void updateFromState5(String scId, String wid, int state, String company_, String representative_, String position_, String establish_, String address1_, String address2_, String business1_, String business2_, String companydetail_, String URL_, Map> businessCardManagement, String companyList, String w2d109ad3739d4744a1874ac179fc38b9) { String temp_if7; if ((state==0)) { String temp_if6; - if ((!company_.equals("")&&businessCardManagement.containsKey(company_))) { - temp_if6 = "企業一覧"; + if (!company_.isEmpty()) { + Widget1 widget = screenTemplates.getScreenTemplate(companyList).getWidgets1().getWidget1(w2d109ad3739d4744a1874ac179fc38b9); + String prevCompany = widget.getText(); + if (!company_.equals(prevCompany)) { + if (businessCardManagement.containsKey(prevCompany)) { + temp_if6 = this.value; + } else { + temp_if6 = "企業一覧"; + } + } else { + temp_if6 = "企業一覧"; + } } else { temp_if6 = this.value; } diff --git a/src/Widget.java b/src/Widget.java index e753011..6f6067b 100644 --- a/src/Widget.java +++ b/src/Widget.java @@ -140,6 +140,8 @@ } public void textEvent(String wid, String nextText) { this.text = nextText; + this.widget = screenTemplates.getScreenTemplate(curScreen.getValue()).getWidgets1().getWidget1(wid); + this.widget.updateTextFromText(wid, wid, wid, this.text, curScreen.getValue()); } public void mouseEvent(String wid, int nextState) { this.state = nextState; diff --git a/src/Widget1.java b/src/Widget1.java index 1e6ea31..0e70836 100644 --- a/src/Widget1.java +++ b/src/Widget1.java @@ -395,7 +395,8 @@ this.widget1 = screen.getWidgets().getWidget(email4); String email4_ = this.widget1.getText(); Map> businessCardManagement = this.businessCardManagement.getValue(); - this.curScreen.updateFromState5(curScreen, wid, this.state, company_, representative_, position_, establish_, address1_, address2_, business1_, business2_, companydetail_, URL_, businessCardManagement); + String w2d109ad3739d4744a1874ac179fc38b9 = this.w2d109ad3739d4744a1874ac179fc38b9.getValue(); + this.curScreen.updateFromState5(curScreen, wid, this.state, company_, representative_, position_, establish_, address1_, address2_, business1_, business2_, companydetail_, URL_, businessCardManagement, "企業一覧", w2d109ad3739d4744a1874ac179fc38b9); } if ((curScreen.equals("登録画面1")&&wid.equals("wf10ab1752fe44c4d97ffb2ca2afdeba0"))) { // 「一覧へ戻る」ボタン this.curScreen.updateFromState(curScreen, wid, this.state);