public AuditorDialog(JFrame frame, String activityID) { super(frame, true); setUndecorated(true); setLayout(new BorderLayout()); setResizable(true); AuditorPane auditorPane = new AuditorPane( activityID, MenuSingleton.isSupplier() ? MenuSingleton.getSelectedEnterprise() : MenuSingleton.getEnterprise()); add(auditorPane, BorderLayout.CENTER); // Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getPreferredSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); }
protected void doInsert() { try { if (!MenuSingleton.isSupplier()) { EnterpriseCellDao daoEC = (EnterpriseCellDao) dataSource.getCurrentRecord(); daoEC.enterpriseID.setLinkKey(); daoEC.enterpriseID.setValueAsObject(MenuSingleton.getEnterprise()); dataSource.reLinkAttrs(); } super.doInsert(); } catch (DataSourceException ex) { ex.printStackTrace(); } }
public AuditPlanForm() { master = new DataSourceRMI("AuditPlan"); master.setUrl("pt.inescporto.siasoft.go.auditor.ejb.session.AuditPlan"); if (!MenuSingleton.isSupplier()) { Vector binds = new Vector(); binds.add(new TplString(MenuSingleton.getEnterprise())); try { master.setLinkCondition("fkEnterpriseID = ?", binds); } catch (DataSourceException ex) { } } DataSourceRMI dsAuditPlanActions = new DataSourceRMI("AuditPlanActions"); dsAuditPlanActions.setUrl("pt.inescporto.siasoft.go.auditor.ejb.session.AuditPlanActions"); DSRelation aaRelation = new DSRelation("AuditPlanAuditPlanActions"); aaRelation.setMaster(master); aaRelation.setDetail(dsAuditPlanActions); aaRelation.addKey(new RelationKey("auditPlanID", "auditPlanID")); try { master.addDataSourceLink(aaRelation); } catch (DataSourceException ex) { ex.printStackTrace(); } setDataSource(master); try { jbInit(); } catch (Exception ex) { ex.printStackTrace(); } allHeaders = new String[] { res.getString("label.code"), res.getString("auditPlan.label.scope"), res.getString("auditPlan.label.propose"), res.getString("auditPlan.label.periodicity"), res.getString("auditPlan.label.auditType"), res.getString("auditPlan.label.nextAuditDate"), res.getString("auditPlanLink.label.enterprise"), res.getString("auditPlanLink.label.enterpriseCell"), res.getString("auditPlanLink.label.activity") }; start(); }
public EnterpriseCellForm() { super(); // define the datasource tree DataSourceRMI master = new DataSourceRMI("EnterpriseCell"); master.setUrl("pt.inescporto.siasoft.go.fun.ejb.session.EnterpriseCell"); if (!MenuSingleton.isSupplier()) { Vector binds = new Vector(); binds.add(new TplString(MenuSingleton.getEnterprise())); try { master.setLinkCondition("enterpriseID = ?", binds); } catch (DataSourceException ex) { ex.printStackTrace(); } } // register the master datasource the this form setDataSource(master); // set the id from permission control setAccessPermitionIdentifier("ENTERPRISECELL"); // headers for the table headers allHeaders = new String[] { res.getString("enterpriseCell.label.enterprise"), res.getString("enterpriseCell.label.code"), res.getString("enterpriseCell.label.desc"), res.getString("enterpriseCell.label.obs"), res.getString("enterpriseCell.label.x"), res.getString("enterpriseCell.label.y"), res.getString("enterpriseCell.label.dx"), res.getString("enterpriseCell.label.dy"), res.getString("enterpriseCell.label.father") }; init(); start(); }
private void jbInit() throws Exception { jtfldEnterprise.setText(res.getString("enterpriseCell.label.enterprise")); jtfldEnterprise.setField("enterpriseID"); jlbtnEnterprise.setText(res.getString("enterpriseCell.label.enterprise")); jlbtnEnterprise.setUrl("pt.inescporto.siasoft.comun.ejb.session.Enterprise"); jlbtnEnterprise.setTitle(res.getString("enterpriseCell.label.list")); jlbtnEnterprise.setDefaultFill(jtfldEnterprise); jlfldEnterprise.setUrl("pt.inescporto.siasoft.comun.ejb.session.Enterprise"); jlfldEnterprise.setDefaultRefField(jtfldEnterprise); jlblEnterpriseCellID.setText(res.getString("enterpriseCell.label.code")); jtfldEnterpriseCellID.setField("enterpriseCellID"); jtfldEnterpriseCellID.setHolder(jlblEnterpriseCellID); jlblEnterpriseCellDescription.setText(res.getString("enterpriseCell.label.desc")); jtfldEnterpriseCellDescription.setField("enterpriseCellDescription"); jtfldEnterpriseCellDescription.setHolder(jlblEnterpriseCellDescription); jtfldFatherCellID.setText(res.getString("enterpriseCell.label.father")); jtfldFatherCellID.setField("fatherCellID"); jlbtnFatherCellID.setText(res.getString("enterpriseCell.label.father")); jlbtnFatherCellID.setLinkCondition("enterpriseID = '" + jtfldEnterprise.getText() + "'"); jlbtnFatherCellID.setUrl("pt.inescporto.siasoft.go.fun.ejb.session.EnterpriseCell"); jlbtnFatherCellID.setTitle(res.getString("enterpriseCell.label.depList")); jlbtnFatherCellID.setDefaultFill(jtfldFatherCellID); jlfldFatherCellID.setUrl("pt.inescporto.siasoft.go.fun.ejb.session.EnterpriseCell"); jlfldFatherCellID.setRefFieldList(new JTextField[] {jtfldEnterprise, jtfldFatherCellID}); jlblEnterpriseCellObs.setText(res.getString("enterpriseCell.label.obs")); jtfldEnterpriseCellObs.setField("enterpriseCellObs"); jtfldEnterpriseCellObs.setHolder(jlblEnterpriseCellObs); jtfldEnterpriseCellObs.setWrapStyleWord(true); jtfldEnterpriseCellObs.setLineWrap(true); JScrollPane jspObs = new JScrollPane(jtfldEnterpriseCellObs); FormLayout formLayout = new FormLayout( "5px, left:pref, 4dlu, 70dlu, 4dlu, 70dlu, 100dlu:grow, 5px", "5px, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, 50dlu:grow, 5px"); JPanel jpnlContent = new JPanel(new BorderLayout()); jpnlContent.setLayout(formLayout); if (MenuSingleton.isSupplier()) formLayout.setRowGroups(new int[][] {{2, 4, 6, 8}}); else formLayout.setRowGroups(new int[][] {{4, 6, 8}}); CellConstraints cc = new CellConstraints(); if (MenuSingleton.isSupplier()) { jpnlContent.add(jlbtnEnterprise, cc.xy(2, 2, CellConstraints.FILL, CellConstraints.FILL)); jpnlContent.add(jtfldEnterprise, cc.xy(4, 2)); jpnlContent.add(jlfldEnterprise, cc.xyw(6, 2, 2)); } jpnlContent.add(jlblEnterpriseCellID, cc.xy(2, 4)); jpnlContent.add(jtfldEnterpriseCellID, cc.xy(4, 4)); jpnlContent.add(jlblEnterpriseCellDescription, cc.xy(2, 6)); jpnlContent.add(jtfldEnterpriseCellDescription, cc.xyw(4, 6, 4)); jpnlContent.add(jlbtnFatherCellID, cc.xy(2, 8, CellConstraints.FILL, CellConstraints.FILL)); jpnlContent.add(jtfldFatherCellID, cc.xy(4, 8)); jpnlContent.add(jlfldFatherCellID, cc.xyw(6, 8, 2)); jpnlContent.add(jlblEnterpriseCellObs, cc.xy(2, 10)); jpnlContent.add(jspObs, cc.xyw(4, 10, 4, CellConstraints.FILL, CellConstraints.FILL)); JPanel jpnlDummy = new JPanel(new BorderLayout()); jpnlDummy.add(jpnlContent, BorderLayout.NORTH); add(jpnlContent, BorderLayout.CENTER); }
private void initialize() { setLayout(new BorderLayout()); setOpaque(false); jlblEmergencySitDefID.setText(res.getString("emergSitdef.label.code")); jtfldEmergencySitDefID.setField("emergSitID"); jtfldEmergencySitDefID.setHolder(jlblEmergencySitDefID); jlblEmergencySitDescription.setText(res.getString("emergSitdef.label.description")); jtfldEmergencySitDescription.setField("emergSitDescription"); jtfldEmergencySitDescription.setHolder(jlblEmergencySitDescription); jtfldEnvAsp.setField("fkEnvAspID"); jtfldEnvAsp.setLabel(res.getString("emergSitlink.label.aa")); jlbtnEnvAsp.setUrl("pt.inescporto.siasoft.go.aa.ejb.session.EnvironmentAspect"); jlbtnEnvAsp.setText(res.getString("emergSitlink.label.aa")); jlbtnEnvAsp.setTitle(res.getString("emergSitlink.label.aalist")); jlbtnEnvAsp.setDefaultFill(jtfldEnvAsp); jlfldEnvAsp.setUrl("pt.inescporto.siasoft.go.aa.ejb.session.EnvironmentAspect"); jlfldEnvAsp.setDefaultRefField(jtfldEnvAsp); jtfldEmergSUserRespID.setField("fkUserID"); jtfldEmergSUserRespID.setText(res.getString("emergSitdef.buttonlabel.resp")); jlbtnEmergSUserResp.setText(res.getString("emergSitdef.buttonlabel.resp")); jlbtnEmergSUserResp.setUrl("pt.inescporto.siasoft.comun.ejb.session.User"); if (!MenuSingleton.isSupplier()) jlbtnEmergSUserResp.setLinkCondition( "enterpriseID = '" + MenuSingleton.getEnterprise() + "'"); jlbtnEmergSUserResp.setTitle(res.getString("emergSitdef.label.resplist")); jlbtnEmergSUserResp.setDefaultFill(jtfldEmergSUserRespID); jlfldEmergSUserRespDescription.setUrl("pt.inescporto.siasoft.comun.ejb.session.User"); jlfldEmergSUserRespDescription.setDefaultRefField(jtfldEmergSUserRespID); jtfldActivity.setLabel(res.getString("emergSitlink.label.activity")); jtfldActivity.setField("fkActivityID"); if (!MenuSingleton.isSupplier()) jlbtnActivity.setLinkCondition("fkEnterpriseID = '" + MenuSingleton.getEnterprise() + "'"); jlbtnActivity.setUrl("pt.inescporto.siasoft.proc.ejb.session.Activity"); jlbtnActivity.setText(res.getString("emergSitlink.label.activity")); jlbtnActivity.setTitle(res.getString("emergSitlink.label.activitylist")); jlbtnActivity.setDefaultFill(jtfldActivity); jlfldActivity.setUrl("pt.inescporto.siasoft.proc.ejb.session.Activity"); jlfldActivity.setDefaultRefField(jtfldActivity); jlblNormal.setText(res.getString("emergSitdef.label.normal")); jlblAnormal.setText(res.getString("emergSitdef.label.abnormal")); jlblEmergency.setText(res.getString("emergSitdef.label.emergency")); jrbNormal.setValue("N"); jrbAnormal.setValue("A"); jrbEmergency.setValue("E"); bgType.setField("typeEmerg"); bgType.add(jrbNormal); bgType.add(jrbAnormal); bgType.add(jrbEmergency); FormLayout formLayout = new FormLayout( "5px, left:pref, 4dlu, 50dlu, 4dlu, 50dlu, 4dlu, 50dlu, 4dlu, 50dlu, 4dlu, 50dlu, 4dlu:grow, 5px", "5px, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref, 5px"); FormLayout formLayout2 = new FormLayout( "65dlu, pref, 4dlu, pref, 20dlu, pref, 4dlu, pref, 20dlu, pref, 4dlu, pref, 65dlu", "5px, pref, 5px"); JPanel content = new JPanel(); content.setOpaque(false); content.setLayout(formLayout); JPanel typeContent = new JPanel(); typeContent.setOpaque(false); typeContent.setLayout(formLayout2); formLayout.setRowGroups(new int[][] {{2, 4, 6, 8}}); CellConstraints cc = new CellConstraints(); typeContent.setBorder( BorderFactory.createTitledBorder(res.getString("emergSitdef.label.type"))); ((TitledBorder) typeContent.getBorder()).setTitleFont(new Font("Dialog", Font.PLAIN, 12)); typeContent.add(jlblNormal, cc.xy(2, 2)); typeContent.add(jrbNormal, cc.xy(4, 2)); typeContent.add(jlblAnormal, cc.xy(6, 2)); typeContent.add(jrbAnormal, cc.xy(8, 2)); typeContent.add(jlblEmergency, cc.xy(10, 2)); typeContent.add(jrbEmergency, cc.xy(12, 2)); content.add(jlblEmergencySitDefID, cc.xy(2, 2)); content.add(jtfldEmergencySitDefID, cc.xy(4, 2)); content.add(jlblEmergencySitDescription, cc.xy(2, 4)); content.add(jtfldEmergencySitDescription, cc.xyw(4, 4, 10)); content.add(jlbtnEnvAsp, cc.xy(2, 6, CellConstraints.FILL, CellConstraints.DEFAULT)); content.add(jtfldEnvAsp, cc.xy(4, 6)); content.add(jlfldEnvAsp, cc.xyw(6, 6, 8)); content.add(jlbtnEmergSUserResp, cc.xy(2, 8, CellConstraints.FILL, CellConstraints.DEFAULT)); content.add(jtfldEmergSUserRespID, cc.xy(4, 8)); content.add(jlfldEmergSUserRespDescription, cc.xyw(6, 8, 8)); content.add(jlbtnActivity, cc.xy(2, 10, CellConstraints.FILL, CellConstraints.DEFAULT)); content.add(jtfldActivity, cc.xy(4, 10)); content.add(jlfldActivity, cc.xyw(6, 10, 8)); jrbEmergency.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (((TmplJRadioButton) e.getSource()).isSelected()) { jtpScenarios.setEnabledAt(1, true); } } }); jrbNormal.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (((TmplJRadioButton) e.getSource()).isSelected()) { jtpScenarios.setEnabledAt(1, false); } } }); jrbAnormal.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (((TmplJRadioButton) e.getSource()).isSelected()) { jtpScenarios.setEnabledAt(1, false); } } }); content.add(typeContent, cc.xyw(2, 12, 12)); add(content, BorderLayout.NORTH); add( new EmergencySituationScenarios(datasource, fwCListener, jtpScenarios), BorderLayout.CENTER); }