java - Is it appropriate in the MVC pattern to use the builder pattern in the View part -
public class addformconcretebuilder extends formbuilder { private jdatechooser datechooser; private insertproducer producer; private dataobject dataobject; private jtextfield assetname; private jtextfield financial; private jtextfield location; private jcombobox custodian; private jcombobox type; private jcombobox retentionperiod; private jcombobox maintenancesched; private jcombobox confidentiality; private jcombobox integrity; private jcombobox availability; private jcombobox classification; private jbutton btnconfirm; private jbutton btnback; private arraylist<dataset> insertlist = new arraylist<dataset>(); private int assetid = generatenewassetid(); private panelmanager panelholder; /** * @wbp.parser.entrypoint */ @override public void buildcomponents() { panelholder = new panelmanager(); comboboxmanager combomodelcreator= new comboboxmanager(); myform.setsize(1200,644); myform.setlayout(null); custodian = new jcombobox(combomodelcreator.custodiandata()); custodian.setbounds(135, 130, 144, 20); myform.add(custodian); type = new jcombobox(combomodelcreator.typedata()); type.setbounds(135, 163, 144, 20); myform.add(type); retentionperiod = new jcombobox(combomodelcreator.retentionperioddata()); retentionperiod.setbounds(161, 230, 118, 20); myform.add(retentionperiod); maintenancesched = new jcombobox(combomodelcreator.maintenancescheddata()); maintenancesched.setbounds(161, 274, 118, 20); myform.add(maintenancesched); confidentiality = new jcombobox(combomodelcreator.confidentialitydata()); confidentiality.setbounds(161, 354, 118, 20); myform.add(confidentiality); integrity = new jcombobox(combomodelcreator.integritydata()); integrity.setbounds(161, 393, 118, 20); myform.add(integrity); availability = new jcombobox(combomodelcreator.availabilitydata()); availability.setbounds(161, 429, 118, 20); myform.add(availability); classification = new jcombobox(combomodelcreator.classificationdata()); classification.setbounds(161, 467, 118, 20); myform.add(classification); jlabel lblassetname = new jlabel("asset name : "); lblassetname.setbounds(24, 92, 101, 24); myform.add(lblassetname); assetname = new jtextfield(); assetname.setbounds(135, 94, 144, 20); myform.add(assetname); assetname.setcolumns(10); jlabel lblcustodian = new jlabel("custodian :"); lblcustodian.setbounds(24, 128, 75, 24); myform.add(lblcustodian); jlabel lbltype = new jlabel("type :"); lbltype.setbounds(24, 166, 60, 14); myform.add(lbltype); jlabel dateacquired = new jlabel("date acquired :"); dateacquired.setbounds(24, 191, 101, 24); myform.add(dateacquired); jlabel lblretentionperiod = new jlabel("retention period :"); lblretentionperiod.setbounds(24, 236, 118, 14); myform.add(lblretentionperiod); jlabel maintenanceschedlbl = new jlabel("maintenance schedule : "); maintenanceschedlbl.setbounds(24, 275, 153, 24); myform.add(maintenanceschedlbl); jlabel lblfinancial = new jlabel("financial : "); lblfinancial.setbounds(24, 310, 90, 24); myform.add(lblfinancial); financial = new jtextfield(); financial.setbounds(135, 309, 144, 20); myform.add(financial); financial.setcolumns(10); jlabel confidential = new jlabel("confidentiality: "); confidential.setbounds(24, 355, 127, 24); myform.add(confidential); jlabel lblintegrity = new jlabel("integrity :"); lblintegrity.setbounds(24, 399, 75, 14); myform.add(lblintegrity); jlabel lblavailability = new jlabel("availability : "); lblavailability.setbounds(22, 435, 103, 14); myform.add(lblavailability); jlabel lblclassification = new jlabel("classification :"); lblclassification.setbounds(24, 473, 118, 14); myform.add(lblclassification); jlabel lblstoragelocation = new jlabel("storage location :"); lblstoragelocation.setbounds(24, 507, 127, 14); myform.add(lblstoragelocation); location = new jtextfield(); location.setbounds(161, 501, 118, 20); myform.add(location); location.setcolumns(10); btnconfirm = new jbutton("confirm"); btnconfirm.setbounds(403, 524, 179, 49); btnconfirm.setfont(new font("dialog", font.bold, 22)); myform.add(btnconfirm); btnback = new jbutton("back"); btnback.setbounds(629, 524, 180, 49); btnback.setfont(new font("dialog", font.bold, 22)); myform.add(btnback); datechooser = new jdatechooser(); datechooser.setbounds(143, 191, 136, 20); myform.add(datechooser); }
this sample concrete builder pattern used view. appropriate since builder not view? i'm still newbie regards design patterns. sorry that. anyway!
i'd builder kind of thing use in role of view.
it's not question asking though. design patterns exist find solutions specific problems , discuss them others using common vocabulary. if code follows oop principles such coherence, consistency, etc., , easy understand , maintain, doesn't matter whether code strictly meets definition of particular named design pattern or other.
Comments
Post a Comment