bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public Object getValueAt(int row, int col) { // Fermentable m = (Fermentable) data.get(row); try { switch (col) { case 0: // steep return data.getMaltSteep(row); case 1: // mash return data.getMaltMashed(row); case 2 : // indicate this is a sugar: String s = ""; if (!data.getMaltMashed(row) && data.getMaltSteep(row)) s = "*"; return s + data.getMaltName(row); case 3 : return SBStringUtils.format(data .getMaltAmountAs(row, data.getMaltUnits(row)), 1); case 4 : return data.getMaltUnits(row); case 5 : return SBStringUtils.format(data.getMaltPppg(row), 3); case 6 : return SBStringUtils.format(data.getMaltLov(row), 0); case 7 : return new Double(data.getMaltCostPerU(row)); case 8 : return SBStringUtils.format(data.getMaltPercent(row), 1); } } catch (Exception e) { }; return ""; }
|
public Object getValueAt(int row, int col) { // Fermentable m = (Fermentable) data.get(row); try { switch (col) { case 0: // steep return data.getMaltSteep(row); case 1: // mash return data.getMaltMashed(row); case 2 : // indicate this is a sugar: String s = ""; if (!data.getMaltMashed(row) && data.getMaltSteep(row)) s = "*"; return s + data.getMaltName(row); case 3 : return SBStringUtils.format(data .getMaltAmountAs(row, data.getMaltUnits(row)), 1); case 4 : return data.getMaltUnits(row); case 5 : return SBStringUtils.format(data.getMaltPppg(row), 3); case 6 : return SBStringUtils.format(data.getMaltLov(row), 0); case 7 : return new Double(data.getMaltCostPerU(row)); case 8 : return SBStringUtils.format(data.getMaltPercent(row), 1); } } catch (Exception e) { }; return ""; }
| 1,116,966
|
public Object asinh(Object param) throws ParseException { if (param instanceof Complex) { return ((Complex)param).asinh(); } else if (param instanceof Number) { Complex temp = new Complex(((Number)param).doubleValue(),0.0); return temp.asinh(); } throw new ParseException("Invalid parameter type"); }
|
public Object asinh(Object param) throws ParseException { if (param instanceof Complex) { return ((Complex)param).asinh(); } else if (param instanceof Number) { Complex temp = new Complex(((Number)param).doubleValue(),0.0); return temp.asinh(); } throw new ParseException("Invalid parameter type"); }
| 1,116,967
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { String myFile = myContents.getOpenFilename(); if (myFile != "/") { ImportXml imp = new ImportXml(myFile); Recipe recipe = imp.handler.getRecipe(); myParent.setRecipe(recipe); } } }
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { String myFile = myContents.getOpenFilename(); if (myFile != null) { ImportXml imp = new ImportXml(myFile); Recipe recipe = imp.handler.getRecipe(); myParent.setRecipe(recipe); } } }
| 1,116,969
|
SuiteResult(File xmlReport) throws DocumentException { Document result = new SAXReader().read(xmlReport); Element root = result.getRootElement(); name = root.attributeValue("name"); stdout = root.elementText("system-out"); stderr = root.elementText("system-err"); for (Element e : (List<Element>)root.elements("testcase")) { cases.add(new CaseResult(e)); } }
|
SuiteResult(File xmlReport) throws DocumentException { Document result = new SAXReader().read(xmlReport); Element root = result.getRootElement(); name = root.attributeValue("name"); stdout = root.elementText("system-out"); stderr = root.elementText("system-err"); for (Element e : (List<Element>)root.elements("testcase")) { cases.add(new CaseResult(this,e)); } }
| 1,116,971
|
public boolean configure(HttpServletRequest req) { String v = req.getParameter("mailer_smtpServer"); if(v!=null && v.length()==0) v=null; getProperties().put("mail.smtp.host",v); getProperties().put("mail.admin.address",req.getParameter("mailer_admin_address")); save(); return super.configure(req); }
|
public boolean configure(HttpServletRequest req) { String v = req.getParameter("mailer_smtp_server"); if(v!=null && v.length()==0) v=null; getProperties().put("mail.smtp.host",v); getProperties().put("mail.admin.address",req.getParameter("mailer_admin_address")); save(); return super.configure(req); }
| 1,116,972
|
public void testQuartonians() throws Exception { j = new GroupJep(new Quartonians()); j.addStandardConstants(); System.out.println(j.getGroup().toString()); valueToStringTest("i*j","-1.0k"); }
|
public void testQuartonians() throws Exception { j = new GroupJep(new Quartonians()); j.addStandardConstants(); System.out.println(j.getGroup().toString()); valueToStringTest("i*j","-k"); }
| 1,116,973
|
private void initGUI() { try { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.columnWeights = new double[]{0.3, 0.3}; thisLayout.columnWidths = new int[]{7, 7}; thisLayout.rowWeights = new double[]{0.1, 0.8, 0.1}; thisLayout.rowHeights = new int[]{7, 7, 7}; this.setLayout(thisLayout); { titlePanel = new JPanel(); FlowLayout titlePanelLayout = new FlowLayout(); titlePanelLayout.setAlignment(FlowLayout.LEFT); titlePanel.setLayout(titlePanelLayout); this.add(titlePanel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { titleLabel = new JLabel(); titlePanel.add(titleLabel); titleLabel.setText("Mash schedule for:"); titleLabel.setFont(new java.awt.Font("Dialog", 0, 12)); } { recipeNameLabel = new JLabel(); titlePanel.add(recipeNameLabel); recipeNameLabel.setText("Recipe Name"); } } { tablePanel = new JPanel(); BorderLayout pnlTableLayout = new BorderLayout(); tablePanel.setLayout(pnlTableLayout); this.add(tablePanel, new GridBagConstraints(0, 1, 2, 3, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); tablePanel.setName(""); tablePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); { jScrollPane1 = new JScrollPane(); tablePanel.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(344, 145)); { mashModel = new MashTableModel(); tblMash = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, mashModel .getDirectionsAt(rowIndex)); } }; jScrollPane1.setViewportView(tblMash); tblMash.setModel(mashModel); tblMash.setAutoCreateColumnsFromModel(false); tblMash.getTableHeader().setReorderingAllowed(false); // set up type combo String[] types = {"acid", "gluten", "protein", "beta", "alpha", "mashout"}; JComboBox typesComboBox = new JComboBox(types); TableColumn mashColumn = tblMash.getColumnModel().getColumn(0); mashColumn.setCellEditor(new DefaultCellEditor(typesComboBox)); // set up method combo String[] methods = {"infusion", "decoction", "decoction thick", "decoction thin", "direct"}; JComboBox methodComboBox = new JComboBox(methods); mashColumn = tblMash.getColumnModel().getColumn(1); mashColumn.setCellEditor(new DefaultCellEditor(methodComboBox)); } } } jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); this.add(jPanel1, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { settingsPanel = new JPanel(); jPanel1.add(settingsPanel, BorderLayout.CENTER); GridBagLayout settingsPanelLayout = new GridBagLayout(); settingsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; settingsPanelLayout.rowHeights = new int[]{7, 7, 7, 7}; settingsPanelLayout.columnWeights = new double[]{0.3, 0.1, 0.1}; settingsPanelLayout.columnWidths = new int[]{7, 7, 7}; settingsPanel.setLayout(settingsPanelLayout); settingsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); settingsPanel.setPreferredSize(new java.awt.Dimension(172, 175)); jLabel15 = new JLabel(); settingsPanel.add(jLabel15, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel15.setText("Mash Ratio: 1:"); { ratioText = new JTextField(); settingsPanel.add(ratioText, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); ratioText.setText("1.25"); ratioText.addFocusListener(this); ratioText.addActionListener(this); } { ComboBoxModel ratioUnitsComboModel = new DefaultComboBoxModel(new String[]{ "qt/lb", "l/kg"}); this.setPreferredSize(new java.awt.Dimension(502, 276)); ratioUnitsCombo = new JComboBox(); settingsPanel.add(ratioUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ratioUnitsCombo.setModel(ratioUnitsComboModel); ratioUnitsCombo.addActionListener(this); } { grainTempText = new JTextField(); settingsPanel.add(grainTempText, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); grainTempText.setText("10"); grainTempText.addFocusListener(this); grainTempText.addActionListener(this); } { grainTempULabel = new JLabel(); settingsPanel.add(grainTempULabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grainTempULabel.setText("F"); } jLabel19 = new JLabel(); settingsPanel.add(jLabel19, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel19.setText("Grain Temp:"); boilTempTxt = new JTextField(); settingsPanel.add(boilTempTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilTempTxt.setText("212"); jLabel20 = new JLabel(); settingsPanel.add(jLabel20, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel20.setText("Boil Temp:"); jLabel12 = new JLabel(); settingsPanel.add(jLabel12, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel12.setText("F"); { tunLossTxt = new JTextField(); settingsPanel.add(tunLossTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); tunLossTxt.addFocusListener(this); tunLossTxt.addActionListener(this); } { tempLostULabel = new JLabel(); settingsPanel.add(tempLostULabel, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tempLostULabel.setText("F"); } jLabel1 = new JLabel(); settingsPanel.add(jLabel1, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Temp Lost in Tun:"); { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel, BorderLayout.SOUTH); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); buttonsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); jToolBar1 = new JToolBar(); buttonsPanel.add(jToolBar1); jToolBar1.setFloatable(false); jToolBar1.setPreferredSize(new java.awt.Dimension(65, 18)); jLabel13 = new JLabel(); buttonsPanel.add(jLabel13); jLabel13.setText("Temp Units:"); { tempFrb = new JRadioButton(); buttonsPanel.add(tempFrb); tempFrb.setText("F"); tempFrb.addActionListener(this); } { tempCrb = new JRadioButton(); buttonsPanel.add(tempCrb); tempCrb.setText("C"); tempCrb.addActionListener(this); } tempBg = new ButtonGroup(); tempBg.add(tempFrb); tempBg.add(tempCrb); jLabel14 = new JLabel(); settingsPanel.add(jLabel14, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("Vol Units:"); { delStepButton = new JButton(); jToolBar1.add(delStepButton); delStepButton.setText("-"); delStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { delStepButtonActionPerformed(evt); } }); } { addStepButton = new JButton(); jToolBar1.add(addStepButton); addStepButton.setText("+"); addStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addStepButtonActionPerformed(evt); } }); } } { volUnitsComboModel = new ComboModel(); volUnitsComboModel.setList(new Quantity().getListofUnits("vol")); volUnitsCombo = new JComboBox(); settingsPanel.add(volUnitsCombo, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); volUnitsCombo.setModel(volUnitsComboModel); volUnitsCombo.addActionListener(this); } boilTempTxt.addFocusListener(this); boilTempTxt.addActionListener(this); } totalsPanel = new JPanel(); GridBagLayout totalsPanelLayout = new GridBagLayout(); totalsPanel.setLayout(totalsPanelLayout); jPanel1.add(totalsPanel, BorderLayout.SOUTH); jLabel16 = new JLabel(); totalMashLabel = new JLabel(); jLabel17 = new JLabel(); jLabel18 = new JLabel(); { totalTimeLabel = new JLabel(); totalTimeLabel.setText("Time"); } jLabel18.setText("Total Time:"); jLabel17.setText("Total Vol:"); totalsPanel .add(jLabel16, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalMashLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); totalsPanel .add(jLabel17, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(jLabel18, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalTimeLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); { volLabel = new JLabel(); totalsPanel.add(volLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); volLabel.setText("10"); } jLabel16.setText("Total Weight:"); totalsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1}; totalsPanelLayout.rowHeights = new int[]{7, 7, 7}; totalsPanelLayout.columnWeights = new double[]{0.1, 0.1}; totalsPanelLayout.columnWidths = new int[]{7, 7}; totalsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); totalMashLabel.setText("10"); } catch (Exception e) { e.printStackTrace(); } }
|
private void initGUI() { try { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.columnWeights = new double[]{0.3, 0.3}; thisLayout.columnWidths = new int[]{7, 7}; thisLayout.rowWeights = new double[]{0.1, 0.8, 0.1}; thisLayout.rowHeights = new int[]{7, 7, 7}; this.setLayout(thisLayout); { titlePanel = new JPanel(); FlowLayout titlePanelLayout = new FlowLayout(); titlePanelLayout.setAlignment(FlowLayout.LEFT); titlePanel.setLayout(titlePanelLayout); this.add(titlePanel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { titleLabel = new JLabel(); titlePanel.add(titleLabel); titleLabel.setText("Mash schedule for:"); titleLabel.setFont(new java.awt.Font("Dialog", 0, 12)); } { recipeNameLabel = new JLabel(); titlePanel.add(recipeNameLabel); recipeNameLabel.setText("Recipe Name"); } } { tablePanel = new JPanel(); BorderLayout pnlTableLayout = new BorderLayout(); tablePanel.setLayout(pnlTableLayout); this.add(tablePanel, new GridBagConstraints(0, 1, 2, 3, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); tablePanel.setName(""); tablePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); { jScrollPane1 = new JScrollPane(); tablePanel.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(344, 145)); { mashModel = new MashTableModel(); tblMash = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, mashModel .getDirectionsAt(rowIndex)); } }; jScrollPane1.setViewportView(tblMash); tblMash.setModel(mashModel); tblMash.setAutoCreateColumnsFromModel(false); tblMash.getTableHeader().setReorderingAllowed(false); // set up type combo String[] types = {"acid", "gluten", "protein", "beta", "alpha", "mashout"}; JComboBox typesComboBox = new JComboBox(types); TableColumn mashColumn = tblMash.getColumnModel().getColumn(0); mashColumn.setCellEditor(new DefaultCellEditor(typesComboBox)); // set up method combo String[] methods = {"infusion", "decoction", "decoction thick", "decoction thin", "direct"}; JComboBox methodComboBox = new JComboBox(methods); mashColumn = tblMash.getColumnModel().getColumn(1); mashColumn.setCellEditor(new DefaultCellEditor(methodComboBox)); } } } jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); this.add(jPanel1, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { settingsPanel = new JPanel(); jPanel1.add(settingsPanel, BorderLayout.CENTER); GridBagLayout settingsPanelLayout = new GridBagLayout(); settingsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; settingsPanelLayout.rowHeights = new int[]{7, 7, 7, 7}; settingsPanelLayout.columnWeights = new double[]{0.3, 0.1, 0.1}; settingsPanelLayout.columnWidths = new int[]{7, 7, 7}; settingsPanel.setLayout(settingsPanelLayout); settingsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); settingsPanel.setPreferredSize(new java.awt.Dimension(172, 175)); jLabel15 = new JLabel(); settingsPanel.add(jLabel15, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel15.setText("Mash Ratio: 1:"); { ratioText = new JTextField(); settingsPanel.add(ratioText, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); ratioText.setText("1.25"); ratioText.addFocusListener(this); ratioText.addActionListener(this); } { ComboBoxModel ratioUnitsComboModel = new DefaultComboBoxModel(new String[]{ "qt/lb", "l/kg"}); this.setPreferredSize(new java.awt.Dimension(502, 276)); ratioUnitsCombo = new JComboBox(); settingsPanel.add(ratioUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ratioUnitsCombo.setModel(ratioUnitsComboModel); ratioUnitsCombo.addActionListener(this); } { grainTempText = new JTextField(); settingsPanel.add(grainTempText, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); grainTempText.setText("10"); grainTempText.addFocusListener(this); grainTempText.addActionListener(this); } { grainTempULabel = new JLabel(); settingsPanel.add(grainTempULabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grainTempULabel.setText("F"); } jLabel19 = new JLabel(); settingsPanel.add(jLabel19, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel19.setText("Grain Temp:"); boilTempTxt = new JTextField(); settingsPanel.add(boilTempTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilTempTxt.setText("212"); jLabel20 = new JLabel(); settingsPanel.add(jLabel20, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel20.setText("Boil Temp:"); jLabel12 = new JLabel(); settingsPanel.add(jLabel12, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel12.setText("F"); { tunLossTxt = new JTextField(); settingsPanel.add(tunLossTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); tunLossTxt.addFocusListener(this); tunLossTxt.addActionListener(this); } { tempLostULabel = new JLabel(); settingsPanel.add(tempLostULabel, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tempLostULabel.setText("F"); } jLabel1 = new JLabel(); settingsPanel.add(jLabel1, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Temp Lost in Tun:"); { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel, BorderLayout.SOUTH); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); buttonsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); jToolBar1 = new JToolBar(); buttonsPanel.add(jToolBar1); jToolBar1.setFloatable(false); jToolBar1.setPreferredSize(new java.awt.Dimension(65, 18)); jLabel13 = new JLabel(); buttonsPanel.add(jLabel13); jLabel13.setText("Temp Units:"); { tempFrb = new JRadioButton(); buttonsPanel.add(tempFrb); tempFrb.setText("F"); tempFrb.addActionListener(this); } { tempCrb = new JRadioButton(); buttonsPanel.add(tempCrb); tempCrb.setText("C"); tempCrb.addActionListener(this); } tempBg = new ButtonGroup(); tempBg.add(tempFrb); tempBg.add(tempCrb); jLabel14 = new JLabel(); settingsPanel.add(jLabel14, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("Vol Units:"); { delStepButton = new JButton(); jToolBar1.add(delStepButton); delStepButton.setText("-"); delStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { delStepButtonActionPerformed(evt); } }); } { addStepButton = new JButton(); jToolBar1.add(addStepButton); addStepButton.setText("+"); addStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addStepButtonActionPerformed(evt); } }); } } { volUnitsComboModel = new ComboModel(); volUnitsComboModel.setList(new Quantity().getListofUnits("vol")); volUnitsCombo = new JComboBox(); settingsPanel.add(volUnitsCombo, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); volUnitsCombo.setModel(volUnitsComboModel); volUnitsCombo.addActionListener(this); } boilTempTxt.addFocusListener(this); boilTempTxt.addActionListener(this); } totalsPanel = new JPanel(); GridBagLayout totalsPanelLayout = new GridBagLayout(); totalsPanel.setLayout(totalsPanelLayout); jPanel1.add(totalsPanel, BorderLayout.SOUTH); jLabel16 = new JLabel(); totalMashLabel = new JLabel(); jLabel17 = new JLabel(); jLabel18 = new JLabel(); { totalTimeLabel = new JLabel(); totalTimeLabel.setText("Time"); } jLabel18.setText("Total Time:"); jLabel17.setText("Total Vol:"); totalsPanel .add(jLabel16, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalMashLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); totalsPanel .add(jLabel17, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(jLabel18, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalTimeLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); { volLabel = new JLabel(); totalsPanel.add(volLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); volLabel.setText("10"); } jLabel16.setText("Total Weight:"); totalsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1}; totalsPanelLayout.rowHeights = new int[]{7, 7, 7}; totalsPanelLayout.columnWeights = new double[]{0.1, 0.1}; totalsPanelLayout.columnWidths = new int[]{7, 7}; totalsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); totalMashLabel.setText("10"); } catch (Exception e) { e.printStackTrace(); } }
| 1,116,974
|
public PSNVariableHeader(DataInputStream data, int length) throws IOException{ dis = data; for (int i = 0; i < length; i++) { //Sanity Check: this should be equal to 0x55 byte check = dis.readByte(); //System.out.println("Check: " + check); if (check != 0x55){ throw new IOException("file may not be a standard Type 4 PSN format"); } //read descriptor id byte id = dis.readByte(); int fieldLength = SacTimeSeries.swapBytes(dis.readInt()); //System.out.println("varHeader iteration " + i + ", id " + id + ", fieldLength " + fieldLength); switch (id) { case 0: if (fieldLength != 0){ throw new IOException("end of header has unread data"); } break; case 1: case 2: case 3: case 7: //entries.put(new Byte(id), readNullTerminatedString(dis, fieldLength)); byte[] stringArray = new byte[fieldLength]; dis.readFully(stringArray); String aString = new String(stringArray); entries.put(new Byte(id), aString); //System.out.println(aString); break; case 4: List eventInfoList; if (entries.containsKey(new Byte(id))){ eventInfoList = (ArrayList)entries.get(new Byte(id)); } else{ eventInfoList = new ArrayList(); } eventInfoList.add(new PSNEventInfo(dis)); entries.put(new Byte(id), eventInfoList); break; case 5: List phasePickList; if (hasPhasePicks()){ phasePickList = (ArrayList)entries.get(new Byte(id)); } else{ phasePickList = new ArrayList(); } phasePickList.add(new PSNPhasePick(dis)); entries.put(new Byte(id), phasePickList); break; case 11: entries.put(new Byte(id), new PSNSensorAmpAtoD(dis)); break; case 12: entries.put(new Byte(id), new PSNPolesAndZeros(dis)); break; default: dis.skip(fieldLength); break; } i+=(fieldLength + 5); } }
|
public PSNVariableHeader(DataInputStream data, int length) throws IOException{ dis = data; for (int i = 0; i < length; i++) { //Sanity Check: this should be equal to 0x55 byte check = dis.readByte(); //System.out.println("Check: " + check); if (check != 0x55){ throw new IOException("file may not be a standard Type 4 PSN format"); } //read descriptor id byte id = dis.readByte(); int fieldLength = SacTimeSeries.swapBytes(dis.readInt()); //System.out.println("varHeader iteration " + i + ", id " + id + ", fieldLength " + fieldLength); switch (id) { case 0: if (fieldLength != 0){ throw new IOException("end of header has unread data"); } break; case 1: case 2: case 3: case 7: //entries.put(new Byte(id), readNullTerminatedString(dis, fieldLength)); byte[] stringArray = new byte[fieldLength]; dis.readFully(stringArray); String aString = new String(PSNDataFile.chopToLength(stringArray)); entries.put(new Byte(id), aString); //System.out.println(aString); break; case 4: List eventInfoList; if (entries.containsKey(new Byte(id))){ eventInfoList = (ArrayList)entries.get(new Byte(id)); } else{ eventInfoList = new ArrayList(); } eventInfoList.add(new PSNEventInfo(dis)); entries.put(new Byte(id), eventInfoList); break; case 5: List phasePickList; if (hasPhasePicks()){ phasePickList = (ArrayList)entries.get(new Byte(id)); } else{ phasePickList = new ArrayList(); } phasePickList.add(new PSNPhasePick(dis)); entries.put(new Byte(id), phasePickList); break; case 11: entries.put(new Byte(id), new PSNSensorAmpAtoD(dis)); break; case 12: entries.put(new Byte(id), new PSNPolesAndZeros(dis)); break; default: dis.skip(fieldLength); break; } i+=(fieldLength + 5); } }
| 1,116,975
|
public synchronized Map<BuildStepDescriptor,BuildStep> getBuilders() { Map<BuildStepDescriptor,BuildStep> m = new LinkedHashMap<BuildStepDescriptor,BuildStep>(); for( int i=builders.size()-1; i>=0; i-- ) { BuildStep b = builders.get(i); m.put(b.getDescriptor(),b); } return m; }
|
public synchronized Map<BuildStepDescriptor,BuildStep> getBuilders() { Map<BuildStepDescriptor,BuildStep> m = new LinkedHashMap<BuildStepDescriptor,BuildStep>(); for( int i=builders.size()-1; i>=0; i-- ) { BuildStep b = builders.get(i); m.put(b.getDescriptor(),b); } return m; }
| 1,116,976
|
public synchronized Map<BuildStepDescriptor,BuildStep> getPublishers() { Map<BuildStepDescriptor,BuildStep> m = new LinkedHashMap<BuildStepDescriptor,BuildStep>(); for( int i=publishers.size()-1; i>=0; i-- ) { BuildStep b = publishers.get(i); m.put(b.getDescriptor(),b); } return m; }
|
public synchronized Map<BuildStepDescriptor,BuildStep> getPublishers() { Map<BuildStepDescriptor,BuildStep> m = new LinkedHashMap<BuildStepDescriptor,BuildStep>(); for( int i=publishers.size()-1; i>=0; i-- ) { BuildStep b = publishers.get(i); m.put(b.getDescriptor(),b); } return m; }
| 1,116,977
|
public Slave(String name, String command, String remoteFS, File localFS) { this.name = name; this.command = command; this.remoteFS = remoteFS; this.localFS = localFS; }
|
public Slave(String name, String description, String command, String remoteFS, File localFS) { this.name = name; this.command = command; this.remoteFS = remoteFS; this.localFS = localFS; }
| 1,116,979
|
public Launcher createLauncher(BuildListener listener) { return new Launcher(listener) { @Override public Proc launch(String[] cmd, String[] env, OutputStream out, FilePath workDir) throws IOException { return super.launch(prepend(cmd,env,workDir), env, null, out); } @Override public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out) throws IOException { return super.launch(prepend(cmd,env,CURRENT_DIR), env, in, out); } @Override public boolean isUnix() { // Err on Unix, since we expect that to be the common slaves return remoteFS.indexOf('\\')==-1; } private String[] prepend(String[] cmd, String[] env, FilePath workDir) { List<String> r = new ArrayList<String>(); r.addAll(Arrays.asList(getCommandTokens())); r.add("~/bin/slave"); r.add(workDir.getRemote()); r.addAll(Arrays.asList(env)); r.add("--"); r.addAll(Arrays.asList(cmd)); return r.toArray(new String[r.size()]); } }; }
|
public Launcher createLauncher(BuildListener listener) { return new Launcher(listener) { @Override public Proc launch(String[] cmd, String[] env, OutputStream out, FilePath workDir) throws IOException { return super.launch(prepend(cmd,env,workDir), env, null, out); } @Override public Proc launch(String[] cmd, String[] env, InputStream in, OutputStream out) throws IOException { return super.launch(prepend(cmd,env,CURRENT_DIR), env, in, out); } @Override public boolean isUnix() { // Err on Unix, since we expect that to be the common slaves return remoteFS.indexOf('\\')==-1; } private String[] prepend(String[] cmd, String[] env, FilePath workDir) { List<String> r = new ArrayList<String>(); r.addAll(Arrays.asList(getCommandTokens())); r.add("~/bin/slave"); r.add(workDir.getRemote()); for (String s : env) { int index =s.indexOf('='); r.add(s.substring(0,index)); r.add(s.substring(index+1)); } r.add("--"); r.addAll(Arrays.asList(cmd)); return r.toArray(new String[r.size()]); } }; }
| 1,116,981
|
private String[] prepend(String[] cmd, String[] env, FilePath workDir) { List<String> r = new ArrayList<String>(); r.addAll(Arrays.asList(getCommandTokens())); r.add("~/bin/slave"); r.add(workDir.getRemote()); r.addAll(Arrays.asList(env)); r.add("--"); r.addAll(Arrays.asList(cmd)); return r.toArray(new String[r.size()]); }
|
private String[] prepend(String[] cmd, String[] env, FilePath workDir) { List<String> r = new ArrayList<String>(); r.addAll(Arrays.asList(getCommandTokens())); r.add("~/bin/slave"); r.add(workDir.getRemote()); for (String s : env) { int index =s.indexOf('='); r.add(s.substring(0,index)); r.add(s.substring(index+1)); } r.add("--"); r.addAll(Arrays.asList(cmd)); return r.toArray(new String[r.size()]); }
| 1,116,982
|
private void updateDisplay() { if ( displayedDataModel != null ) { int total = displayedDataModel.getAllSearchResultCount(); int filtered = displayedDataModel.getFilteredElementCount(); progressBar.setValue( displayedDataModel.getSearch().getProgress() ); totalResultsLbl.setText( String.valueOf( total ) ); displayedResultsLbl.setText( String.valueOf( total - filtered ) ); filteredResultsLbl.setText( String.valueOf( filtered ) ); } else { progressBar.setValue(0); totalResultsLbl.setText(""); displayedResultsLbl.setText(""); filteredResultsLbl.setText(""); } }
|
private void updateDisplay() { if ( displayedDataModel != null ) { int total = displayedDataModel.getAllSearchResultCount(); int filtered = displayedDataModel.getFilteredElementCount(); progressBar.setValue( search.getProgress() ); totalResultsLbl.setText( String.valueOf( total ) ); displayedResultsLbl.setText( String.valueOf( total - filtered ) ); filteredResultsLbl.setText( String.valueOf( filtered ) ); } else { progressBar.setValue(0); totalResultsLbl.setText(""); displayedResultsLbl.setText(""); filteredResultsLbl.setText(""); } }
| 1,116,984
|
/*package*/ void onRenamed(Job job, String oldName, String newName) throws IOException { jobs.remove(oldName); jobs.put(newName,job); if(views!=null) { for (View v : views) { synchronized(v) { v.jobNames.remove(oldName); v.jobNames.add(newName); } } save(); } }
|
/*package*/ void onRenamed(Job job, String oldName, String newName) throws IOException { jobs.remove(oldName); jobs.put(newName,job); if(views!=null) { for (View v : views) { synchronized(v) { v.jobNames.remove(oldName); v.jobNames.add(newName); } } save(); } }
| 1,116,986
|
public EvaluatorVisitor() { debug = false; errorList = null; symTab = null; stack = new Stack(); }
|
public EvaluatorVisitor() { errorList = null; symTab = null; stack = new Stack(); }
| 1,116,987
|
public Object getValue(Node topNode, Vector errorList_in, SymbolTable symTab_in) throws Exception { // check if arguments are ok if (topNode == null) { throw new IllegalArgumentException( "topNode parameter is null"); } if (symTab_in == null) { throw new IllegalArgumentException( "symTab_in parameter is null"); } // set member vars errorList = errorList_in; symTab = symTab_in; errorFlag = false; // evaluate by letting the top node accept the visitor topNode.jjtAccept(this, null); // something is wrong if not exactly one item remains on the stack // or if the error flag has been set if (errorFlag || stack.size() != 1) { throw new Exception( "EvaluatorVisitor.getValue(): Error during evaluation"); } // return the value of the expression return stack.pop(); }
|
public synchronized Object getValue(Node topNode, Vector errorList_in, SymbolTable symTab_in) throws Exception { // check if arguments are ok if (topNode == null) { throw new IllegalArgumentException( "topNode parameter is null"); } if (symTab_in == null) { throw new IllegalArgumentException( "symTab_in parameter is null"); } // set member vars errorList = errorList_in; symTab = symTab_in; errorFlag = false; // evaluate by letting the top node accept the visitor topNode.jjtAccept(this, null); // something is wrong if not exactly one item remains on the stack // or if the error flag has been set if (errorFlag || stack.size() != 1) { throw new Exception( "EvaluatorVisitor.getValue(): Error during evaluation"); } // return the value of the expression return stack.pop(); }
| 1,116,988
|
public void characters(char buf[], int offset, int len) throws SAXException { String s = new String(buf, offset, len); // we're inside a style: if (!s.trim().equals("")) { if (currentElement.equalsIgnoreCase("notes")) descrBuf += s; if (currentList.equalsIgnoreCase("hops")){ if (currentElement.equalsIgnoreCase("name")) h.setName(s.trim()); if (currentElement.equalsIgnoreCase("amount")) h.setAmountAs(Double.parseDouble(s.trim()), "kg"); if (currentElement.equalsIgnoreCase("form")) h.setType(s.trim()); if (currentElement.equalsIgnoreCase("hsi")) h.setStorage(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("alpha")) h.setAlpha(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("time")) h.setMinutes(new Double(s.trim()).intValue()); if (currentElement.equalsIgnoreCase("use")){ if (s.trim().equalsIgnoreCase("boil") || s.trim().equalsIgnoreCase("aroma")) h.setAdd("Boil"); if (s.trim().equalsIgnoreCase("dry hop")) h.setAdd("Dry"); if (s.trim().equalsIgnoreCase("first wort")) h.setAdd("FWH"); } } else if (currentList.equalsIgnoreCase("fermentables")){ if (currentElement.equalsIgnoreCase("name")) f.setName(s.trim()); if (currentElement.equalsIgnoreCase("amount")) f.setAmountAs(Double.parseDouble(s.trim()), "kg"); if (currentElement.equalsIgnoreCase("potential")) f.setPppg(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("color")) f.setLov(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("RECOMMEND_MASH")) f.setMashed(s.trim().equalsIgnoreCase("true")); } else if (currentList.equalsIgnoreCase("style")){ if (currentElement.equalsIgnoreCase("name")) myRecipe.setStyle(s.trim()); } else if (currentList.equalsIgnoreCase("recipe")){ if (currentElement.equalsIgnoreCase("name")) myRecipe.setName(s.trim()); if (currentElement.equalsIgnoreCase("brewer")) myRecipe.setBrewer(s.trim()); if (currentElement.equalsIgnoreCase("BATCH_SIZE")){ myRecipe.setPostBoil(Double.parseDouble(s.trim())); myRecipe.setVolUnits("l"); } if (currentElement.equalsIgnoreCase("BOIL_TIME")) myRecipe.setBoilMinutes(new Double(s.trim()).intValue()); if (currentElement.equalsIgnoreCase("EFFICIENCY")) myRecipe.setEfficiency(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("EFFICIENCY")) myRecipe.setEfficiency(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("IBU_METHOD")) myRecipe.setIBUMethod(s.trim()); } } }
|
public void characters(char buf[], int offset, int len) throws SAXException { String s = new String(buf, offset, len); // we're inside a style: if (!s.trim().equals("")) { if (currentElement.equalsIgnoreCase("notes")) descrBuf += s; if (currentList.equalsIgnoreCase("hops")){ if (currentElement.equalsIgnoreCase("name")) h.setName(s.trim()); if (currentElement.equalsIgnoreCase("amount")) h.setAmountAs(Double.parseDouble(s.trim()), "kg"); if (currentElement.equalsIgnoreCase("form")) h.setType(s.trim()); if (currentElement.equalsIgnoreCase("hsi")) h.setStorage(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("alpha")) h.setAlpha(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("time")) h.setMinutes(new Double(s.trim()).intValue()); if (currentElement.equalsIgnoreCase("use")){ if (s.trim().equalsIgnoreCase("boil") || s.trim().equalsIgnoreCase("aroma")) h.setAdd("Boil"); if (s.trim().equalsIgnoreCase("dry hop")) h.setAdd("Dry"); if (s.trim().equalsIgnoreCase("first wort")) h.setAdd("FWH"); } } else if (currentList.equalsIgnoreCase("fermentables")){ if (currentElement.equalsIgnoreCase("name")) f.setName(s.trim()); if (currentElement.equalsIgnoreCase("amount")) f.setAmountAs(Double.parseDouble(s.trim()), "kg"); if (currentElement.equalsIgnoreCase("potential")) f.setPppg(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("color")) f.setLov(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("RECOMMEND_MASH")) f.setMashed(s.trim().equalsIgnoreCase("true")); } else if (currentList.equalsIgnoreCase("mash")){ if (currentElement.equalsIgnoreCase("type")) myRecipe.mash.setStepMethod(myRecipe.mash.getStepSize()-1, s.trim()); if (currentElement.equalsIgnoreCase("STEP_TIME")) myRecipe.mash.setStepMin(myRecipe.mash.getStepSize()-1, new Double(s.trim()).intValue()); if (currentElement.equalsIgnoreCase("STEP_TEMP")) myRecipe.mash.setStepStartTemp(myRecipe.mash.getStepSize()-1, Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("END_TEMP")) myRecipe.mash.setStepEndTemp(myRecipe.mash.getStepSize()-1, Double.parseDouble(s.trim())); } else if (currentList.equalsIgnoreCase("miscs")){ if (currentElement.equalsIgnoreCase("name")) m.setName(s.trim()); if (currentElement.equalsIgnoreCase("amount")) m.setAmountAs(Double.parseDouble(s.trim()), "kg"); if (currentElement.equalsIgnoreCase("use")) m.setStage(s.trim()); if (currentElement.equalsIgnoreCase("time")) m.setTime(new Double(s.trim()).intValue()); } else if (currentList.equalsIgnoreCase("yeast")){ if (currentElement.equalsIgnoreCase("name")) myRecipe.setYeastName(s.trim()); } else if (currentList.equalsIgnoreCase("style")){ if (currentElement.equalsIgnoreCase("name")) myRecipe.setStyle(s.trim()); } else if (currentList.equalsIgnoreCase("recipe")){ if (currentElement.equalsIgnoreCase("name")) myRecipe.setName(s.trim()); if (currentElement.equalsIgnoreCase("brewer")) myRecipe.setBrewer(s.trim()); if (currentElement.equalsIgnoreCase("BATCH_SIZE")){ myRecipe.setPostBoil(Double.parseDouble(s.trim())); myRecipe.setVolUnits("l"); } if (currentElement.equalsIgnoreCase("BOIL_TIME")) myRecipe.setBoilMinutes(new Double(s.trim()).intValue()); if (currentElement.equalsIgnoreCase("EFFICIENCY")) myRecipe.setEfficiency(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("EFFICIENCY")) myRecipe.setEfficiency(Double.parseDouble(s.trim())); if (currentElement.equalsIgnoreCase("IBU_METHOD")) myRecipe.setIBUMethod(s.trim()); } } }
| 1,116,989
|
public void startElement(String namespaceURI, String lName, // local unit String qName, // qualified unit Attributes attrs) throws SAXException { String eName = lName; // element unit if ("".equals(eName)) eName = qName; // namespaceAware = false currentElement = eName; currentAttributes = attrs; if (eName.equalsIgnoreCase("recipe")){ newRecipe = true; myRecipe = new Recipe(); currentList = eName; } if (eName.equalsIgnoreCase("hops") || eName.equalsIgnoreCase("FERMENTABLES") || eName.equalsIgnoreCase("MISCS") || qName.equalsIgnoreCase("yeasts") || qName.equalsIgnoreCase("waters") || qName.equalsIgnoreCase("style") || qName.equalsIgnoreCase("equipment") || qName.equalsIgnoreCase("mash")){ currentList = eName; } if (eName.equalsIgnoreCase("hop")){ h = new Hop(); } if (eName.equalsIgnoreCase("FERMENTABLE")){ f = new Fermentable(); } if (eName.equalsIgnoreCase("notes")){ descrBuf = ""; } }
|
public void startElement(String namespaceURI, String lName, // local unit String qName, // qualified unit Attributes attrs) throws SAXException { String eName = lName; // element unit if ("".equals(eName)) eName = qName; // namespaceAware = false currentElement = eName; currentAttributes = attrs; if (eName.equalsIgnoreCase("recipe")){ newRecipe = true; myRecipe = new Recipe(); currentList = eName; } if (eName.equalsIgnoreCase("MISC")){ m = new Misc(); } if (qName.equalsIgnoreCase("MASH_STEP")){ myRecipe.mash.addStep(); } if (eName.equalsIgnoreCase("hops") || eName.equalsIgnoreCase("FERMENTABLES") || eName.equalsIgnoreCase("MISCS") || qName.equalsIgnoreCase("yeasts") || qName.equalsIgnoreCase("waters") || qName.equalsIgnoreCase("style") || qName.equalsIgnoreCase("equipment") || qName.equalsIgnoreCase("mash")){ currentList = eName; } if (eName.equalsIgnoreCase("MISC")){ m = new Misc(); } if (qName.equalsIgnoreCase("MASH_STEP")){ myRecipe.mash.addStep(); } if (eName.equalsIgnoreCase("hop")){ h = new Hop(); } if (eName.equalsIgnoreCase("MISC")){ m = new Misc(); } if (qName.equalsIgnoreCase("MASH_STEP")){ myRecipe.mash.addStep(); } if (eName.equalsIgnoreCase("FERMENTABLE")){ f = new Fermentable(); } if (eName.equalsIgnoreCase("MISC")){ m = new Misc(); } if (qName.equalsIgnoreCase("MASH_STEP")){ myRecipe.mash.addStep(); } if (eName.equalsIgnoreCase("notes")){ descrBuf = ""; } if (eName.equalsIgnoreCase("MISC")){ m = new Misc(); } if (qName.equalsIgnoreCase("MASH_STEP")){ myRecipe.mash.addStep(); } } if (eName.equalsIgnoreCase("MISC")){ m = new Misc(); } if (qName.equalsIgnoreCase("MASH_STEP")){ myRecipe.mash.addStep(); }
| 1,116,991
|
public String getIconFileName() { return "save.png"; }
|
public String getIconFileName() { return "save.gif"; }
| 1,116,992
|
public void testExternalDocument() { ExternalDocument loaded = new ExternalDocument(); loaded.setDocCode("TEST"); expect(hibernateTemplate.load(ExternalDocument.class, 5)).andReturn(loaded); replay(hibernateTemplate); ExternalDocumentForm externalDocumentForm = new ExternalDocumentForm(); BeanWrapper bw = new BeanWrapperImpl(externalDocumentForm); registrar.registerCustomEditors(bw); bw.setPropertyValue("externalDocument", "5"); verify(hibernateTemplate); assertSame(loaded, externalDocumentForm.getExternalDocument()); String docCode = ((ExternalDocument) bw.getPropertyValue("externalDocument")).getDocCode(); assertEquals("TEST", docCode); }
|
public void testExternalDocument() { ExternalDocument loaded = new ExternalDocument(); loaded.setDocCode("TEST"); expect(hibernateTemplate.load(ExternalDocument.class, new Long(5))).andReturn(loaded); replay(hibernateTemplate); ExternalDocumentForm externalDocumentForm = new ExternalDocumentForm(); BeanWrapper bw = new BeanWrapperImpl(externalDocumentForm); registrar.registerCustomEditors(bw); bw.setPropertyValue("externalDocument", "5"); verify(hibernateTemplate); assertSame(loaded, externalDocumentForm.getExternalDocument()); String docCode = ((ExternalDocument) bw.getPropertyValue("externalDocument")).getDocCode(); assertEquals("TEST", docCode); }
| 1,116,993
|
public void initFrame(){ // setSize(new java.awt.Dimension (mywidth, myheight)); //setPreferredSize(new java.awt.Dimension (mywidth, myheight)); setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.fill = gbc.BOTH; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; JLabel netLabel = new JLabel(bundle.getString("LABEL_NETWORKS")); JLabel staLabel = new JLabel(bundle.getString("LABEL_STATIONS")); JLabel siLabel = new JLabel(bundle.getString("LABEL_SITES")); JLabel orientationLabel = new JLabel(bundle.getString("LABEL_ORIENTATIONS")); JLabel chLabel = new JLabel(bundle.getString("LABEL_CHANNELS")); netLabel.setToolTipText(lnettip); staLabel.setToolTipText(lstatip); siLabel.setToolTipText(lsittip); chLabel.setToolTipText(lchatip); add(netLabel, gbc); gbc.gridx++; add(staLabel, gbc); gbc.gridx++; if (showSites) { add(siLabel, gbc); gbc.gridx++; } // end of if (showSites) add(orientationLabel, gbc); gbc.gridx++; add(chLabel, gbc); gbc.gridx++; gbc.gridy++; gbc.gridx = 0; gbc.weighty = 1.0; final ListCellRenderer renderer = new NameListCellRenderer(true); networkList = new JList(networks); networkList.setCellRenderer(renderer); networkList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); networkList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } final NetworkAccess[] nets = getSelectedNetworks(); stations.clear(); Thread stationLoader = new Thread() { public void run() { try { for (int i=0; i<nets.length; i++) { Station[] newStations = nets[i].retrieve_stations(); logger.debug("got "+newStations.length+" stations"); for (int j=0; j<newStations.length; j++) { stations.addElement(newStations[j]); } logger.debug("finished adding stations"); } // end of for ((int i=0; i<nets.length; i++) } catch (Exception e) { edu.sc.seis.fissuresUtil.exceptionHandlerGUI.ExceptionHandlerGUI.handleException(e); } // end of try-catch } }; stationLoader.start(); } } ); JScrollPane scroller = new JScrollPane(networkList); add(scroller, gbc); gbc.gridx++; stationList = new JList(stations); stationList.setCellRenderer(renderer); stationList.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); stationList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } ListSelectionModel selModel = stationList.getSelectionModel(); // assume only one selected network at at time... NetworkAccess[] nets = getSelectedNetworks(); NetworkAccess net = nets[0]; for (int i=e.getFirstIndex(); i<=e.getLastIndex(); i++) { if (stationList.isSelectedIndex(i)) { Station selectedStation = (Station)stations.getElementAt(i); Channel[] chans = net.retrieve_for_station(selectedStation.get_id()); for (int j=0; j<chans.length; j++) { String chanKey = ChannelIdUtil.toString(chans[j].get_id()); if ( ! channelMap.containsKey(chanKey)) { channelMap.put(chanKey, chans[j]); if ( ! sites.contains(chans[j].my_site.get_code())) { sites.addElement(chans[j].my_site.get_code()); } if ( ! channels.contains(chans[j].get_code())) { channels.addElement(chans[j].get_code()); } } } // end of for (int j=0; j<chans.length; j++) } else { Station selectedStation = (Station)stations.getElementAt(i); Channel[] chans = net.retrieve_for_station(selectedStation.get_id()); for (int j=0; j<chans.length; j++) { String chanKey = ChannelIdUtil.toString(chans[j].get_id()); if ( channelMap.containsKey(chanKey)) { channelMap.remove(chanKey); } } } } // end of for (int i=e.getFirstIndex(); i<e.getLastIndex(); i++) } } ); scroller = new JScrollPane(stationList); add(scroller, gbc); gbc.gridx++; siteList = new JList(sites); siteList.setCellRenderer(renderer); siteList.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); scroller = new JScrollPane(siteList); if (showSites) { add(scroller, gbc); gbc.gridx++; } final ListCellRenderer bundleRenderer = new BundleListCellRenderer(); String[] orientationTypes = new String[4]; orientationTypes[THREE_COMPONENT] = "THREE_COMPONENT"; orientationTypes[VERTICAL_ONLY] = "VERTICAL_ONLY"; orientationTypes[HORIZONTAL_ONLY] = "HORIZONTAL_ONLY"; orientationTypes[INDIVIDUAL_CHANNELS] = "INDIVIDUAL_CHANNELS"; orientationList = new JList(orientationTypes); orientationList.setCellRenderer(bundleRenderer); orientationList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); orientationList.getSelectionModel().setSelectionInterval(autoSelectedOrientation, autoSelectedOrientation); orientationList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } String selected = (String)orientationList.getSelectedValue(); if ((selected.equals("THREE_COMPONENT") || selected.equals("VERTICAL_ONLY") || selected.equals("HORIZONTAL_ONLY")) && channelList.getModel() != bandListModel) { channelList.setModel(bandListModel); channelList.setCellRenderer(bundleRenderer); } else if (selected.equals("INDIVIDUAL_CHANNELS") && channelList.getModel() != channels) { channelList.setModel(channels); channelList.setCellRenderer(renderer); } } }); scroller = new JScrollPane(orientationList); add(scroller, gbc); gbc.gridx++; bandListModel.addElement("LONG_PERIOD"); bandListModel.addElement("BROAD_BAND"); bandListModel.addElement("SHORT_PERIOD"); bandListModel.addElement("VERY_LONG_PERIOD"); bandListModel.addElement("ULTRA_LONG_PERIOD"); bandListModel.addElement("EXTREMELY_LONG_PERIOD"); bandListModel.addElement("MID_PERIOD"); bandListModel.addElement("EXTREMELY_SHORT_PERIOD"); bandListModel.addElement("HIGH_BROAD_BAND"); bandListModel.addElement("ADMINISTRATIVE"); bandListModel.addElement("WEATHER_ENVIRONMENTAL"); bandListModel.addElement("EXPERIMENTAL"); if (autoSelectedOrientation == INDIVIDUAL_CHANNELS) { channelList = new JList(channels); channelList.setCellRenderer(renderer); } else { channelList = new JList(bandListModel); channelList.setCellRenderer(bundleRenderer); } // end of else channelList.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); ListModel chanListModel = channelList.getModel(); ListSelectionModel channelSelctionModel = channelList.getSelectionModel(); for (int j=0; j<autoSelectBandGain.length; j++) { for (int i=0; i<chanListModel.getSize(); i++) { String listElement = (String)chanListModel.getElementAt(i); System.out.println(bundle.getString("CODE_"+listElement)+" = "+autoSelectBandGain[j]); if (bundle.getString("CODE_"+listElement).equals(autoSelectBandGain[j])) { channelSelctionModel.addSelectionInterval(i,i); break; } } // end of for (int i=0; i<chanListModel; i++) } // end of for (int j=0; j<autoSelectBandGain.length; j++) scroller = new JScrollPane(channelList); add(scroller, gbc); gbc.gridx++; }
|
public void initFrame(){ // setSize(new java.awt.Dimension (mywidth, myheight)); //setPreferredSize(new java.awt.Dimension (mywidth, myheight)); setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.fill = gbc.BOTH; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; JLabel netLabel = new JLabel(bundle.getString("LABEL_NETWORKS")); JLabel staLabel = new JLabel(bundle.getString("LABEL_STATIONS")); JLabel siLabel = new JLabel(bundle.getString("LABEL_SITES")); JLabel orientationLabel = new JLabel(bundle.getString("LABEL_ORIENTATIONS")); JLabel chLabel = new JLabel(bundle.getString("LABEL_CHANNELS")); netLabel.setToolTipText(lnettip); staLabel.setToolTipText(lstatip); siLabel.setToolTipText(lsittip); chLabel.setToolTipText(lchatip); add(netLabel, gbc); gbc.gridx++; add(staLabel, gbc); gbc.gridx++; if (showSites) { add(siLabel, gbc); gbc.gridx++; } // end of if (showSites) add(orientationLabel, gbc); gbc.gridx++; add(chLabel, gbc); gbc.gridx++; gbc.gridy++; gbc.gridx = 0; gbc.weighty = 1.0; final ListCellRenderer renderer = new NameListCellRenderer(true); networkList = new JList(networks); networkList.setCellRenderer(renderer); networkList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); networkList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } final NetworkAccess[] nets = getSelectedNetworks(); Thread stationLoader = new Thread() { public void run() { try { for (int i=0; i<nets.length; i++) { Station[] newStations = nets[i].retrieve_stations(); logger.debug("got "+newStations.length+" stations"); for (int j=0; j<newStations.length; j++) { stations.addElement(newStations[j]); } logger.debug("finished adding stations"); } // end of for ((int i=0; i<nets.length; i++) } catch (Exception e) { edu.sc.seis.fissuresUtil.exceptionHandlerGUI.ExceptionHandlerGUI.handleException(e); } // end of try-catch } }; stationLoader.start(); } } ); JScrollPane scroller = new JScrollPane(networkList); add(scroller, gbc); gbc.gridx++; stationList = new JList(stations); stationList.setCellRenderer(renderer); stationList.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); stationList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } ListSelectionModel selModel = stationList.getSelectionModel(); // assume only one selected network at at time... NetworkAccess[] nets = getSelectedNetworks(); NetworkAccess net = nets[0]; for (int i=e.getFirstIndex(); i<=e.getLastIndex(); i++) { if (stationList.isSelectedIndex(i)) { Station selectedStation = (Station)stations.getElementAt(i); Channel[] chans = net.retrieve_for_station(selectedStation.get_id()); for (int j=0; j<chans.length; j++) { String chanKey = ChannelIdUtil.toString(chans[j].get_id()); if ( ! channelMap.containsKey(chanKey)) { channelMap.put(chanKey, chans[j]); if ( ! sites.contains(chans[j].my_site.get_code())) { sites.addElement(chans[j].my_site.get_code()); } if ( ! channels.contains(chans[j].get_code())) { channels.addElement(chans[j].get_code()); } } } // end of for (int j=0; j<chans.length; j++) } else { Station selectedStation = (Station)stations.getElementAt(i); Channel[] chans = net.retrieve_for_station(selectedStation.get_id()); for (int j=0; j<chans.length; j++) { String chanKey = ChannelIdUtil.toString(chans[j].get_id()); if ( channelMap.containsKey(chanKey)) { channelMap.remove(chanKey); } } } } // end of for (int i=e.getFirstIndex(); i<e.getLastIndex(); i++) } } ); scroller = new JScrollPane(stationList); add(scroller, gbc); gbc.gridx++; siteList = new JList(sites); siteList.setCellRenderer(renderer); siteList.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); scroller = new JScrollPane(siteList); if (showSites) { add(scroller, gbc); gbc.gridx++; } final ListCellRenderer bundleRenderer = new BundleListCellRenderer(); String[] orientationTypes = new String[4]; orientationTypes[THREE_COMPONENT] = "THREE_COMPONENT"; orientationTypes[VERTICAL_ONLY] = "VERTICAL_ONLY"; orientationTypes[HORIZONTAL_ONLY] = "HORIZONTAL_ONLY"; orientationTypes[INDIVIDUAL_CHANNELS] = "INDIVIDUAL_CHANNELS"; orientationList = new JList(orientationTypes); orientationList.setCellRenderer(bundleRenderer); orientationList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); orientationList.getSelectionModel().setSelectionInterval(autoSelectedOrientation, autoSelectedOrientation); orientationList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } String selected = (String)orientationList.getSelectedValue(); if ((selected.equals("THREE_COMPONENT") || selected.equals("VERTICAL_ONLY") || selected.equals("HORIZONTAL_ONLY")) && channelList.getModel() != bandListModel) { channelList.setModel(bandListModel); channelList.setCellRenderer(bundleRenderer); } else if (selected.equals("INDIVIDUAL_CHANNELS") && channelList.getModel() != channels) { channelList.setModel(channels); channelList.setCellRenderer(renderer); } } }); scroller = new JScrollPane(orientationList); add(scroller, gbc); gbc.gridx++; bandListModel.addElement("LONG_PERIOD"); bandListModel.addElement("BROAD_BAND"); bandListModel.addElement("SHORT_PERIOD"); bandListModel.addElement("VERY_LONG_PERIOD"); bandListModel.addElement("ULTRA_LONG_PERIOD"); bandListModel.addElement("EXTREMELY_LONG_PERIOD"); bandListModel.addElement("MID_PERIOD"); bandListModel.addElement("EXTREMELY_SHORT_PERIOD"); bandListModel.addElement("HIGH_BROAD_BAND"); bandListModel.addElement("ADMINISTRATIVE"); bandListModel.addElement("WEATHER_ENVIRONMENTAL"); bandListModel.addElement("EXPERIMENTAL"); if (autoSelectedOrientation == INDIVIDUAL_CHANNELS) { channelList = new JList(channels); channelList.setCellRenderer(renderer); } else { channelList = new JList(bandListModel); channelList.setCellRenderer(bundleRenderer); } // end of else channelList.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); ListModel chanListModel = channelList.getModel(); ListSelectionModel channelSelctionModel = channelList.getSelectionModel(); for (int j=0; j<autoSelectBandGain.length; j++) { for (int i=0; i<chanListModel.getSize(); i++) { String listElement = (String)chanListModel.getElementAt(i); System.out.println(bundle.getString("CODE_"+listElement)+" = "+autoSelectBandGain[j]); if (bundle.getString("CODE_"+listElement).equals(autoSelectBandGain[j])) { channelSelctionModel.addSelectionInterval(i,i); break; } } // end of for (int i=0; i<chanListModel; i++) } // end of for (int j=0; j<autoSelectBandGain.length; j++) scroller = new JScrollPane(channelList); add(scroller, gbc); gbc.gridx++; }
| 1,116,994
|
public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } final NetworkAccess[] nets = getSelectedNetworks(); stations.clear(); Thread stationLoader = new Thread() { public void run() { try { for (int i=0; i<nets.length; i++) { Station[] newStations = nets[i].retrieve_stations(); logger.debug("got "+newStations.length+" stations"); for (int j=0; j<newStations.length; j++) { stations.addElement(newStations[j]); } logger.debug("finished adding stations"); } // end of for ((int i=0; i<nets.length; i++) } catch (Exception e) { edu.sc.seis.fissuresUtil.exceptionHandlerGUI.ExceptionHandlerGUI.handleException(e); } // end of try-catch } }; stationLoader.start(); }
|
public void valueChanged(ListSelectionEvent e) { if(e.getValueIsAdjusting()){ return; } final NetworkAccess[] nets = getSelectedNetworks(); Thread stationLoader = new Thread() { public void run() { try { for (int i=0; i<nets.length; i++) { Station[] newStations = nets[i].retrieve_stations(); logger.debug("got "+newStations.length+" stations"); for (int j=0; j<newStations.length; j++) { stations.addElement(newStations[j]); } logger.debug("finished adding stations"); } // end of for ((int i=0; i<nets.length; i++) } catch (Exception e) { edu.sc.seis.fissuresUtil.exceptionHandlerGUI.ExceptionHandlerGUI.handleException(e); } // end of try-catch } }; stationLoader.start(); }
| 1,116,996
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { ImportXml imp = new ImportXml(myContents.getOpenFilename()); myParent.setRecipe(imp.handler.getRecipe()); } }
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { ImportXml imp = new ImportXml(myContents.getOpenFilename()); try { Recipe recipe = imp.handler.getRecipe(); if (recipe != null) { myParent.setRecipe(recipe); } else { System.out.println("Recipe is null for some reason."); } } catch(Exception e) { System.out.print("Problem loading "); System.out.println(myContents.getOpenFilename()); } } }
| 1,117,000
|
public void setValueAt(Object value, int row, int col) { Fermentable m = (Fermentable) data.get(row); try { switch (col) { case 0 : m.setName(value.toString()); if (NewSwingApp.DEBUG){ System.out.println("value is:" + value); } case 1 : m.setAmount(Double.parseDouble(value.toString())); case 2 : m.setUnits(value.toString()); case 3 : m.setPppg(Double.parseDouble(value.toString())); case 4 : m.setLov(Double.parseDouble(value.toString())); case 5 : m.setCost(Double.parseDouble(value.toString())); case 6 : m.setPercent(Double.parseDouble(value.toString())); } } catch (Exception e) { }; fireTableCellUpdated(row, col); }
|
public void setValueAt(Object value, int row, int col) { Fermentable m = (Fermentable) data.get(row); try { switch (col) { case 0 : m.setName(value.toString()); /* if (NewSwingApp.DEBUG){ System.out.println("value is:" + value); } case 1 : m.setAmount(Double.parseDouble(value.toString())); case 2 : m.setUnits(value.toString()); case 3 : m.setPppg(Double.parseDouble(value.toString())); case 4 : m.setLov(Double.parseDouble(value.toString())); case 5 : m.setCost(Double.parseDouble(value.toString())); case 6 : m.setPercent(Double.parseDouble(value.toString())); } } catch (Exception e) { }; fireTableCellUpdated(row, col); }
| 1,117,001
|
public void setValueAt(Object value, int row, int col) { Fermentable m = (Fermentable) data.get(row); try { switch (col) { case 0 : m.setName(value.toString()); if (NewSwingApp.DEBUG){ System.out.println("value is:" + value); } case 1 : m.setAmount(Double.parseDouble(value.toString())); case 2 : m.setUnits(value.toString()); case 3 : m.setPppg(Double.parseDouble(value.toString())); case 4 : m.setLov(Double.parseDouble(value.toString())); case 5 : m.setCost(Double.parseDouble(value.toString())); case 6 : m.setPercent(Double.parseDouble(value.toString())); } } catch (Exception e) { }; fireTableCellUpdated(row, col); }
|
public void setValueAt(Object value, int row, int col) { Fermentable m = (Fermentable) data.get(row); try { switch (col) { case 0 : m.setName(value.toString()); if (NewSwingApp.DEBUG){ System.out.println("value is:" + value); }*/ case 1 : m.setAmount(Double.parseDouble(value.toString())); case 2 : m.setUnits(value.toString()); case 3 : m.setPppg(Double.parseDouble(value.toString())); case 4 : m.setLov(Double.parseDouble(value.toString())); case 5 : m.setCost(Double.parseDouble(value.toString())); case 6 : m.setPercent(Double.parseDouble(value.toString())); }*/ }*/ catch (Exception e) { }*/; fireTableCellUpdated(row, col); }*/
| 1,117,002
|
public Publisher newInstance(StaplerRequest req) { return new SQETestResultPublisher(req.getParameter("sqetest_includes")); }
|
public Publisher newInstance(StaplerRequest req) { return new SQETestResultPublisher(req.getParameter("sqetest_includes"),(req.getParameter("sqetest_testobject")!=null)); }
| 1,117,003
|
public SQETestResultPublisher(String includes) { this.includes = includes; }
|
public SQETestResultPublisher(String includes, boolean considerTestAsTestObject) { this.includes = includes; }
| 1,117,004
|
public boolean perform(Build build, Launcher launcher, BuildListener listener) { FileSet fs = new FileSet(); org.apache.tools.ant.Project p = new org.apache.tools.ant.Project(); fs.setProject(p); fs.setDir(build.getProject().getWorkspace().getLocal()); fs.setIncludes(includes); DirectoryScanner ds = fs.getDirectoryScanner(p); if(ds.getIncludedFiles().length==0) { listener.getLogger().println("No SQE test report files wer efound. Configuration error?"); // no test result. Most likely a configuration error or fatal problem build.setResult(Result.FAILURE); } SQETestAction action = new SQETestAction(build, ds, listener); build.getActions().add(action); Report r = action.getResult(); if(r.getTotalCount()==0) { listener.getLogger().println("Test reports were found but none of them are new. Did tests run?"); // no test result. Most likely a configuration error or fatal problem build.setResult(Result.FAILURE); } if(r.getFailCount()>0) build.setResult(Result.UNSTABLE); return true; }
|
public boolean perform(Build build, Launcher launcher, BuildListener listener) { FileSet fs = new FileSet(); org.apache.tools.ant.Project p = new org.apache.tools.ant.Project(); fs.setProject(p); fs.setDir(build.getProject().getWorkspace().getLocal()); fs.setIncludes(includes); DirectoryScanner ds = fs.getDirectoryScanner(p); if(ds.getIncludedFiles().length==0) { listener.getLogger().println("No SQE test report files wer efound. Configuration error?"); // no test result. Most likely a configuration error or fatal problem build.setResult(Result.FAILURE); } SQETestAction action = new SQETestAction(build, ds, listener, considerTestAsTestObject); build.getActions().add(action); Report r = action.getResult(); if(r.getTotalCount()==0) { listener.getLogger().println("Test reports were found but none of them are new. Did tests run?"); // no test result. Most likely a configuration error or fatal problem build.setResult(Result.FAILURE); } if(r.getFailCount()>0) build.setResult(Result.UNSTABLE); return true; }
| 1,117,006
|
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return SBStringUtils.dateFormatShort.format(data.getNoteDate(row)); case 1 : return data.getNoteType(row); case 2 : return data.getNoteNote(row); } } catch (Exception e) { }; return ""; }
|
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return SBStringUtils.dateFormatShort.format(data.getNoteDate(row)); case 1 : return data.getNoteType(row); case 2 : return data.getNoteNote(row); } } catch (Exception e) { }; return ""; }
| 1,117,007
|
public void setValueAt(Object value, int row, int col) { try { switch (col) { case 0 : try { Date d = SBStringUtils.dateFormatShort.parse(value.toString()); data.setNoteDate(row, d); } catch (ParseException e) { System.out.println("Unable to parse " + value.toString()); } break; case 1 : data.setNoteType(row, value.toString()); break; case 2 : data.setNoteNote(row, value.toString()); break; } } catch (Exception e) { }; fireTableCellUpdated(row, col); fireTableDataChanged(); }
|
public void setValueAt(Object value, int row, int col) { try { switch (col) { case 0 : try { Date d = SBStringUtils.dateFormatShort.parse(value.toString()); data.setNoteDate(row, d); } catch (ParseException e) { System.out.println("Unable to parse " + value.toString()); } break; case 1 : data.setNoteType(row, value.toString()); break; case 2 : data.setNoteNote(row, value.toString()); break; } } catch (Exception e) { }; fireTableCellUpdated(row, col); fireTableDataChanged(); }
| 1,117,008
|
private void initGUI() { try { BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { tablePanel = new JPanel(); BoxLayout tablePanelLayout = new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS); tablePanel.setLayout(tablePanelLayout); this.add(tablePanel); { notesTableScroll = new JScrollPane(); tablePanel.add(notesTableScroll); notesTableScroll.setPreferredSize(new java.awt.Dimension(235, 264)); { notesTableModel = new NotesTableModel(myRecipe); notesTable = new JTable(); notesTableScroll.setViewportView(notesTable); notesTable.setModel(notesTableModel); // set up type combo String[] types = {"Planning", "Brewed", "Fermentation", "Racked", "Conditioned", "Kegged", "Bottled", "Tasting", "Contest"}; JComboBox typeComboBox = new JComboBox(types); TableColumn noteColumn = notesTable.getColumnModel().getColumn(1); noteColumn.setCellEditor(new DefaultCellEditor(typeComboBox)); notesTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = notesTable.getSelectedRow(); noteTextArea.setText(myRecipe.getNoteNote(i)); } }); // set up the date picker DateEditor dateEditor = new DateEditor(); noteColumn = notesTable.getColumnModel().getColumn(0); noteColumn.setCellEditor(dateEditor); } } { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); { addNoteButton = new JButton(); buttonsPanel.add(addNoteButton); addNoteButton.setText("+"); addNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Note n = new Note(); myRecipe.addNote(n); notesTable.updateUI(); } } }); } { delNoteButton = new JButton(); buttonsPanel.add(delNoteButton); delNoteButton.setText("-"); delNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = notesTable.getSelectedRow(); myRecipe.delNote(i); notesTable.updateUI(); } } }); } } } { notePanel = new JPanel(); BoxLayout notePanelLayout = new BoxLayout(notePanel, javax.swing.BoxLayout.Y_AXIS); notePanel.setLayout(notePanelLayout); this.add(notePanel); notePanel.setBorder(BorderFactory.createTitledBorder("Note:")); { noteScroll = new JScrollPane(); notePanel.add(noteScroll); { noteTextArea = new JTextArea(); noteScroll.setViewportView(noteTextArea); noteTextArea.setWrapStyleWord(true); noteTextArea.setLineWrap(true); noteTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } } }); noteTextArea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { selectedRow = notesTable.getSelectedRow(); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
|
private void initGUI() { try { BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { tablePanel = new JPanel(); BoxLayout tablePanelLayout = new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS); tablePanel.setLayout(tablePanelLayout); this.add(tablePanel); { notesTableScroll = new JScrollPane(); tablePanel.add(notesTableScroll); notesTableScroll.setPreferredSize(new java.awt.Dimension(235, 264)); { notesTableModel = new NotesTableModel(myRecipe); notesTable = new JTable(); notesTableScroll.setViewportView(notesTable); notesTable.setModel(notesTableModel); // set up type combo String[] types = {"Planning", "Brewed", "Fermentation", "Racked", "Conditioned", "Kegged", "Bottled", "Tasting", "Contest"}; JComboBox typeComboBox = new JComboBox(types); TableColumn noteColumn = notesTable.getColumnModel().getColumn(1); noteColumn.setCellEditor(new DefaultCellEditor(typeComboBox)); notesTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = notesTable.getSelectedRow(); noteTextArea.setText(myRecipe.getNoteNote(i)); } }); // set up the date picker DateEditor dateEditor = new DateEditor(); noteColumn = notesTable.getColumnModel().getColumn(0); noteColumn.setCellEditor(dateEditor); } } { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); { addNoteButton = new JButton(); buttonsPanel.add(addNoteButton); addNoteButton.setText("+"); addNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Note n = new Note(); myRecipe.addNote(n); notesTable.updateUI(); } } }); } { delNoteButton = new JButton(); buttonsPanel.add(delNoteButton); delNoteButton.setText("-"); delNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = notesTable.getSelectedRow(); myRecipe.delNote(i); notesTable.updateUI(); } } }); } } } { notePanel = new JPanel(); BoxLayout notePanelLayout = new BoxLayout(notePanel, javax.swing.BoxLayout.Y_AXIS); notePanel.setLayout(notePanelLayout); this.add(notePanel); notePanel.setBorder(BorderFactory.createTitledBorder("Note:")); { noteScroll = new JScrollPane(); notePanel.add(noteScroll); { noteTextArea = new JTextArea(); noteScroll.setViewportView(noteTextArea); noteTextArea.setWrapStyleWord(true); noteTextArea.setLineWrap(true); noteTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } } }); noteTextArea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { selectedRow = notesTable.getSelectedRow(); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
| 1,117,009
|
private void initGUI() { try { BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { tablePanel = new JPanel(); BoxLayout tablePanelLayout = new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS); tablePanel.setLayout(tablePanelLayout); this.add(tablePanel); { notesTableScroll = new JScrollPane(); tablePanel.add(notesTableScroll); notesTableScroll.setPreferredSize(new java.awt.Dimension(235, 264)); { notesTableModel = new NotesTableModel(myRecipe); notesTable = new JTable(); notesTableScroll.setViewportView(notesTable); notesTable.setModel(notesTableModel); // set up type combo String[] types = {"Planning", "Brewed", "Fermentation", "Racked", "Conditioned", "Kegged", "Bottled", "Tasting", "Contest"}; JComboBox typeComboBox = new JComboBox(types); TableColumn noteColumn = notesTable.getColumnModel().getColumn(1); noteColumn.setCellEditor(new DefaultCellEditor(typeComboBox)); notesTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = notesTable.getSelectedRow(); noteTextArea.setText(myRecipe.getNoteNote(i)); } }); // set up the date picker DateEditor dateEditor = new DateEditor(); noteColumn = notesTable.getColumnModel().getColumn(0); noteColumn.setCellEditor(dateEditor); } } { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); { addNoteButton = new JButton(); buttonsPanel.add(addNoteButton); addNoteButton.setText("+"); addNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Note n = new Note(); myRecipe.addNote(n); notesTable.updateUI(); } } }); } { delNoteButton = new JButton(); buttonsPanel.add(delNoteButton); delNoteButton.setText("-"); delNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = notesTable.getSelectedRow(); myRecipe.delNote(i); notesTable.updateUI(); } } }); } } } { notePanel = new JPanel(); BoxLayout notePanelLayout = new BoxLayout(notePanel, javax.swing.BoxLayout.Y_AXIS); notePanel.setLayout(notePanelLayout); this.add(notePanel); notePanel.setBorder(BorderFactory.createTitledBorder("Note:")); { noteScroll = new JScrollPane(); notePanel.add(noteScroll); { noteTextArea = new JTextArea(); noteScroll.setViewportView(noteTextArea); noteTextArea.setWrapStyleWord(true); noteTextArea.setLineWrap(true); noteTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } } }); noteTextArea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { selectedRow = notesTable.getSelectedRow(); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
|
private void initGUI() { try { BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { tablePanel = new JPanel(); BoxLayout tablePanelLayout = new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS); tablePanel.setLayout(tablePanelLayout); this.add(tablePanel); { notesTableScroll = new JScrollPane(); tablePanel.add(notesTableScroll); notesTableScroll.setPreferredSize(new java.awt.Dimension(235, 264)); { notesTableModel = new NotesTableModel(myRecipe); notesTable = new JTable(); notesTableScroll.setViewportView(notesTable); notesTable.setModel(notesTableModel); // set up type combo String[] types = {"Planning", "Brewed", "Fermentation", "Racked", "Conditioned", "Kegged", "Bottled", "Tasting", "Contest"}; JComboBox typeComboBox = new JComboBox(types); TableColumn noteColumn = notesTable.getColumnModel().getColumn(1); noteColumn.setCellEditor(new DefaultCellEditor(typeComboBox)); notesTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = notesTable.getSelectedRow(); noteTextArea.setText(myRecipe.getNoteNote(i)); } }); // set up the date picker DateEditor dateEditor = new DateEditor(); noteColumn = notesTable.getColumnModel().getColumn(0); noteColumn.setCellEditor(dateEditor); } } { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); { addNoteButton = new JButton(); buttonsPanel.add(addNoteButton); addNoteButton.setText("+"); addNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Note n = new Note(); myRecipe.addNote(n); notesTable.updateUI(); } } }); } { delNoteButton = new JButton(); buttonsPanel.add(delNoteButton); delNoteButton.setText("-"); delNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = notesTable.getSelectedRow(); myRecipe.delNote(i); notesTable.updateUI(); } } }); } } } { notePanel = new JPanel(); BoxLayout notePanelLayout = new BoxLayout(notePanel, javax.swing.BoxLayout.Y_AXIS); notePanel.setLayout(notePanelLayout); this.add(notePanel); notePanel.setBorder(BorderFactory.createTitledBorder("Note:")); { noteScroll = new JScrollPane(); notePanel.add(noteScroll); { noteTextArea = new JTextArea(); noteScroll.setViewportView(noteTextArea); noteTextArea.setWrapStyleWord(true); noteTextArea.setLineWrap(true); noteTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } } }); noteTextArea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { selectedRow = notesTable.getSelectedRow(); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
| 1,117,010
|
private void initGUI() { try { BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { tablePanel = new JPanel(); BoxLayout tablePanelLayout = new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS); tablePanel.setLayout(tablePanelLayout); this.add(tablePanel); { notesTableScroll = new JScrollPane(); tablePanel.add(notesTableScroll); notesTableScroll.setPreferredSize(new java.awt.Dimension(235, 264)); { notesTableModel = new NotesTableModel(myRecipe); notesTable = new JTable(); notesTableScroll.setViewportView(notesTable); notesTable.setModel(notesTableModel); // set up type combo String[] types = {"Planning", "Brewed", "Fermentation", "Racked", "Conditioned", "Kegged", "Bottled", "Tasting", "Contest"}; JComboBox typeComboBox = new JComboBox(types); TableColumn noteColumn = notesTable.getColumnModel().getColumn(1); noteColumn.setCellEditor(new DefaultCellEditor(typeComboBox)); notesTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = notesTable.getSelectedRow(); noteTextArea.setText(myRecipe.getNoteNote(i)); } }); // set up the date picker DateEditor dateEditor = new DateEditor(); noteColumn = notesTable.getColumnModel().getColumn(0); noteColumn.setCellEditor(dateEditor); } } { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); { addNoteButton = new JButton(); buttonsPanel.add(addNoteButton); addNoteButton.setText("+"); addNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Note n = new Note(); myRecipe.addNote(n); notesTable.updateUI(); } } }); } { delNoteButton = new JButton(); buttonsPanel.add(delNoteButton); delNoteButton.setText("-"); delNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = notesTable.getSelectedRow(); myRecipe.delNote(i); notesTable.updateUI(); } } }); } } } { notePanel = new JPanel(); BoxLayout notePanelLayout = new BoxLayout(notePanel, javax.swing.BoxLayout.Y_AXIS); notePanel.setLayout(notePanelLayout); this.add(notePanel); notePanel.setBorder(BorderFactory.createTitledBorder("Note:")); { noteScroll = new JScrollPane(); notePanel.add(noteScroll); { noteTextArea = new JTextArea(); noteScroll.setViewportView(noteTextArea); noteTextArea.setWrapStyleWord(true); noteTextArea.setLineWrap(true); noteTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } } }); noteTextArea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { selectedRow = notesTable.getSelectedRow(); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
|
private void initGUI() { try { BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { tablePanel = new JPanel(); BoxLayout tablePanelLayout = new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS); tablePanel.setLayout(tablePanelLayout); this.add(tablePanel); { notesTableScroll = new JScrollPane(); tablePanel.add(notesTableScroll); notesTableScroll.setPreferredSize(new java.awt.Dimension(235, 264)); { notesTableModel = new NotesTableModel(myRecipe); notesTable = new JTable(); notesTableScroll.setViewportView(notesTable); notesTable.setModel(notesTableModel); // set up type combo String[] types = {"Planning", "Brewed", "Fermentation", "Racked", "Conditioned", "Kegged", "Bottled", "Tasting", "Contest"}; JComboBox typeComboBox = new JComboBox(types); TableColumn noteColumn = notesTable.getColumnModel().getColumn(1); noteColumn.setCellEditor(new DefaultCellEditor(typeComboBox)); notesTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = notesTable.getSelectedRow(); noteTextArea.setText(myRecipe.getNoteNote(i)); } }); // set up the date picker DateEditor dateEditor = new DateEditor(); noteColumn = notesTable.getColumnModel().getColumn(0); noteColumn.setCellEditor(dateEditor); } } { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); { addNoteButton = new JButton(); buttonsPanel.add(addNoteButton); addNoteButton.setText("+"); addNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Note n = new Note(); myRecipe.addNote(n); notesTable.updateUI(); } } }); } { delNoteButton = new JButton(); buttonsPanel.add(delNoteButton); delNoteButton.setText("-"); delNoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = notesTable.getSelectedRow(); myRecipe.delNote(i); notesTable.updateUI(); } } }); } } } { notePanel = new JPanel(); BoxLayout notePanelLayout = new BoxLayout(notePanel, javax.swing.BoxLayout.Y_AXIS); notePanel.setLayout(notePanelLayout); this.add(notePanel); notePanel.setBorder(BorderFactory.createTitledBorder("Note:")); { noteScroll = new JScrollPane(); notePanel.add(noteScroll); { noteTextArea = new JTextArea(); noteScroll.setViewportView(noteTextArea); noteTextArea.setWrapStyleWord(true); noteTextArea.setLineWrap(true); noteTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } } }); noteTextArea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { selectedRow = notesTable.getSelectedRow(); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
| 1,117,011
|
public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } }
|
public void focusLost(FocusEvent evt) { if (selectedRow > -1 && !noteTextArea.getText().equals( myRecipe.getNoteNote(selectedRow))) { myRecipe.setNoteNote(selectedRow, noteTextArea.getText()); } }
| 1,117,012
|
public void adjustRange(MicroSecondDate selectionBegin, MicroSecondDate selectionEnd){ MicroSecondTimeRange currentInternal = internalTimeConfig.getTimeRange(); double timeWidth = externalTimeConfig.getTimeRange().getInterval().getValue(); if(released == true){ double beginDistance = Math.abs(currentInternal.getBeginTime().getMicroSecondTime() - selectionEnd.getMicroSecondTime())/timeWidth; double endDistance = Math.abs(currentInternal.getEndTime().getMicroSecondTime() - selectionBegin.getMicroSecondTime())/timeWidth; if(beginDistance < endDistance) selectedBegin = true; else selectedBegin = false; released = false; }else if(selectionBegin.getMicroSecondTime() > currentInternal.getEndTime().getMicroSecondTime() || selectionEnd.getMicroSecondTime() < currentInternal.getBeginTime().getMicroSecondTime()){ selectedBegin = !selectedBegin; } if(selectedBegin){ internalTimeConfig.setDisplayInterval(new TimeInterval(selectionBegin, currentInternal.getEndTime())); internalTimeConfig.setAllBeginTime(selectionBegin); repaintParents(); }else{ internalTimeConfig.setDisplayInterval(new TimeInterval(currentInternal.getBeginTime(), selectionEnd)); repaintParents(); } }
|
public void adjustRange(MicroSecondDate selectionBegin, MicroSecondDate selectionEnd){ MicroSecondTimeRange currentInternal = internalTimeConfig.getTimeRange(); double timeWidth = externalTimeConfig.getTimeRange().getInterval().getValue(); if(released == true){ double beginDistance = Math.abs(currentInternal.getBeginTime().getMicroSecondTime() - selectionEnd.getMicroSecondTime())/timeWidth; double endDistance = Math.abs(currentInternal.getEndTime().getMicroSecondTime() - selectionBegin.getMicroSecondTime())/timeWidth; if(beginDistance < endDistance) selectedBegin = true; else selectedBegin = false; released = false; }else if(selectionBegin.getMicroSecondTime() > currentInternal.getEndTime().getMicroSecondTime() || selectionEnd.getMicroSecondTime() < currentInternal.getBeginTime().getMicroSecondTime()){ selectedBegin = !selectedBegin; } if(selectedBegin){ internalTimeConfig.setDisplayInterval(new TimeInterval(selectionBegin, currentInternal.getEndTime())); internalTimeConfig.setAllBeginTime(selectionBegin); repaintParents(); }else{ internalTimeConfig.setDisplayInterval(new TimeInterval(currentInternal.getBeginTime(), selectionEnd)); repaintParents(); } }
| 1,117,013
|
public void printHelp() { super.printHelp(); println("'group'\tprints the current group"); println("'group G'\tchanges underlying group to G"); println("'group Z'\tintegers (arbitary precision)"); println("'group Q'\trationals"); println("'group R'\treals, represented as Doubles."); println("'group R 3'\treals reprecented as BigDecimals with 3 decimal places"); println("'group P 3'\tpermutation group on three symbols"); println("\t[1,3,2]+[3,2,1] -> (3,1,2)"); println("'group Zn 5'\tintegers modulo 5"); println("'group Qu'\tQuartonians"); println("'extend x'\textends current group by adding symbol x, i.e. a free group"); println("\tsuch a group can be considered as the ring of polynomials"); println("\tsimplification happens automatically"); println("'extend t a b c'\talgebraic extensions generated by t"); println("\twhere t is a root of the polynomial a t^2 + b t +c=0"); println("\te.g group extend t 1 0 1 gives complex numbers, t^2+1=0."); println("\tfor these groups there is a natural mapping to complex numbers and complex result is also printed."); println("'setRootVal t re im'\tsets the value of free variable 't' in a free group to complex number re+i im"); }
|
public void printHelp() { super.printHelp(); println("'group'\tprints the current group"); println("'group G'\tchanges underlying group to G"); println("'group Z'\tintegers (arbitrary precision)"); println("'group Q'\trationals"); println("'group R'\treals, represented as Doubles."); println("'group R 3'\treals reprecented as BigDecimals with 3 decimal places"); println("'group P 3'\tpermutation group on three symbols"); println("\t[1,3,2]+[3,2,1] -> (3,1,2)"); println("'group Zn 5'\tintegers modulo 5"); println("'group Qu'\tQuartonians"); println("'extend x'\textends current group by adding symbol x, i.e. a free group"); println("\tsuch a group can be considered as the ring of polynomials"); println("\tsimplification happens automatically"); println("'extend t a b c'\talgebraic extensions generated by t"); println("\twhere t is a root of the polynomial a t^2 + b t +c=0"); println("\te.g group extend t 1 0 1 gives complex numbers, t^2+1=0."); println("\tfor these groups there is a natural mapping to complex numbers and complex result is also printed."); println("'setRootVal t re im'\tsets the value of free variable 't' in a free group to complex number re+i im"); }
| 1,117,014
|
public void printHelp() { super.printHelp(); println("'group'\tprints the current group"); println("'group G'\tchanges underlying group to G"); println("'group Z'\tintegers (arbitary precision)"); println("'group Q'\trationals"); println("'group R'\treals, represented as Doubles."); println("'group R 3'\treals reprecented as BigDecimals with 3 decimal places"); println("'group P 3'\tpermutation group on three symbols"); println("\t[1,3,2]+[3,2,1] -> (3,1,2)"); println("'group Zn 5'\tintegers modulo 5"); println("'group Qu'\tQuartonians"); println("'extend x'\textends current group by adding symbol x, i.e. a free group"); println("\tsuch a group can be considered as the ring of polynomials"); println("\tsimplification happens automatically"); println("'extend t a b c'\talgebraic extensions generated by t"); println("\twhere t is a root of the polynomial a t^2 + b t +c=0"); println("\te.g group extend t 1 0 1 gives complex numbers, t^2+1=0."); println("\tfor these groups there is a natural mapping to complex numbers and complex result is also printed."); println("'setRootVal t re im'\tsets the value of free variable 't' in a free group to complex number re+i im"); }
|
public void printHelp() { super.printHelp(); println("'group'\tprints the current group"); println("'group G'\tchanges underlying group to G"); println("'group Z'\tintegers (arbitary precision)"); println("'group Q'\trationals"); println("'group R'\treals, represented as Doubles."); println("'group R 3'\treals represented as BigDecimals with 3 decimal places"); println("'group P 3'\tpermutation group on three symbols"); println("\t[1,3,2]+[3,2,1] -> (3,1,2)"); println("'group Zn 5'\tintegers modulo 5"); println("'group Qu'\tQuartonians"); println("'extend x'\textends current group by adding symbol x, i.e. a free group"); println("\tsuch a group can be considered as the ring of polynomials"); println("\tsimplification happens automatically"); println("'extend t a b c'\talgebraic extensions generated by t"); println("\twhere t is a root of the polynomial a t^2 + b t +c=0"); println("\te.g group extend t 1 0 1 gives complex numbers, t^2+1=0."); println("\tfor these groups there is a natural mapping to complex numbers and complex result is also printed."); println("'setRootVal t re im'\tsets the value of free variable 't' in a free group to complex number re+i im"); }
| 1,117,015
|
public void printHelp() { super.printHelp(); println("'group'\tprints the current group"); println("'group G'\tchanges underlying group to G"); println("'group Z'\tintegers (arbitary precision)"); println("'group Q'\trationals"); println("'group R'\treals, represented as Doubles."); println("'group R 3'\treals reprecented as BigDecimals with 3 decimal places"); println("'group P 3'\tpermutation group on three symbols"); println("\t[1,3,2]+[3,2,1] -> (3,1,2)"); println("'group Zn 5'\tintegers modulo 5"); println("'group Qu'\tQuartonians"); println("'extend x'\textends current group by adding symbol x, i.e. a free group"); println("\tsuch a group can be considered as the ring of polynomials"); println("\tsimplification happens automatically"); println("'extend t a b c'\talgebraic extensions generated by t"); println("\twhere t is a root of the polynomial a t^2 + b t +c=0"); println("\te.g group extend t 1 0 1 gives complex numbers, t^2+1=0."); println("\tfor these groups there is a natural mapping to complex numbers and complex result is also printed."); println("'setRootVal t re im'\tsets the value of free variable 't' in a free group to complex number re+i im"); }
|
public void printHelp() { super.printHelp(); println("'group'\tprints the current group"); println("'group G'\tchanges underlying group to G"); println("'group Z'\tintegers (arbitary precision)"); println("'group Q'\trationals"); println("'group R'\treals, represented as Doubles."); println("'group R 3'\treals reprecented as BigDecimals with 3 decimal places"); println("'group P 3'\tpermutation group on three symbols"); println("\t[1,3,2]+[3,2,1] -> (3,1,2)"); println("'group Zn 5'\tintegers modulo 5"); println("'group Qu'\tQuarternions"); println("'extend x'\textends current group by adding symbol x, i.e. a free group"); println("\tsuch a group can be considered as the ring of polynomials"); println("\tsimplification happens automatically"); println("'extend t a b c'\talgebraic extensions generated by t"); println("\twhere t is a root of the polynomial a t^2 + b t +c=0"); println("\te.g group extend t 1 0 1 gives complex numbers, t^2+1=0."); println("\tfor these groups there is a natural mapping to complex numbers and complex result is also printed."); println("'setRootVal t re im'\tsets the value of free variable 't' in a free group to complex number re+i im"); }
| 1,117,016
|
public boolean testSpecialCommands(String command) { GroupJep gj = (GroupJep) j; if(!super.testSpecialCommands(command)) return false; String words[] = split(command); if(words.length==0) return true; if(words[0].equals("group")) { if(words.length == 1) { } else if(words[1].equals("Z")) { initialise(new Integers()); } else if(words[1].equals("Q")) { initialise(new Rationals()); } else if(words[1].equals("R") && words.length == 3) { initialise(new BigReals( Integer.parseInt(words[2]), BigDecimal.ROUND_HALF_EVEN )); } else if(words[1].equals("R") && words.length == 2) { initialise(new Reals()); } else if(words[1].equals("P") && words.length == 3) { initialise(new PermutationGroup( Integer.parseInt(words[2])) ); } else if(words[1].equals("Zn") && words.length == 3) { initialise(new Zn(new BigInteger(words[2]))); } else if(words[1].equals("Qu")) { initialise(new Quartonians()); } else { println("invalid group spec "+command); return false; } printGroup(); return false; } if(words[0].equals("extend")) { RingI ring = (RingI) gj.getGroup(); if(words.length < 2) println("extend must have at least one argument"); else if(words.length == 2) /* Add a free variable */ { initialise(new ExtendedFreeGroup(ring, words[1])); } else /* extend by an algebraic number */ { int deg = words.length-3; Number coeffs[] = new Number[deg+1]; for(int i=0;i<=deg;++i) coeffs[i] = ring.valueOf(words[words.length-i-1]); Polynomial p1 = new Polynomial(ring,words[1],coeffs); initialise(new AlgebraicExtension(ring, p1)); } printGroup(); return false; } if(words[0].equals("setRootVal")) { String symbol = words[1]; Complex val = new Complex(Double.parseDouble(words[2]),Double.parseDouble(words[3])); GroupI g = gj.getGroup(); if(g instanceof FreeGroup) { boolean flag = ((FreeGroup) g).setRootVal(symbol,val); if(!flag) println("Failed to set root value, could not find symbol"); } return false; } return true; }
|
public boolean testSpecialCommands(String command) { GroupJep gj = (GroupJep) j; if(!super.testSpecialCommands(command)) return false; String words[] = split(command); if(words.length==0) return true; if(words[0].equals("group")) { if(words.length == 1) { } else if(words[1].equals("Z")) { initialise(new Integers()); } else if(words[1].equals("Q")) { initialise(new Rationals()); } else if(words[1].equals("R") && words.length == 3) { initialise(new BigReals( Integer.parseInt(words[2]), BigDecimal.ROUND_HALF_EVEN )); } else if(words[1].equals("R") && words.length == 2) { initialise(new Reals()); } else if(words[1].equals("P") && words.length == 3) { initialise(new PermutationGroup( Integer.parseInt(words[2])) ); } else if(words[1].equals("Zn") && words.length == 3) { initialise(new Zn(new BigInteger(words[2]))); } else if(words[1].equals("Qu")) { initialise(new Quaternions()); } else { println("invalid group spec "+command); return false; } printGroup(); return false; } if(words[0].equals("extend")) { RingI ring = (RingI) gj.getGroup(); if(words.length < 2) println("extend must have at least one argument"); else if(words.length == 2) /* Add a free variable */ { initialise(new ExtendedFreeGroup(ring, words[1])); } else /* extend by an algebraic number */ { int deg = words.length-3; Number coeffs[] = new Number[deg+1]; for(int i=0;i<=deg;++i) coeffs[i] = ring.valueOf(words[words.length-i-1]); Polynomial p1 = new Polynomial(ring,words[1],coeffs); initialise(new AlgebraicExtension(ring, p1)); } printGroup(); return false; } if(words[0].equals("setRootVal")) { String symbol = words[1]; Complex val = new Complex(Double.parseDouble(words[2]),Double.parseDouble(words[3])); GroupI g = gj.getGroup(); if(g instanceof FreeGroup) { boolean flag = ((FreeGroup) g).setRootVal(symbol,val); if(!flag) println("Failed to set root value, could not find symbol"); } return false; } return true; }
| 1,117,017
|
protected synchronized SortedMap<String,ExternalRun> _getRuns() { if(nextUpdate<System.currentTimeMillis()) { nextUpdate = System.currentTimeMillis()+1000; reload(); } return runs; }
|
protected synchronized SortedMap<String,ExternalRun> _getRuns() { if(nextUpdate<System.currentTimeMillis()) { nextUpdate = System.currentTimeMillis()+1000; reload(); } return runs; }
| 1,117,018
|
private void reload() { runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } }
|
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } }
| 1,117,019
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { ImportXml imp = new ImportXml(myContents.getOpenFilename()); try { Recipe recipe = imp.handler.getRecipe(); if (recipe != null) { myParent.setRecipe(recipe); } else { System.out.println("Recipe is null for some reason."); } } catch(Exception e) { System.out.print("Problem loading "); System.out.println(myContents.getOpenFilename()); } } }
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { ImportXml imp = new ImportXml(myContents.getOpenFilename()); try { Recipe recipe = imp.handler.getRecipe(); if (recipe != null) { myParent.setRecipe(recipe); } else { System.out.println("Recipe is null for some reason."); } } catch(Exception e) { System.out.print("Problem loading "); System.out.println(myContents.getOpenFilename()); } } }
| 1,117,021
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { ImportXml imp = new ImportXml(myContents.getOpenFilename()); try { Recipe recipe = imp.handler.getRecipe(); if (recipe != null) { myParent.setRecipe(recipe); } else { System.out.println("Recipe is null for some reason."); } } catch(Exception e) { System.out.print("Problem loading "); System.out.println(myContents.getOpenFilename()); } } }
|
public void execute() { if (myContents.getQuitItem().isSelected()) { myContents.quit(); } if (myContents.getOpenItem().isSelected()) { ImportXml imp = new ImportXml(myContents.getOpenFilename()); try { Recipe recipe = imp.handler.getRecipe(); if (recipe != null) { myParent.setRecipe(recipe); } else { System.out.println("Recipe is null for some reason."); } } catch(Exception e) { System.out.print("Problem loading "); System.out.println(myContents.getOpenFilename()); } } }
| 1,117,022
|
public void setUp() throws SQLException { data = createFullDayPlottable(); plottDb = new JDBCPlottable(); }
|
public void setUp() throws SQLException { data = createFullDayPlottable(); plottDb = new JDBCPlottable(new ConnectionCreator(new String[] {}).createConnection(), "HSQL"); }
| 1,117,024
|
public SoundPlay(SeismogramDisplay display, SeismogramContainer container){ this.display = display; this.container = container; seisIterator = container.getIterator(); seisWAV = new FissuresToWAV(seisIterator, 200); SeismogramDisplay.getMouseForwarder().addPermMouseListener(this); SeismogramDisplay.getMouseMotionForwarder().addMouseMotionListener(this); }
|
public SoundPlay(SeismogramDisplay display, SeismogramContainer container){ this.display = display; this.container = container; seisIterator = container.getIterator(); seisWAV = new FissuresToWAV(seisIterator, 200); SeismogramDisplay.getMouseForwarder().addPermMouseListener(this); SeismogramDisplay.getMouseMotionForwarder().addMouseMotionListener(this); }
| 1,117,025
|
public void mouseClicked(MouseEvent e){ if(intersects(e)){ System.out.println("This should be playing something..."); sendToWAV(); seisIterator.setTimeRange(timeEvent.getTime(container.getDataSetSeismogram())); seisWAV.play(); } }
|
public void mouseClicked(MouseEvent e){ if(intersects(e)){ System.out.println("This should be playing something..."); sendToWAV(); container.getIterator().setTimeRange(timeEvent.getTime(container.getDataSetSeismogram())); seisWAV.play(); } }
| 1,117,026
|
public static List<Resource> createAndPersistResourceList(HibernateTemplate hibernateTemplate, int i, int e, int p) { List<Resource> resourceList = createResourceList(i, e, p); hibernateTemplate.saveOrUpdateAll(resourceList); hibernateTemplate.flush(); hibernateTemplate.clear(); return resourceList; }
|
public static List<Resource> createAndPersistResourceList(HibernateTemplate hibernateTemplate, int i, int e, int p) { List<Resource> resourceList = createResourceList(i, e, p); hibernateTemplate.saveOrUpdateAll(resourceList); hibernateTemplate.flush(); hibernateTemplate.clear(); return resourceList; }
| 1,117,027
|
public static List<Resource> createResourceList(int size, int entityListSize, int parentListSize) { List<ResourceGroup> resourceGroupList = createResourceGroupList(size, entityListSize, parentListSize); List<Resource> resourceList = new ArrayList<Resource>(); for (ResourceGroup g: resourceGroupList) { for (int i=0;i<size;i++) { resourceList.add(ResourceCreatorImpl.resourceFactory(g, generateKey(20, i), null)); } } return resourceList; }
|
public static List<ResourceGroup> createResourceList(int size, int entityListSize, int parentListSize) { List<ResourceGroup> resourceGroupList = createResourceGroupList(size, entityListSize, parentListSize); List<Resource> resourceList = new ArrayList<Resource>(); for (ResourceGroup g: resourceGroupList) { for (int i=0;i<size;i++) { resourceList.add(ResourceCreatorImpl.resourceFactory(g, generateKey(20, i), null)); } } return resourceList; }
| 1,117,028
|
public static List<Resource> createResourceList(int size, int entityListSize, int parentListSize) { List<ResourceGroup> resourceGroupList = createResourceGroupList(size, entityListSize, parentListSize); List<Resource> resourceList = new ArrayList<Resource>(); for (ResourceGroup g: resourceGroupList) { for (int i=0;i<size;i++) { resourceList.add(ResourceCreatorImpl.resourceFactory(g, generateKey(20, i), null)); } } return resourceList; }
|
public static List<Resource> createResourceList(int size, int entityListSize, int parentListSize) { List<ResourceGroup> resourceGroupList = createResourceGroupList(size, entityListSize, parentListSize); List<ResourceGroup> resourceList = new ArrayList<ResourceGroup>(); for (ResourceGroup g: resourceGroupList) { for (int i=0;i<size;i++) { resourceList.add(ResourceCreatorImpl.resourceFactory(g, generateKey(20, i), null)); } } return resourceList; }
| 1,117,029
|
public static List<Resource> createResourceList(int size, int entityListSize, int parentListSize) { List<ResourceGroup> resourceGroupList = createResourceGroupList(size, entityListSize, parentListSize); List<Resource> resourceList = new ArrayList<Resource>(); for (ResourceGroup g: resourceGroupList) { for (int i=0;i<size;i++) { resourceList.add(ResourceCreatorImpl.resourceFactory(g, generateKey(20, i), null)); } } return resourceList; }
|
public static List<Resource> createResourceList(int size, int entityListSize, int parentListSize) { List<ResourceGroup> resourceGroupList = createResourceGroupList(size, entityListSize, parentListSize); List<Resource> resourceList = new ArrayList<Resource>(); for (ResourceGroup g: resourceGroupList) { for (int i=0;i<size;i++) { resourceList.add(ResourceCreatorImpl.resourceFactory(g, generateKey(20, intValue++), null)); } } return resourceList; }
| 1,117,030
|
private static void banHosts( DestAddress[] addresses, ExpiryDate expiryDate ) { PhexSecurityManager securityMgr = PhexSecurityManager.getInstance(); for ( int i = 0; i < addresses.length; i++ ) { IpAddress ip = addresses[i].getIpAddress(); if ( ip == null ) { continue; } securityMgr.createIPAccessRule( Localizer.getString( "UserBanned" ), true, IPAccessRule.SINGLE_ADDRESS, ip.getHostIP(), null, false, expiryDate, true ); } }
|
private static void banHosts( DestAddress[] addresses, ExpiryDate expiryDate ) { PhexSecurityManager securityMgr = PhexSecurityManager.getInstance(); for ( int i = 0; i < addresses.length; i++ ) { IpAddress ip = addresses[i].getIpAddress(); if ( ip == null ) { continue; } securityMgr.createIPAccessRule( Localizer.getString( "UserBanned" ), true, IPAccessRule.SINGLE_ADDRESS, ip.getHostIP(), null, false, expiryDate, true ); } }
| 1,117,031
|
public Node differentiate(ASTFunNode node,String var,Node [] children,Node [] dchildren,DJep djep) throws ParseException { XOperatorSet op = (XOperatorSet) djep.getOperatorSet(); NodeFactory nf = djep.getNodeFactory(); int nchild = node.jjtGetNumChildren(); if(nchild==2) return nf.buildOperatorNode(op.getDivide(), nf.buildOperatorNode(op.getSubtract(), nf.buildOperatorNode(op.getMultiply(), dchildren[0], djep.deepCopy(children[1])), nf.buildOperatorNode(op.getMultiply(), djep.deepCopy(children[0]), dchildren[1])), nf.buildOperatorNode(op.getMultiply(), djep.deepCopy(children[1]), djep.deepCopy(children[1]))); else throw new ParseException("Too many children "+nchild+" for "+node+"\n"); }
|
public Node differentiate(ASTFunNode node,String var,Node [] children,Node [] dchildren,DJep djep) throws ParseException { XOperatorSet op = (XOperatorSet) djep.getOperatorSet(); NodeFactory nf = djep.getNodeFactory(); int nchild = node.jjtGetNumChildren(); if(nchild==2) return nf.buildOperatorNode(op.getDivide(), nf.buildOperatorNode(op.getSubtract(), nf.buildOperatorNode(op.getMultiply(), dchildren[0], djep.deepCopy(children[1])), nf.buildOperatorNode(op.getMultiply(), djep.deepCopy(children[0]), dchildren[1])), nf.buildOperatorNode(op.getMultiply(), djep.deepCopy(children[1]), djep.deepCopy(children[1]))); else throw new ParseException("Too many children "+nchild+" for "+node+"\n"); }
| 1,117,032
|
private boolean scanCvsPassFile(File passfile, String cvsroot) throws IOException { cvsroot += ' '; BufferedReader in = new BufferedReader(new FileReader(passfile)); try { String line; while((line=in.readLine())!=null) { if(line.startsWith(cvsroot)) return true; } return false; } finally { in.close(); } }
|
private boolean scanCvsPassFile(File passfile, String cvsroot) throws IOException { cvsroot += ' '; BufferedReader in = new BufferedReader(new FileReader(passfile)); try { String line; while((line=in.readLine())!=null) { int portIndex = line.indexOf(":2401/"); String line2 = ""; if(portIndex>=0) line2 = line.substring(0,portIndex+1)+line.substring(portIndex+5); if(line.startsWith(cvsroot) || line.startsWith(cvsroot2) || line2.startsWith(cvsroot2)) return true; } return false; } finally { in.close(); } }
| 1,117,033
|
private void initGUI() { try { this.setSize(520, 532); this.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent evt) { System.exit(1); } }); { pnlMain = new JPanel(); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.columnWeights = new double[]{0.1}; jPanel2Layout.columnWidths = new int[]{7}; jPanel2Layout.rowWeights = new double[]{0.1, 0.1, 0.9, 0.1}; jPanel2Layout.rowHeights = new int[]{7, 7, 7, 7}; pnlMain.setLayout(jPanel2Layout); this.getContentPane().add(pnlMain, BorderLayout.CENTER); { jPanel1 = new JPanel(); pnlMain.add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); FlowLayout jPanel1Layout = new FlowLayout(); jPanel1Layout.setAlignment(FlowLayout.LEFT); jPanel1.setLayout(jPanel1Layout); { lblName = new JLabel(); jPanel1.add(lblName); lblName.setText("Name:"); } { txtName = new JTextField(); jPanel1.add(txtName); txtName.setText("Name"); txtName.setPreferredSize(new java.awt.Dimension(179, 20)); txtName.addActionListener(this); txtName.addFocusListener(this); } } { jTabbedPane1 = new JTabbedPane(); pnlMain.add(jTabbedPane1, new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { pnlDetails = new JPanel(); GridBagLayout pnlDetailsLayout = new GridBagLayout(); pnlDetailsLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.columnWidths = new int[]{7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; pnlDetailsLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.rowHeights = new int[]{7, 7, 7, 7, 7, 7, 7}; pnlDetails.setLayout(pnlDetailsLayout); jTabbedPane1.addTab("Details", null, pnlDetails, null); pnlDetails.setPreferredSize(new java.awt.Dimension(20, 16)); { lblBrewer = new JLabel(); pnlDetails.add(lblBrewer, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblBrewer.setText("Brewer:"); } { brewerNameText = new JTextField(); pnlDetails.add(brewerNameText, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); brewerNameText.setText("Brewer"); } { lblDate = new JLabel(); pnlDetails.add(lblDate, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblDate.setText("Date:"); } { lblStyle = new JLabel(); pnlDetails.add(lblStyle, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblStyle.setText("Style:"); } { lblYeast = new JLabel(); pnlDetails.add(lblYeast, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblYeast.setText("Yeast:"); } { lblPreBoil = new JLabel(); pnlDetails.add(lblPreBoil, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPreBoil.setText("Pre boil:"); } { lblPostBoil = new JLabel(); pnlDetails.add(lblPostBoil, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPostBoil.setText("Post boil:"); } { lblEffic = new JLabel(); pnlDetails.add(lblEffic, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblEffic.setText("Effic:"); } { lblAtten = new JLabel(); pnlDetails.add(lblAtten, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAtten.setText("Atten:"); } { lblOG = new JLabel(); pnlDetails.add(lblOG, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblOG.setText("OG:"); } { lblFG = new JLabel(); pnlDetails.add(lblFG, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblFG.setText("FG:"); } { lblIBU = new JLabel(); pnlDetails.add(lblIBU, new GridBagConstraints(7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBU.setText("IBU:"); } { lblAlc = new JLabel(); pnlDetails.add(lblAlc, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlc.setText("%Alc:"); } { lblColour = new JLabel(); pnlDetails.add(lblColour, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColour.setText("Colour:"); } { txtDate = new JFormattedTextField(); pnlDetails.add(txtDate, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtDate.setText("Date"); txtDate.addFocusListener(this); txtDate.addActionListener(this); } { cmbStyleModel = new ComboModel(); cmbStyle = new JComboBox(); pnlDetails.add(cmbStyle, new GridBagConstraints(1, 2, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbStyle.setModel(cmbStyleModel); cmbStyle.setMaximumSize(new java.awt.Dimension(100, 32767)); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); } { txtPreBoil = new JFormattedTextField(); pnlDetails.add(txtPreBoil, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtPreBoil.setText("Pre Boil"); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); } { postBoilText = new JFormattedTextField(); pnlDetails.add(postBoilText, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilText.setText("Post Boil"); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); } { lblComments = new JLabel(); pnlDetails.add(lblComments, new GridBagConstraints(6, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblComments.setText("Comments:"); } { SpinnerNumberModel spnEfficModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnEffic = new JSpinner(); pnlDetails.add(spnEffic, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnEffic.setModel(spnEfficModel); spnEffic.setMaximumSize(new java.awt.Dimension(70, 32767)); spnEffic.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEfficiency(Double.parseDouble(spnEffic.getValue() .toString())); displayRecipe(); } }); spnEffic.setEditor(new JSpinner.NumberEditor(spnEffic, "00.#")); spnEffic.getEditor().setPreferredSize(new java.awt.Dimension(28, 16)); } { SpinnerNumberModel spnAttenModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnAtten = new JSpinner(); pnlDetails.add(spnAtten, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnAtten.setModel(spnAttenModel); spnAtten.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setAttenuation(Double.parseDouble(spnAtten.getValue() .toString())); displayRecipe(); } }); spnAtten.setEditor(new JSpinner.NumberEditor(spnAtten, "00.#")); } { SpinnerNumberModel spnOgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnOG = new JSpinner(); pnlDetails.add(spnOG, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnOG.setModel(spnOgModel); spnOG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEstOg(Double.parseDouble(spnOG.getValue() .toString())); displayRecipe(); } }); spnOG.setEditor(new JSpinner.NumberEditor(spnOG, "0.000")); spnOG.getEditor().setPreferredSize(new java.awt.Dimension(20, 16)); } { SpinnerNumberModel spnFgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnFG = new JSpinner(); pnlDetails.add(spnFG, new GridBagConstraints(6, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnFG.setModel(spnFgModel); spnFG.setEditor(new JSpinner.NumberEditor(spnFG, "0.000")); spnFG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { // set the new FG, and update alc: myRecipe.setEstFg(Double.parseDouble(spnFG.getValue() .toString())); displayRecipe(); } }); } { lblIBUvalue = new JLabel(); pnlDetails.add(lblIBUvalue, new GridBagConstraints(8, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBUvalue.setText("IBUs"); } { lblColourValue = new JLabel(); pnlDetails.add(lblColourValue, new GridBagConstraints(8, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColourValue.setText("Colour"); } { lblAlcValue = new JLabel(); pnlDetails.add(lblAlcValue, new GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlcValue.setText("Alc"); } { scpComments = new JScrollPane(); pnlDetails.add(scpComments, new GridBagConstraints( 6, 4, 4, 2, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { txtComments = new JTextArea(); scpComments.setViewportView(txtComments); txtComments.setText("Comments"); txtComments.setWrapStyleWord(true); // txtComments.setPreferredSize(new java.awt.Dimension(117, 42)); txtComments.setLineWrap(true); txtComments.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (!txtComments.getText().equals(myRecipe.getComments())) { myRecipe.setComments(txtComments.getText()); } } }); } } { cmbYeastModel = new ComboModel(); cmbYeast = new JComboBox(); pnlDetails.add(cmbYeast, new GridBagConstraints(1, 3, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbYeast.setModel(cmbYeastModel); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); } { cmbSizeUnitsModel = new ComboModel(); cmbSizeUnits = new JComboBox(); pnlDetails.add(cmbSizeUnits, new GridBagConstraints(2, 4, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbSizeUnits.setModel(cmbSizeUnitsModel); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { myRecipe.setPostBoilVolUnits(q); myRecipe.setPreBoilVolUnits(q); displayRecipe(); } } }); } { lblSizeUnits = new JLabel(); pnlDetails.add(lblSizeUnits, new GridBagConstraints(2, 5, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); lblSizeUnits.setText("Size Units"); } { boilTimeLable = new JLabel(); pnlDetails.add(boilTimeLable, new GridBagConstraints(4, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); boilTimeLable.setText("Boil Min:"); } { evapLabel = new JLabel(); pnlDetails.add(evapLabel, new GridBagConstraints(4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); evapLabel.setText("Evap/hr:"); } { boilMinText = new JTextField(); pnlDetails.add(boilMinText, new GridBagConstraints(5, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilMinText.setText("60"); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); } { evapText = new JTextField(); pnlDetails.add(evapText, new GridBagConstraints(5, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); evapText.setText("4"); evapText.addFocusListener(this); evapText.addActionListener(this); } { alcMethodComboModel = new DefaultComboBoxModel(new String[]{"Volume", "Weight"}); alcMethodCombo = new JComboBox(alcMethodComboModel); pnlDetails.add(alcMethodCombo, new GridBagConstraints(9, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { ibuMethodComboModel = new DefaultComboBoxModel(new String[]{"Tinseth", "Garetz", "Rager"}); ibuMethodCombo = new JComboBox(ibuMethodComboModel); pnlDetails.add(ibuMethodCombo, new GridBagConstraints(9, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { colourMethodComboModel = new DefaultComboBoxModel(new String[]{"SRM", "EBC"}); colourMethodCombo = new JComboBox(colourMethodComboModel); pnlDetails.add(colourMethodCombo, new GridBagConstraints(9, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } } { SBNotifier sbn = new SBNotifier(); stylePanel = new StylePanel(sbn); jTabbedPane1.addTab("Style", null, stylePanel, null); } { miscPanel = new MiscPanel(myRecipe); jTabbedPane1.addTab("Misc", null, miscPanel, null); } { notesPanel = new NotesPanel(); jTabbedPane1.addTab("Notes", null, notesPanel, null); } { dilutionPanel = new DilutionPanel(); jTabbedPane1.addTab("Dilution", null, dilutionPanel, null); } } { pnlTables = new JPanel(); BoxLayout pnlMaltsLayout = new BoxLayout(pnlTables, javax.swing.BoxLayout.Y_AXIS); pnlMain.add(pnlTables, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnlTables.setLayout(pnlMaltsLayout); { pnlMalt = new JPanel(); pnlTables.add(pnlMalt); BorderLayout pnlMaltLayout1 = new BorderLayout(); pnlMalt.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Fermentables", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlMalt.setLayout(pnlMaltLayout1); { jScrollPane1 = new JScrollPane(); pnlMalt.add(jScrollPane1, BorderLayout.CENTER); { maltTableModel = new MaltTableModel(this); maltTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, maltTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane1.setViewportView(maltTable); maltTable.setModel(maltTableModel); maltTable.setAutoCreateColumnsFromModel(false); maltTable.getTableHeader().setReorderingAllowed(false); TableColumn maltColumn = maltTable.getColumnModel().getColumn(0); // set up malt list combo JComboBox maltComboBox = new JComboBox(); cmbMaltModel = new ComboModel(); maltComboBox.setModel(cmbMaltModel); maltColumn.setCellEditor(new DefaultCellEditor(maltComboBox)); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); } } } }); // set up malt units combo JComboBox maltUnitsComboBox = new JComboBox(); cmbMaltUnitsModel = new ComboModel(); maltUnitsComboBox.setModel(cmbMaltUnitsModel); maltColumn = maltTable.getColumnModel().getColumn(2); maltColumn.setCellEditor(new DefaultCellEditor(maltUnitsComboBox)); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setUnitsFull(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); } } { tblMaltTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"Malt", "Amount", "Units", "Points", "Lov", "Cost/U", "%"}); tblMaltTotals = new JTable(); pnlMalt.add(tblMaltTotals, BorderLayout.SOUTH); tblMaltTotals.setModel(tblMaltTotalsModel); tblMaltTotals.getTableHeader().setEnabled(false); tblMaltTotals.setAutoCreateColumnsFromModel(false); } } { pnlMaltButtons = new JPanel(); pnlTables.add(pnlMaltButtons); FlowLayout pnlMaltButtonsLayout = new FlowLayout(); pnlMaltButtonsLayout.setAlignment(FlowLayout.LEFT); pnlMaltButtonsLayout.setVgap(0); pnlMaltButtons.setLayout(pnlMaltButtonsLayout); pnlMaltButtons.setPreferredSize(new java.awt.Dimension(390, 34)); { tlbMalt = new JToolBar(); pnlMaltButtons.add(tlbMalt); tlbMalt.setPreferredSize(new java.awt.Dimension(140, 20)); tlbMalt.setFloatable(false); { btnAddMalt = new JButton(); tlbMalt.add(btnAddMalt); btnAddMalt.setText("+"); btnAddMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Fermentable f = new Fermentable(myRecipe.getMaltUnits()); myRecipe.addMalt(f); maltTable.updateUI(); displayRecipe(); } } }); } { btnDelMalt = new JButton(); tlbMalt.add(btnDelMalt); btnDelMalt.setText("-"); btnDelMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = maltTable.getSelectedRow(); myRecipe.delMalt(i); maltTable.updateUI(); displayRecipe(); } } }); } } } { pnlHops = new JPanel(); BorderLayout pnlHopsLayout = new BorderLayout(); pnlHops.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Hops", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlHops.setLayout(pnlHopsLayout); pnlTables.add(pnlHops); { tblHopsTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9"}); tblHopsTotals = new JTable(); pnlHops.add(tblHopsTotals, BorderLayout.SOUTH); tblHopsTotals.setModel(tblHopsTotalsModel); tblHopsTotals.setAutoCreateColumnsFromModel(false); } { jScrollPane2 = new JScrollPane(); pnlHops.add(jScrollPane2, BorderLayout.CENTER); { hopsTableModel = new HopsTableModel(this); hopsTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, hopsTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane2.setViewportView(hopsTable); hopsTable.setModel(hopsTableModel); hopsTable.getTableHeader().setReorderingAllowed(false); TableColumn hopColumn = hopsTable.getColumnModel().getColumn(0); JComboBox hopComboBox = new JComboBox(); cmbHopsModel = new ComboModel(); hopComboBox.setModel(cmbHopsModel); hopColumn.setCellEditor(new DefaultCellEditor(hopComboBox)); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); } } }); // set up hop units combo JComboBox hopsUnitsComboBox = new JComboBox(); cmbHopsUnitsModel = new ComboModel(); hopsUnitsComboBox.setModel(cmbHopsUnitsModel); hopColumn = hopsTable.getColumnModel().getColumn(4); hopColumn.setCellEditor(new DefaultCellEditor(hopsUnitsComboBox)); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.setUnitsFull(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); // set up hop type combo String[] forms = {"Leaf", "Pellet", "Plug"}; JComboBox hopsFormComboBox = new JComboBox(forms); hopColumn = hopsTable.getColumnModel().getColumn(1); hopColumn.setCellEditor(new DefaultCellEditor(hopsFormComboBox)); // set up hop add combo String[] add = {"Boil", "FWH", "Dry", "Mash"}; JComboBox hopsAddComboBox = new JComboBox(add); hopColumn = hopsTable.getColumnModel().getColumn(5); hopColumn.setCellEditor(new DefaultCellEditor(hopsAddComboBox)); } } } { pnlHopsButtons = new JPanel(); FlowLayout pnlHopsButtonsLayout = new FlowLayout(); pnlHopsButtonsLayout.setAlignment(FlowLayout.LEFT); pnlHopsButtonsLayout.setVgap(0); pnlHopsButtons.setLayout(pnlHopsButtonsLayout); pnlTables.add(pnlHopsButtons); pnlHopsButtons.setPreferredSize(new java.awt.Dimension(512, 16)); { tlbHops = new JToolBar(); pnlHopsButtons.add(tlbHops); tlbHops.setPreferredSize(new java.awt.Dimension(70, 19)); tlbHops.setFloatable(false); { btnAddHop = new JButton(); tlbHops.add(btnAddHop); btnAddHop.setText("+"); btnAddHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Hop h = new Hop(myRecipe.getHopUnits()); myRecipe.addHop(h); hopsTable.updateUI(); displayRecipe(); } } }); } { btnDelHop = new JButton(); tlbHops.add(btnDelHop); btnDelHop.setText("-"); btnDelHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = hopsTable.getSelectedRow(); myRecipe.delHop(i); hopsTable.updateUI(); displayRecipe(); } } }); } } } } { statusPanel = new JPanel(); FlowLayout statusPanelLayout = new FlowLayout(); statusPanelLayout.setAlignment(FlowLayout.LEFT); statusPanelLayout.setHgap(2); statusPanelLayout.setVgap(2); statusPanel.setLayout(statusPanelLayout); pnlMain.add(statusPanel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { fileNamePanel = new JPanel(); statusPanel.add(fileNamePanel); fileNamePanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { fileNameLabel = new JLabel(); fileNamePanel.add(fileNameLabel); fileNameLabel.setText("File Name"); fileNameLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { ibuMethodPanel = new JPanel(); statusPanel.add(ibuMethodPanel); ibuMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { ibuMethodLabel = new JLabel(); ibuMethodPanel.add(ibuMethodLabel); ibuMethodLabel.setText("IBU Method:"); ibuMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { alcMethodPanel = new JPanel(); statusPanel.add(alcMethodPanel); alcMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { alcMethodLabel = new JLabel(); alcMethodPanel.add(alcMethodLabel); alcMethodLabel.setText("Alc Method:"); alcMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } } } { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { fileMenu = new JMenu(); jMenuBar1.add(fileMenu); fileMenu.setText("File"); { newFileMenuItem = new JMenuItem(); fileMenu.add(newFileMenuItem); newFileMenuItem.setText("New"); newFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. myRecipe = new Recipe(); currentFile = null; attachRecipeData(); displayRecipe(); } }); } { openFileMenuItem = new JMenuItem(); fileMenu.add(openFileMenuItem); openFileMenuItem.setText("Open"); openFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show open dialog; this method does // not return until the dialog is closed String[] ext = {"xml", "qbrew"}; String desc = "StrangBrew and QBrew recipes"; sbFileFilter saveFileFilter = new sbFileFilter(ext, desc); // fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setFileFilter(saveFileFilter); int returnVal = fileChooser.showOpenDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); Debug.print("Opening: " + file.getName() + ".\n"); ImportXml imp = new ImportXml(file.toString()); myRecipe = imp.handler.getRecipe(); myRecipe.calcMaltTotals(); myRecipe.calcHopsTotals(); myRecipe.mash.calcMashSchedule(); attachRecipeData(); currentFile = file; displayRecipe(); } else { Debug.print("Open command cancelled by user.\n"); } } }); } { findFileMenuItem = new JMenuItem(); findFileMenuItem.setText("Find"); fileMenu.add(findFileMenuItem); final JFrame owner = this; findFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // open the find dialog FindDialog fd = new FindDialog(owner); fd.setVisible(true); } }); } { saveMenuItem = new JMenuItem(); fileMenu.add(saveMenuItem); saveMenuItem.setText("Save"); saveMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int choice = 1; if (currentFile != null) { File file = currentFile; //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toXML()); out.close(); Debug.print("Saved: " + file.getAbsoluteFile()); currentFile = file; } catch (Exception e) { // TODO: handle io exception } } // prompt to save if not already saved else { choice = JOptionPane.showConfirmDialog(null, "File not saved. Do you wish to save it?", "File note saved", JOptionPane.YES_NO_OPTION); } if (choice == 0) { // same as save as: saveAs(); } } }); } { saveAsMenuItem = new JMenuItem(); fileMenu.add(saveAsMenuItem); saveAsMenuItem.setText("Save As ..."); saveAsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. Debug.print(myRecipe.toXML()); saveAs(); } }); } { exportMenu = new JMenu(); fileMenu.add(exportMenu); exportMenu.setText("Export"); { exportHTMLmenu = new JMenuItem(); exportMenu.add(exportHTMLmenu); exportHTMLmenu.setText("HTML"); exportHTMLmenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"html", "htm"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "HTML"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".html")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { saveAsHTML(file); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Save command cancelled by user.\n"); } } }); exportTextMenuItem = new JMenuItem(); exportMenu.add(exportTextMenuItem); exportTextMenuItem.setText("Text"); exportTextMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"txt"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "Text"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".txt")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toText()); out.close(); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Export text command cancelled by user.\n"); } } }); } } { jSeparator2 = new JSeparator(); fileMenu.add(jSeparator2); } { exitMenuItem = new JMenuItem(); fileMenu.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // exit program System.exit(0); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); { final JFrame owner = this; editPrefsMenuItem = new JMenuItem(); jMenu4.add(editPrefsMenuItem); editPrefsMenuItem.setText("Preferences..."); editPrefsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { PreferencesDialog d = new PreferencesDialog(owner, preferences); d.setVisible(true); } }); } { jSeparator1 = new JSeparator(); jMenu4.add(jSeparator1); } { deleteMenuItem = new JMenuItem(); jMenu4.add(deleteMenuItem); deleteMenuItem.setText("Delete"); deleteMenuItem.setEnabled(false); } } { mnuView = new JMenu(); jMenuBar1.add(mnuView); mnuView.setText("View"); { mashManagerMenuItem = new JMenuItem(); mnuView.add(mashManagerMenuItem); mashManagerMenuItem.setText("Mash Manager..."); mashManagerMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { mashMgr = new MashManager(myRecipe); mashMgr.setVisible(true); } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); { helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("Help"); } { aboutMenuItem = new JMenuItem(); jMenu5.add(aboutMenuItem); aboutMenuItem.setText("About..."); final JFrame owner = this; aboutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { aboutDlg = new AboutDialog(owner); aboutDlg.setVisible(true); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
|
private void initGUI() { try { this.setSize(520, 532); this.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent evt) { System.exit(1); } }); { pnlMain = new JPanel(); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.columnWeights = new double[]{0.1}; jPanel2Layout.columnWidths = new int[]{7}; jPanel2Layout.rowWeights = new double[]{0.1, 0.1, 0.9, 0.1}; jPanel2Layout.rowHeights = new int[]{7, 7, 7, 7}; pnlMain.setLayout(jPanel2Layout); this.getContentPane().add(pnlMain, BorderLayout.CENTER); { jPanel1 = new JPanel(); pnlMain.add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); FlowLayout jPanel1Layout = new FlowLayout(); jPanel1Layout.setAlignment(FlowLayout.LEFT); jPanel1.setLayout(jPanel1Layout); { lblName = new JLabel(); jPanel1.add(lblName); lblName.setText("Name:"); } { txtName = new JTextField(); jPanel1.add(txtName); txtName.setText("Name"); txtName.setPreferredSize(new java.awt.Dimension(179, 20)); txtName.addActionListener(this); txtName.addFocusListener(this); } } { jTabbedPane1 = new JTabbedPane(); pnlMain.add(jTabbedPane1, new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { pnlDetails = new JPanel(); GridBagLayout pnlDetailsLayout = new GridBagLayout(); pnlDetailsLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.columnWidths = new int[]{7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; pnlDetailsLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.rowHeights = new int[]{7, 7, 7, 7, 7, 7, 7}; pnlDetails.setLayout(pnlDetailsLayout); jTabbedPane1.addTab("Details", null, pnlDetails, null); pnlDetails.setPreferredSize(new java.awt.Dimension(20, 16)); { lblBrewer = new JLabel(); pnlDetails.add(lblBrewer, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblBrewer.setText("Brewer:"); } { brewerNameText = new JTextField(); pnlDetails.add(brewerNameText, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); brewerNameText.setText("Brewer"); } { lblDate = new JLabel(); pnlDetails.add(lblDate, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblDate.setText("Date:"); } { lblStyle = new JLabel(); pnlDetails.add(lblStyle, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblStyle.setText("Style:"); } { lblYeast = new JLabel(); pnlDetails.add(lblYeast, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblYeast.setText("Yeast:"); } { lblPreBoil = new JLabel(); pnlDetails.add(lblPreBoil, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPreBoil.setText("Pre boil:"); } { lblPostBoil = new JLabel(); pnlDetails.add(lblPostBoil, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPostBoil.setText("Post boil:"); } { lblEffic = new JLabel(); pnlDetails.add(lblEffic, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblEffic.setText("Effic:"); } { lblAtten = new JLabel(); pnlDetails.add(lblAtten, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAtten.setText("Atten:"); } { lblOG = new JLabel(); pnlDetails.add(lblOG, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblOG.setText("OG:"); } { lblFG = new JLabel(); pnlDetails.add(lblFG, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblFG.setText("FG:"); } { lblIBU = new JLabel(); pnlDetails.add(lblIBU, new GridBagConstraints(7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBU.setText("IBU:"); } { lblAlc = new JLabel(); pnlDetails.add(lblAlc, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlc.setText("%Alc:"); } { lblColour = new JLabel(); pnlDetails.add(lblColour, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColour.setText("Colour:"); } { txtDate = new JFormattedTextField(); pnlDetails.add(txtDate, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtDate.setText("Date"); txtDate.addFocusListener(this); txtDate.addActionListener(this); } { cmbStyleModel = new ComboModel(); cmbStyle = new JComboBox(); pnlDetails.add(cmbStyle, new GridBagConstraints(1, 2, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbStyle.setModel(cmbStyleModel); cmbStyle.setMaximumSize(new java.awt.Dimension(100, 32767)); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); } { txtPreBoil = new JFormattedTextField(); pnlDetails.add(txtPreBoil, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtPreBoil.setText("Pre Boil"); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); } { postBoilText = new JFormattedTextField(); pnlDetails.add(postBoilText, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilText.setText("Post Boil"); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); } { lblComments = new JLabel(); pnlDetails.add(lblComments, new GridBagConstraints(6, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblComments.setText("Comments:"); } { SpinnerNumberModel spnEfficModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnEffic = new JSpinner(); pnlDetails.add(spnEffic, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnEffic.setModel(spnEfficModel); spnEffic.setMaximumSize(new java.awt.Dimension(70, 32767)); spnEffic.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEfficiency(Double.parseDouble(spnEffic.getValue() .toString())); displayRecipe(); } }); spnEffic.setEditor(new JSpinner.NumberEditor(spnEffic, "00.#")); spnEffic.getEditor().setPreferredSize(new java.awt.Dimension(28, 16)); } { SpinnerNumberModel spnAttenModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnAtten = new JSpinner(); pnlDetails.add(spnAtten, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnAtten.setModel(spnAttenModel); spnAtten.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setAttenuation(Double.parseDouble(spnAtten.getValue() .toString())); displayRecipe(); } }); spnAtten.setEditor(new JSpinner.NumberEditor(spnAtten, "00.#")); } { SpinnerNumberModel spnOgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnOG = new JSpinner(); pnlDetails.add(spnOG, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnOG.setModel(spnOgModel); spnOG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEstOg(Double.parseDouble(spnOG.getValue() .toString())); displayRecipe(); } }); spnOG.setEditor(new JSpinner.NumberEditor(spnOG, "0.000")); spnOG.getEditor().setPreferredSize(new java.awt.Dimension(20, 16)); } { SpinnerNumberModel spnFgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnFG = new JSpinner(); pnlDetails.add(spnFG, new GridBagConstraints(6, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnFG.setModel(spnFgModel); spnFG.setEditor(new JSpinner.NumberEditor(spnFG, "0.000")); spnFG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { // set the new FG, and update alc: myRecipe.setEstFg(Double.parseDouble(spnFG.getValue() .toString())); displayRecipe(); } }); } { lblIBUvalue = new JLabel(); pnlDetails.add(lblIBUvalue, new GridBagConstraints(8, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBUvalue.setText("IBUs"); } { lblColourValue = new JLabel(); pnlDetails.add(lblColourValue, new GridBagConstraints(8, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColourValue.setText("Colour"); } { lblAlcValue = new JLabel(); pnlDetails.add(lblAlcValue, new GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlcValue.setText("Alc"); } { scpComments = new JScrollPane(); pnlDetails.add(scpComments, new GridBagConstraints( 6, 4, 4, 2, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { txtComments = new JTextArea(); scpComments.setViewportView(txtComments); txtComments.setText("Comments"); txtComments.setWrapStyleWord(true); // txtComments.setPreferredSize(new java.awt.Dimension(117, 42)); txtComments.setLineWrap(true); txtComments.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (!txtComments.getText().equals(myRecipe.getComments())) { myRecipe.setComments(txtComments.getText()); } } }); } } { cmbYeastModel = new ComboModel(); cmbYeast = new JComboBox(); pnlDetails.add(cmbYeast, new GridBagConstraints(1, 3, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbYeast.setModel(cmbYeastModel); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); } { cmbSizeUnitsModel = new ComboModel(); cmbSizeUnits = new JComboBox(); pnlDetails.add(cmbSizeUnits, new GridBagConstraints(2, 4, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbSizeUnits.setModel(cmbSizeUnitsModel); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { myRecipe.setPreBoilVolUnits(q); displayRecipe(); } } }); } { lblSizeUnits = new JLabel(); pnlDetails.add(lblSizeUnits, new GridBagConstraints(2, 5, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); lblSizeUnits.setText("Size Units"); } { boilTimeLable = new JLabel(); pnlDetails.add(boilTimeLable, new GridBagConstraints(4, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); boilTimeLable.setText("Boil Min:"); } { evapLabel = new JLabel(); pnlDetails.add(evapLabel, new GridBagConstraints(4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); evapLabel.setText("Evap/hr:"); } { boilMinText = new JTextField(); pnlDetails.add(boilMinText, new GridBagConstraints(5, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilMinText.setText("60"); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); } { evapText = new JTextField(); pnlDetails.add(evapText, new GridBagConstraints(5, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); evapText.setText("4"); evapText.addFocusListener(this); evapText.addActionListener(this); } { alcMethodComboModel = new DefaultComboBoxModel(new String[]{"Volume", "Weight"}); alcMethodCombo = new JComboBox(alcMethodComboModel); pnlDetails.add(alcMethodCombo, new GridBagConstraints(9, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { ibuMethodComboModel = new DefaultComboBoxModel(new String[]{"Tinseth", "Garetz", "Rager"}); ibuMethodCombo = new JComboBox(ibuMethodComboModel); pnlDetails.add(ibuMethodCombo, new GridBagConstraints(9, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { colourMethodComboModel = new DefaultComboBoxModel(new String[]{"SRM", "EBC"}); colourMethodCombo = new JComboBox(colourMethodComboModel); pnlDetails.add(colourMethodCombo, new GridBagConstraints(9, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } } { SBNotifier sbn = new SBNotifier(); stylePanel = new StylePanel(sbn); jTabbedPane1.addTab("Style", null, stylePanel, null); } { miscPanel = new MiscPanel(myRecipe); jTabbedPane1.addTab("Misc", null, miscPanel, null); } { notesPanel = new NotesPanel(); jTabbedPane1.addTab("Notes", null, notesPanel, null); } { dilutionPanel = new DilutionPanel(); jTabbedPane1.addTab("Dilution", null, dilutionPanel, null); } } { pnlTables = new JPanel(); BoxLayout pnlMaltsLayout = new BoxLayout(pnlTables, javax.swing.BoxLayout.Y_AXIS); pnlMain.add(pnlTables, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnlTables.setLayout(pnlMaltsLayout); { pnlMalt = new JPanel(); pnlTables.add(pnlMalt); BorderLayout pnlMaltLayout1 = new BorderLayout(); pnlMalt.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Fermentables", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlMalt.setLayout(pnlMaltLayout1); { jScrollPane1 = new JScrollPane(); pnlMalt.add(jScrollPane1, BorderLayout.CENTER); { maltTableModel = new MaltTableModel(this); maltTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, maltTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane1.setViewportView(maltTable); maltTable.setModel(maltTableModel); maltTable.setAutoCreateColumnsFromModel(false); maltTable.getTableHeader().setReorderingAllowed(false); TableColumn maltColumn = maltTable.getColumnModel().getColumn(0); // set up malt list combo JComboBox maltComboBox = new JComboBox(); cmbMaltModel = new ComboModel(); maltComboBox.setModel(cmbMaltModel); maltColumn.setCellEditor(new DefaultCellEditor(maltComboBox)); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); } } } }); // set up malt units combo JComboBox maltUnitsComboBox = new JComboBox(); cmbMaltUnitsModel = new ComboModel(); maltUnitsComboBox.setModel(cmbMaltUnitsModel); maltColumn = maltTable.getColumnModel().getColumn(2); maltColumn.setCellEditor(new DefaultCellEditor(maltUnitsComboBox)); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setUnitsFull(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); } } { tblMaltTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"Malt", "Amount", "Units", "Points", "Lov", "Cost/U", "%"}); tblMaltTotals = new JTable(); pnlMalt.add(tblMaltTotals, BorderLayout.SOUTH); tblMaltTotals.setModel(tblMaltTotalsModel); tblMaltTotals.getTableHeader().setEnabled(false); tblMaltTotals.setAutoCreateColumnsFromModel(false); } } { pnlMaltButtons = new JPanel(); pnlTables.add(pnlMaltButtons); FlowLayout pnlMaltButtonsLayout = new FlowLayout(); pnlMaltButtonsLayout.setAlignment(FlowLayout.LEFT); pnlMaltButtonsLayout.setVgap(0); pnlMaltButtons.setLayout(pnlMaltButtonsLayout); pnlMaltButtons.setPreferredSize(new java.awt.Dimension(390, 34)); { tlbMalt = new JToolBar(); pnlMaltButtons.add(tlbMalt); tlbMalt.setPreferredSize(new java.awt.Dimension(140, 20)); tlbMalt.setFloatable(false); { btnAddMalt = new JButton(); tlbMalt.add(btnAddMalt); btnAddMalt.setText("+"); btnAddMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Fermentable f = new Fermentable(myRecipe.getMaltUnits()); myRecipe.addMalt(f); maltTable.updateUI(); displayRecipe(); } } }); } { btnDelMalt = new JButton(); tlbMalt.add(btnDelMalt); btnDelMalt.setText("-"); btnDelMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = maltTable.getSelectedRow(); myRecipe.delMalt(i); maltTable.updateUI(); displayRecipe(); } } }); } } } { pnlHops = new JPanel(); BorderLayout pnlHopsLayout = new BorderLayout(); pnlHops.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Hops", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlHops.setLayout(pnlHopsLayout); pnlTables.add(pnlHops); { tblHopsTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9"}); tblHopsTotals = new JTable(); pnlHops.add(tblHopsTotals, BorderLayout.SOUTH); tblHopsTotals.setModel(tblHopsTotalsModel); tblHopsTotals.setAutoCreateColumnsFromModel(false); } { jScrollPane2 = new JScrollPane(); pnlHops.add(jScrollPane2, BorderLayout.CENTER); { hopsTableModel = new HopsTableModel(this); hopsTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, hopsTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane2.setViewportView(hopsTable); hopsTable.setModel(hopsTableModel); hopsTable.getTableHeader().setReorderingAllowed(false); TableColumn hopColumn = hopsTable.getColumnModel().getColumn(0); JComboBox hopComboBox = new JComboBox(); cmbHopsModel = new ComboModel(); hopComboBox.setModel(cmbHopsModel); hopColumn.setCellEditor(new DefaultCellEditor(hopComboBox)); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); } } }); // set up hop units combo JComboBox hopsUnitsComboBox = new JComboBox(); cmbHopsUnitsModel = new ComboModel(); hopsUnitsComboBox.setModel(cmbHopsUnitsModel); hopColumn = hopsTable.getColumnModel().getColumn(4); hopColumn.setCellEditor(new DefaultCellEditor(hopsUnitsComboBox)); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.setUnitsFull(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); // set up hop type combo String[] forms = {"Leaf", "Pellet", "Plug"}; JComboBox hopsFormComboBox = new JComboBox(forms); hopColumn = hopsTable.getColumnModel().getColumn(1); hopColumn.setCellEditor(new DefaultCellEditor(hopsFormComboBox)); // set up hop add combo String[] add = {"Boil", "FWH", "Dry", "Mash"}; JComboBox hopsAddComboBox = new JComboBox(add); hopColumn = hopsTable.getColumnModel().getColumn(5); hopColumn.setCellEditor(new DefaultCellEditor(hopsAddComboBox)); } } } { pnlHopsButtons = new JPanel(); FlowLayout pnlHopsButtonsLayout = new FlowLayout(); pnlHopsButtonsLayout.setAlignment(FlowLayout.LEFT); pnlHopsButtonsLayout.setVgap(0); pnlHopsButtons.setLayout(pnlHopsButtonsLayout); pnlTables.add(pnlHopsButtons); pnlHopsButtons.setPreferredSize(new java.awt.Dimension(512, 16)); { tlbHops = new JToolBar(); pnlHopsButtons.add(tlbHops); tlbHops.setPreferredSize(new java.awt.Dimension(70, 19)); tlbHops.setFloatable(false); { btnAddHop = new JButton(); tlbHops.add(btnAddHop); btnAddHop.setText("+"); btnAddHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Hop h = new Hop(myRecipe.getHopUnits()); myRecipe.addHop(h); hopsTable.updateUI(); displayRecipe(); } } }); } { btnDelHop = new JButton(); tlbHops.add(btnDelHop); btnDelHop.setText("-"); btnDelHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = hopsTable.getSelectedRow(); myRecipe.delHop(i); hopsTable.updateUI(); displayRecipe(); } } }); } } } } { statusPanel = new JPanel(); FlowLayout statusPanelLayout = new FlowLayout(); statusPanelLayout.setAlignment(FlowLayout.LEFT); statusPanelLayout.setHgap(2); statusPanelLayout.setVgap(2); statusPanel.setLayout(statusPanelLayout); pnlMain.add(statusPanel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { fileNamePanel = new JPanel(); statusPanel.add(fileNamePanel); fileNamePanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { fileNameLabel = new JLabel(); fileNamePanel.add(fileNameLabel); fileNameLabel.setText("File Name"); fileNameLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { ibuMethodPanel = new JPanel(); statusPanel.add(ibuMethodPanel); ibuMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { ibuMethodLabel = new JLabel(); ibuMethodPanel.add(ibuMethodLabel); ibuMethodLabel.setText("IBU Method:"); ibuMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { alcMethodPanel = new JPanel(); statusPanel.add(alcMethodPanel); alcMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { alcMethodLabel = new JLabel(); alcMethodPanel.add(alcMethodLabel); alcMethodLabel.setText("Alc Method:"); alcMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } } } { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { fileMenu = new JMenu(); jMenuBar1.add(fileMenu); fileMenu.setText("File"); { newFileMenuItem = new JMenuItem(); fileMenu.add(newFileMenuItem); newFileMenuItem.setText("New"); newFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. myRecipe = new Recipe(); currentFile = null; attachRecipeData(); displayRecipe(); } }); } { openFileMenuItem = new JMenuItem(); fileMenu.add(openFileMenuItem); openFileMenuItem.setText("Open"); openFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show open dialog; this method does // not return until the dialog is closed String[] ext = {"xml", "qbrew"}; String desc = "StrangBrew and QBrew recipes"; sbFileFilter saveFileFilter = new sbFileFilter(ext, desc); // fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setFileFilter(saveFileFilter); int returnVal = fileChooser.showOpenDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); Debug.print("Opening: " + file.getName() + ".\n"); ImportXml imp = new ImportXml(file.toString()); myRecipe = imp.handler.getRecipe(); myRecipe.calcMaltTotals(); myRecipe.calcHopsTotals(); myRecipe.mash.calcMashSchedule(); attachRecipeData(); currentFile = file; displayRecipe(); } else { Debug.print("Open command cancelled by user.\n"); } } }); } { findFileMenuItem = new JMenuItem(); findFileMenuItem.setText("Find"); fileMenu.add(findFileMenuItem); final JFrame owner = this; findFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // open the find dialog FindDialog fd = new FindDialog(owner); fd.setVisible(true); } }); } { saveMenuItem = new JMenuItem(); fileMenu.add(saveMenuItem); saveMenuItem.setText("Save"); saveMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int choice = 1; if (currentFile != null) { File file = currentFile; //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toXML()); out.close(); Debug.print("Saved: " + file.getAbsoluteFile()); currentFile = file; } catch (Exception e) { // TODO: handle io exception } } // prompt to save if not already saved else { choice = JOptionPane.showConfirmDialog(null, "File not saved. Do you wish to save it?", "File note saved", JOptionPane.YES_NO_OPTION); } if (choice == 0) { // same as save as: saveAs(); } } }); } { saveAsMenuItem = new JMenuItem(); fileMenu.add(saveAsMenuItem); saveAsMenuItem.setText("Save As ..."); saveAsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. Debug.print(myRecipe.toXML()); saveAs(); } }); } { exportMenu = new JMenu(); fileMenu.add(exportMenu); exportMenu.setText("Export"); { exportHTMLmenu = new JMenuItem(); exportMenu.add(exportHTMLmenu); exportHTMLmenu.setText("HTML"); exportHTMLmenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"html", "htm"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "HTML"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".html")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { saveAsHTML(file); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Save command cancelled by user.\n"); } } }); exportTextMenuItem = new JMenuItem(); exportMenu.add(exportTextMenuItem); exportTextMenuItem.setText("Text"); exportTextMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"txt"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "Text"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".txt")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toText()); out.close(); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Export text command cancelled by user.\n"); } } }); } } { jSeparator2 = new JSeparator(); fileMenu.add(jSeparator2); } { exitMenuItem = new JMenuItem(); fileMenu.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // exit program System.exit(0); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); { final JFrame owner = this; editPrefsMenuItem = new JMenuItem(); jMenu4.add(editPrefsMenuItem); editPrefsMenuItem.setText("Preferences..."); editPrefsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { PreferencesDialog d = new PreferencesDialog(owner, preferences); d.setVisible(true); } }); } { jSeparator1 = new JSeparator(); jMenu4.add(jSeparator1); } { deleteMenuItem = new JMenuItem(); jMenu4.add(deleteMenuItem); deleteMenuItem.setText("Delete"); deleteMenuItem.setEnabled(false); } } { mnuView = new JMenu(); jMenuBar1.add(mnuView); mnuView.setText("View"); { mashManagerMenuItem = new JMenuItem(); mnuView.add(mashManagerMenuItem); mashManagerMenuItem.setText("Mash Manager..."); mashManagerMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { mashMgr = new MashManager(myRecipe); mashMgr.setVisible(true); } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); { helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("Help"); } { aboutMenuItem = new JMenuItem(); jMenu5.add(aboutMenuItem); aboutMenuItem.setText("About..."); final JFrame owner = this; aboutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { aboutDlg = new AboutDialog(owner); aboutDlg.setVisible(true); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
| 1,117,034
|
private void initGUI() { try { this.setSize(520, 532); this.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent evt) { System.exit(1); } }); { pnlMain = new JPanel(); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.columnWeights = new double[]{0.1}; jPanel2Layout.columnWidths = new int[]{7}; jPanel2Layout.rowWeights = new double[]{0.1, 0.1, 0.9, 0.1}; jPanel2Layout.rowHeights = new int[]{7, 7, 7, 7}; pnlMain.setLayout(jPanel2Layout); this.getContentPane().add(pnlMain, BorderLayout.CENTER); { jPanel1 = new JPanel(); pnlMain.add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); FlowLayout jPanel1Layout = new FlowLayout(); jPanel1Layout.setAlignment(FlowLayout.LEFT); jPanel1.setLayout(jPanel1Layout); { lblName = new JLabel(); jPanel1.add(lblName); lblName.setText("Name:"); } { txtName = new JTextField(); jPanel1.add(txtName); txtName.setText("Name"); txtName.setPreferredSize(new java.awt.Dimension(179, 20)); txtName.addActionListener(this); txtName.addFocusListener(this); } } { jTabbedPane1 = new JTabbedPane(); pnlMain.add(jTabbedPane1, new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { pnlDetails = new JPanel(); GridBagLayout pnlDetailsLayout = new GridBagLayout(); pnlDetailsLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.columnWidths = new int[]{7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; pnlDetailsLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.rowHeights = new int[]{7, 7, 7, 7, 7, 7, 7}; pnlDetails.setLayout(pnlDetailsLayout); jTabbedPane1.addTab("Details", null, pnlDetails, null); pnlDetails.setPreferredSize(new java.awt.Dimension(20, 16)); { lblBrewer = new JLabel(); pnlDetails.add(lblBrewer, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblBrewer.setText("Brewer:"); } { brewerNameText = new JTextField(); pnlDetails.add(brewerNameText, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); brewerNameText.setText("Brewer"); } { lblDate = new JLabel(); pnlDetails.add(lblDate, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblDate.setText("Date:"); } { lblStyle = new JLabel(); pnlDetails.add(lblStyle, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblStyle.setText("Style:"); } { lblYeast = new JLabel(); pnlDetails.add(lblYeast, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblYeast.setText("Yeast:"); } { lblPreBoil = new JLabel(); pnlDetails.add(lblPreBoil, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPreBoil.setText("Pre boil:"); } { lblPostBoil = new JLabel(); pnlDetails.add(lblPostBoil, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPostBoil.setText("Post boil:"); } { lblEffic = new JLabel(); pnlDetails.add(lblEffic, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblEffic.setText("Effic:"); } { lblAtten = new JLabel(); pnlDetails.add(lblAtten, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAtten.setText("Atten:"); } { lblOG = new JLabel(); pnlDetails.add(lblOG, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblOG.setText("OG:"); } { lblFG = new JLabel(); pnlDetails.add(lblFG, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblFG.setText("FG:"); } { lblIBU = new JLabel(); pnlDetails.add(lblIBU, new GridBagConstraints(7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBU.setText("IBU:"); } { lblAlc = new JLabel(); pnlDetails.add(lblAlc, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlc.setText("%Alc:"); } { lblColour = new JLabel(); pnlDetails.add(lblColour, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColour.setText("Colour:"); } { txtDate = new JFormattedTextField(); pnlDetails.add(txtDate, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtDate.setText("Date"); txtDate.addFocusListener(this); txtDate.addActionListener(this); } { cmbStyleModel = new ComboModel(); cmbStyle = new JComboBox(); pnlDetails.add(cmbStyle, new GridBagConstraints(1, 2, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbStyle.setModel(cmbStyleModel); cmbStyle.setMaximumSize(new java.awt.Dimension(100, 32767)); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); } { txtPreBoil = new JFormattedTextField(); pnlDetails.add(txtPreBoil, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtPreBoil.setText("Pre Boil"); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); } { postBoilText = new JFormattedTextField(); pnlDetails.add(postBoilText, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilText.setText("Post Boil"); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); } { lblComments = new JLabel(); pnlDetails.add(lblComments, new GridBagConstraints(6, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblComments.setText("Comments:"); } { SpinnerNumberModel spnEfficModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnEffic = new JSpinner(); pnlDetails.add(spnEffic, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnEffic.setModel(spnEfficModel); spnEffic.setMaximumSize(new java.awt.Dimension(70, 32767)); spnEffic.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEfficiency(Double.parseDouble(spnEffic.getValue() .toString())); displayRecipe(); } }); spnEffic.setEditor(new JSpinner.NumberEditor(spnEffic, "00.#")); spnEffic.getEditor().setPreferredSize(new java.awt.Dimension(28, 16)); } { SpinnerNumberModel spnAttenModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnAtten = new JSpinner(); pnlDetails.add(spnAtten, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnAtten.setModel(spnAttenModel); spnAtten.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setAttenuation(Double.parseDouble(spnAtten.getValue() .toString())); displayRecipe(); } }); spnAtten.setEditor(new JSpinner.NumberEditor(spnAtten, "00.#")); } { SpinnerNumberModel spnOgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnOG = new JSpinner(); pnlDetails.add(spnOG, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnOG.setModel(spnOgModel); spnOG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEstOg(Double.parseDouble(spnOG.getValue() .toString())); displayRecipe(); } }); spnOG.setEditor(new JSpinner.NumberEditor(spnOG, "0.000")); spnOG.getEditor().setPreferredSize(new java.awt.Dimension(20, 16)); } { SpinnerNumberModel spnFgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnFG = new JSpinner(); pnlDetails.add(spnFG, new GridBagConstraints(6, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnFG.setModel(spnFgModel); spnFG.setEditor(new JSpinner.NumberEditor(spnFG, "0.000")); spnFG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { // set the new FG, and update alc: myRecipe.setEstFg(Double.parseDouble(spnFG.getValue() .toString())); displayRecipe(); } }); } { lblIBUvalue = new JLabel(); pnlDetails.add(lblIBUvalue, new GridBagConstraints(8, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBUvalue.setText("IBUs"); } { lblColourValue = new JLabel(); pnlDetails.add(lblColourValue, new GridBagConstraints(8, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColourValue.setText("Colour"); } { lblAlcValue = new JLabel(); pnlDetails.add(lblAlcValue, new GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlcValue.setText("Alc"); } { scpComments = new JScrollPane(); pnlDetails.add(scpComments, new GridBagConstraints( 6, 4, 4, 2, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { txtComments = new JTextArea(); scpComments.setViewportView(txtComments); txtComments.setText("Comments"); txtComments.setWrapStyleWord(true); // txtComments.setPreferredSize(new java.awt.Dimension(117, 42)); txtComments.setLineWrap(true); txtComments.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (!txtComments.getText().equals(myRecipe.getComments())) { myRecipe.setComments(txtComments.getText()); } } }); } } { cmbYeastModel = new ComboModel(); cmbYeast = new JComboBox(); pnlDetails.add(cmbYeast, new GridBagConstraints(1, 3, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbYeast.setModel(cmbYeastModel); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); } { cmbSizeUnitsModel = new ComboModel(); cmbSizeUnits = new JComboBox(); pnlDetails.add(cmbSizeUnits, new GridBagConstraints(2, 4, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbSizeUnits.setModel(cmbSizeUnitsModel); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { myRecipe.setPostBoilVolUnits(q); myRecipe.setPreBoilVolUnits(q); displayRecipe(); } } }); } { lblSizeUnits = new JLabel(); pnlDetails.add(lblSizeUnits, new GridBagConstraints(2, 5, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); lblSizeUnits.setText("Size Units"); } { boilTimeLable = new JLabel(); pnlDetails.add(boilTimeLable, new GridBagConstraints(4, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); boilTimeLable.setText("Boil Min:"); } { evapLabel = new JLabel(); pnlDetails.add(evapLabel, new GridBagConstraints(4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); evapLabel.setText("Evap/hr:"); } { boilMinText = new JTextField(); pnlDetails.add(boilMinText, new GridBagConstraints(5, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilMinText.setText("60"); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); } { evapText = new JTextField(); pnlDetails.add(evapText, new GridBagConstraints(5, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); evapText.setText("4"); evapText.addFocusListener(this); evapText.addActionListener(this); } { alcMethodComboModel = new DefaultComboBoxModel(new String[]{"Volume", "Weight"}); alcMethodCombo = new JComboBox(alcMethodComboModel); pnlDetails.add(alcMethodCombo, new GridBagConstraints(9, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { ibuMethodComboModel = new DefaultComboBoxModel(new String[]{"Tinseth", "Garetz", "Rager"}); ibuMethodCombo = new JComboBox(ibuMethodComboModel); pnlDetails.add(ibuMethodCombo, new GridBagConstraints(9, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { colourMethodComboModel = new DefaultComboBoxModel(new String[]{"SRM", "EBC"}); colourMethodCombo = new JComboBox(colourMethodComboModel); pnlDetails.add(colourMethodCombo, new GridBagConstraints(9, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } } { SBNotifier sbn = new SBNotifier(); stylePanel = new StylePanel(sbn); jTabbedPane1.addTab("Style", null, stylePanel, null); } { miscPanel = new MiscPanel(myRecipe); jTabbedPane1.addTab("Misc", null, miscPanel, null); } { notesPanel = new NotesPanel(); jTabbedPane1.addTab("Notes", null, notesPanel, null); } { dilutionPanel = new DilutionPanel(); jTabbedPane1.addTab("Dilution", null, dilutionPanel, null); } } { pnlTables = new JPanel(); BoxLayout pnlMaltsLayout = new BoxLayout(pnlTables, javax.swing.BoxLayout.Y_AXIS); pnlMain.add(pnlTables, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnlTables.setLayout(pnlMaltsLayout); { pnlMalt = new JPanel(); pnlTables.add(pnlMalt); BorderLayout pnlMaltLayout1 = new BorderLayout(); pnlMalt.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Fermentables", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlMalt.setLayout(pnlMaltLayout1); { jScrollPane1 = new JScrollPane(); pnlMalt.add(jScrollPane1, BorderLayout.CENTER); { maltTableModel = new MaltTableModel(this); maltTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, maltTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane1.setViewportView(maltTable); maltTable.setModel(maltTableModel); maltTable.setAutoCreateColumnsFromModel(false); maltTable.getTableHeader().setReorderingAllowed(false); TableColumn maltColumn = maltTable.getColumnModel().getColumn(0); // set up malt list combo JComboBox maltComboBox = new JComboBox(); cmbMaltModel = new ComboModel(); maltComboBox.setModel(cmbMaltModel); maltColumn.setCellEditor(new DefaultCellEditor(maltComboBox)); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); } } } }); // set up malt units combo JComboBox maltUnitsComboBox = new JComboBox(); cmbMaltUnitsModel = new ComboModel(); maltUnitsComboBox.setModel(cmbMaltUnitsModel); maltColumn = maltTable.getColumnModel().getColumn(2); maltColumn.setCellEditor(new DefaultCellEditor(maltUnitsComboBox)); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setUnitsFull(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); } } { tblMaltTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"Malt", "Amount", "Units", "Points", "Lov", "Cost/U", "%"}); tblMaltTotals = new JTable(); pnlMalt.add(tblMaltTotals, BorderLayout.SOUTH); tblMaltTotals.setModel(tblMaltTotalsModel); tblMaltTotals.getTableHeader().setEnabled(false); tblMaltTotals.setAutoCreateColumnsFromModel(false); } } { pnlMaltButtons = new JPanel(); pnlTables.add(pnlMaltButtons); FlowLayout pnlMaltButtonsLayout = new FlowLayout(); pnlMaltButtonsLayout.setAlignment(FlowLayout.LEFT); pnlMaltButtonsLayout.setVgap(0); pnlMaltButtons.setLayout(pnlMaltButtonsLayout); pnlMaltButtons.setPreferredSize(new java.awt.Dimension(390, 34)); { tlbMalt = new JToolBar(); pnlMaltButtons.add(tlbMalt); tlbMalt.setPreferredSize(new java.awt.Dimension(140, 20)); tlbMalt.setFloatable(false); { btnAddMalt = new JButton(); tlbMalt.add(btnAddMalt); btnAddMalt.setText("+"); btnAddMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Fermentable f = new Fermentable(myRecipe.getMaltUnits()); myRecipe.addMalt(f); maltTable.updateUI(); displayRecipe(); } } }); } { btnDelMalt = new JButton(); tlbMalt.add(btnDelMalt); btnDelMalt.setText("-"); btnDelMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = maltTable.getSelectedRow(); myRecipe.delMalt(i); maltTable.updateUI(); displayRecipe(); } } }); } } } { pnlHops = new JPanel(); BorderLayout pnlHopsLayout = new BorderLayout(); pnlHops.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Hops", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlHops.setLayout(pnlHopsLayout); pnlTables.add(pnlHops); { tblHopsTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9"}); tblHopsTotals = new JTable(); pnlHops.add(tblHopsTotals, BorderLayout.SOUTH); tblHopsTotals.setModel(tblHopsTotalsModel); tblHopsTotals.setAutoCreateColumnsFromModel(false); } { jScrollPane2 = new JScrollPane(); pnlHops.add(jScrollPane2, BorderLayout.CENTER); { hopsTableModel = new HopsTableModel(this); hopsTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, hopsTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane2.setViewportView(hopsTable); hopsTable.setModel(hopsTableModel); hopsTable.getTableHeader().setReorderingAllowed(false); TableColumn hopColumn = hopsTable.getColumnModel().getColumn(0); JComboBox hopComboBox = new JComboBox(); cmbHopsModel = new ComboModel(); hopComboBox.setModel(cmbHopsModel); hopColumn.setCellEditor(new DefaultCellEditor(hopComboBox)); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); } } }); // set up hop units combo JComboBox hopsUnitsComboBox = new JComboBox(); cmbHopsUnitsModel = new ComboModel(); hopsUnitsComboBox.setModel(cmbHopsUnitsModel); hopColumn = hopsTable.getColumnModel().getColumn(4); hopColumn.setCellEditor(new DefaultCellEditor(hopsUnitsComboBox)); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.setUnitsFull(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); // set up hop type combo String[] forms = {"Leaf", "Pellet", "Plug"}; JComboBox hopsFormComboBox = new JComboBox(forms); hopColumn = hopsTable.getColumnModel().getColumn(1); hopColumn.setCellEditor(new DefaultCellEditor(hopsFormComboBox)); // set up hop add combo String[] add = {"Boil", "FWH", "Dry", "Mash"}; JComboBox hopsAddComboBox = new JComboBox(add); hopColumn = hopsTable.getColumnModel().getColumn(5); hopColumn.setCellEditor(new DefaultCellEditor(hopsAddComboBox)); } } } { pnlHopsButtons = new JPanel(); FlowLayout pnlHopsButtonsLayout = new FlowLayout(); pnlHopsButtonsLayout.setAlignment(FlowLayout.LEFT); pnlHopsButtonsLayout.setVgap(0); pnlHopsButtons.setLayout(pnlHopsButtonsLayout); pnlTables.add(pnlHopsButtons); pnlHopsButtons.setPreferredSize(new java.awt.Dimension(512, 16)); { tlbHops = new JToolBar(); pnlHopsButtons.add(tlbHops); tlbHops.setPreferredSize(new java.awt.Dimension(70, 19)); tlbHops.setFloatable(false); { btnAddHop = new JButton(); tlbHops.add(btnAddHop); btnAddHop.setText("+"); btnAddHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Hop h = new Hop(myRecipe.getHopUnits()); myRecipe.addHop(h); hopsTable.updateUI(); displayRecipe(); } } }); } { btnDelHop = new JButton(); tlbHops.add(btnDelHop); btnDelHop.setText("-"); btnDelHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = hopsTable.getSelectedRow(); myRecipe.delHop(i); hopsTable.updateUI(); displayRecipe(); } } }); } } } } { statusPanel = new JPanel(); FlowLayout statusPanelLayout = new FlowLayout(); statusPanelLayout.setAlignment(FlowLayout.LEFT); statusPanelLayout.setHgap(2); statusPanelLayout.setVgap(2); statusPanel.setLayout(statusPanelLayout); pnlMain.add(statusPanel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { fileNamePanel = new JPanel(); statusPanel.add(fileNamePanel); fileNamePanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { fileNameLabel = new JLabel(); fileNamePanel.add(fileNameLabel); fileNameLabel.setText("File Name"); fileNameLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { ibuMethodPanel = new JPanel(); statusPanel.add(ibuMethodPanel); ibuMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { ibuMethodLabel = new JLabel(); ibuMethodPanel.add(ibuMethodLabel); ibuMethodLabel.setText("IBU Method:"); ibuMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { alcMethodPanel = new JPanel(); statusPanel.add(alcMethodPanel); alcMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { alcMethodLabel = new JLabel(); alcMethodPanel.add(alcMethodLabel); alcMethodLabel.setText("Alc Method:"); alcMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } } } { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { fileMenu = new JMenu(); jMenuBar1.add(fileMenu); fileMenu.setText("File"); { newFileMenuItem = new JMenuItem(); fileMenu.add(newFileMenuItem); newFileMenuItem.setText("New"); newFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. myRecipe = new Recipe(); currentFile = null; attachRecipeData(); displayRecipe(); } }); } { openFileMenuItem = new JMenuItem(); fileMenu.add(openFileMenuItem); openFileMenuItem.setText("Open"); openFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show open dialog; this method does // not return until the dialog is closed String[] ext = {"xml", "qbrew"}; String desc = "StrangBrew and QBrew recipes"; sbFileFilter saveFileFilter = new sbFileFilter(ext, desc); // fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setFileFilter(saveFileFilter); int returnVal = fileChooser.showOpenDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); Debug.print("Opening: " + file.getName() + ".\n"); ImportXml imp = new ImportXml(file.toString()); myRecipe = imp.handler.getRecipe(); myRecipe.calcMaltTotals(); myRecipe.calcHopsTotals(); myRecipe.mash.calcMashSchedule(); attachRecipeData(); currentFile = file; displayRecipe(); } else { Debug.print("Open command cancelled by user.\n"); } } }); } { findFileMenuItem = new JMenuItem(); findFileMenuItem.setText("Find"); fileMenu.add(findFileMenuItem); final JFrame owner = this; findFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // open the find dialog FindDialog fd = new FindDialog(owner); fd.setVisible(true); } }); } { saveMenuItem = new JMenuItem(); fileMenu.add(saveMenuItem); saveMenuItem.setText("Save"); saveMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int choice = 1; if (currentFile != null) { File file = currentFile; //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toXML()); out.close(); Debug.print("Saved: " + file.getAbsoluteFile()); currentFile = file; } catch (Exception e) { // TODO: handle io exception } } // prompt to save if not already saved else { choice = JOptionPane.showConfirmDialog(null, "File not saved. Do you wish to save it?", "File note saved", JOptionPane.YES_NO_OPTION); } if (choice == 0) { // same as save as: saveAs(); } } }); } { saveAsMenuItem = new JMenuItem(); fileMenu.add(saveAsMenuItem); saveAsMenuItem.setText("Save As ..."); saveAsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. Debug.print(myRecipe.toXML()); saveAs(); } }); } { exportMenu = new JMenu(); fileMenu.add(exportMenu); exportMenu.setText("Export"); { exportHTMLmenu = new JMenuItem(); exportMenu.add(exportHTMLmenu); exportHTMLmenu.setText("HTML"); exportHTMLmenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"html", "htm"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "HTML"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".html")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { saveAsHTML(file); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Save command cancelled by user.\n"); } } }); exportTextMenuItem = new JMenuItem(); exportMenu.add(exportTextMenuItem); exportTextMenuItem.setText("Text"); exportTextMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"txt"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "Text"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".txt")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toText()); out.close(); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Export text command cancelled by user.\n"); } } }); } } { jSeparator2 = new JSeparator(); fileMenu.add(jSeparator2); } { exitMenuItem = new JMenuItem(); fileMenu.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // exit program System.exit(0); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); { final JFrame owner = this; editPrefsMenuItem = new JMenuItem(); jMenu4.add(editPrefsMenuItem); editPrefsMenuItem.setText("Preferences..."); editPrefsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { PreferencesDialog d = new PreferencesDialog(owner, preferences); d.setVisible(true); } }); } { jSeparator1 = new JSeparator(); jMenu4.add(jSeparator1); } { deleteMenuItem = new JMenuItem(); jMenu4.add(deleteMenuItem); deleteMenuItem.setText("Delete"); deleteMenuItem.setEnabled(false); } } { mnuView = new JMenu(); jMenuBar1.add(mnuView); mnuView.setText("View"); { mashManagerMenuItem = new JMenuItem(); mnuView.add(mashManagerMenuItem); mashManagerMenuItem.setText("Mash Manager..."); mashManagerMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { mashMgr = new MashManager(myRecipe); mashMgr.setVisible(true); } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); { helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("Help"); } { aboutMenuItem = new JMenuItem(); jMenu5.add(aboutMenuItem); aboutMenuItem.setText("About..."); final JFrame owner = this; aboutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { aboutDlg = new AboutDialog(owner); aboutDlg.setVisible(true); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
|
private void initGUI() { try { this.setSize(520, 532); this.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent evt) { System.exit(1); } }); { pnlMain = new JPanel(); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.columnWeights = new double[]{0.1}; jPanel2Layout.columnWidths = new int[]{7}; jPanel2Layout.rowWeights = new double[]{0.1, 0.1, 0.9, 0.1}; jPanel2Layout.rowHeights = new int[]{7, 7, 7, 7}; pnlMain.setLayout(jPanel2Layout); this.getContentPane().add(pnlMain, BorderLayout.CENTER); { jPanel1 = new JPanel(); pnlMain.add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); FlowLayout jPanel1Layout = new FlowLayout(); jPanel1Layout.setAlignment(FlowLayout.LEFT); jPanel1.setLayout(jPanel1Layout); { lblName = new JLabel(); jPanel1.add(lblName); lblName.setText("Name:"); } { txtName = new JTextField(); jPanel1.add(txtName); txtName.setText("Name"); txtName.setPreferredSize(new java.awt.Dimension(179, 20)); txtName.addActionListener(this); txtName.addFocusListener(this); } } { jTabbedPane1 = new JTabbedPane(); pnlMain.add(jTabbedPane1, new GridBagConstraints(0, 1, 1, 1, 0.1, 0.1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { pnlDetails = new JPanel(); GridBagLayout pnlDetailsLayout = new GridBagLayout(); pnlDetailsLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.columnWidths = new int[]{7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; pnlDetailsLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; pnlDetailsLayout.rowHeights = new int[]{7, 7, 7, 7, 7, 7, 7}; pnlDetails.setLayout(pnlDetailsLayout); jTabbedPane1.addTab("Details", null, pnlDetails, null); pnlDetails.setPreferredSize(new java.awt.Dimension(20, 16)); { lblBrewer = new JLabel(); pnlDetails.add(lblBrewer, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblBrewer.setText("Brewer:"); } { brewerNameText = new JTextField(); pnlDetails.add(brewerNameText, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); brewerNameText.setText("Brewer"); } { lblDate = new JLabel(); pnlDetails.add(lblDate, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblDate.setText("Date:"); } { lblStyle = new JLabel(); pnlDetails.add(lblStyle, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblStyle.setText("Style:"); } { lblYeast = new JLabel(); pnlDetails.add(lblYeast, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblYeast.setText("Yeast:"); } { lblPreBoil = new JLabel(); pnlDetails.add(lblPreBoil, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPreBoil.setText("Pre boil:"); } { lblPostBoil = new JLabel(); pnlDetails.add(lblPostBoil, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblPostBoil.setText("Post boil:"); } { lblEffic = new JLabel(); pnlDetails.add(lblEffic, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblEffic.setText("Effic:"); } { lblAtten = new JLabel(); pnlDetails.add(lblAtten, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAtten.setText("Atten:"); } { lblOG = new JLabel(); pnlDetails.add(lblOG, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblOG.setText("OG:"); } { lblFG = new JLabel(); pnlDetails.add(lblFG, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblFG.setText("FG:"); } { lblIBU = new JLabel(); pnlDetails.add(lblIBU, new GridBagConstraints(7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBU.setText("IBU:"); } { lblAlc = new JLabel(); pnlDetails.add(lblAlc, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlc.setText("%Alc:"); } { lblColour = new JLabel(); pnlDetails.add(lblColour, new GridBagConstraints(7, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColour.setText("Colour:"); } { txtDate = new JFormattedTextField(); pnlDetails.add(txtDate, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtDate.setText("Date"); txtDate.addFocusListener(this); txtDate.addActionListener(this); } { cmbStyleModel = new ComboModel(); cmbStyle = new JComboBox(); pnlDetails.add(cmbStyle, new GridBagConstraints(1, 2, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbStyle.setModel(cmbStyleModel); cmbStyle.setMaximumSize(new java.awt.Dimension(100, 32767)); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); } { txtPreBoil = new JFormattedTextField(); pnlDetails.add(txtPreBoil, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtPreBoil.setText("Pre Boil"); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); } { postBoilText = new JFormattedTextField(); pnlDetails.add(postBoilText, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilText.setText("Post Boil"); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); } { lblComments = new JLabel(); pnlDetails.add(lblComments, new GridBagConstraints(6, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblComments.setText("Comments:"); } { SpinnerNumberModel spnEfficModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnEffic = new JSpinner(); pnlDetails.add(spnEffic, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnEffic.setModel(spnEfficModel); spnEffic.setMaximumSize(new java.awt.Dimension(70, 32767)); spnEffic.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEfficiency(Double.parseDouble(spnEffic.getValue() .toString())); displayRecipe(); } }); spnEffic.setEditor(new JSpinner.NumberEditor(spnEffic, "00.#")); spnEffic.getEditor().setPreferredSize(new java.awt.Dimension(28, 16)); } { SpinnerNumberModel spnAttenModel = new SpinnerNumberModel(75.0, 0.0, 100.0, 1.0); spnAtten = new JSpinner(); pnlDetails.add(spnAtten, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnAtten.setModel(spnAttenModel); spnAtten.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setAttenuation(Double.parseDouble(spnAtten.getValue() .toString())); displayRecipe(); } }); spnAtten.setEditor(new JSpinner.NumberEditor(spnAtten, "00.#")); } { SpinnerNumberModel spnOgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnOG = new JSpinner(); pnlDetails.add(spnOG, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnOG.setModel(spnOgModel); spnOG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { myRecipe.setEstOg(Double.parseDouble(spnOG.getValue() .toString())); displayRecipe(); } }); spnOG.setEditor(new JSpinner.NumberEditor(spnOG, "0.000")); spnOG.getEditor().setPreferredSize(new java.awt.Dimension(20, 16)); } { SpinnerNumberModel spnFgModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); spnFG = new JSpinner(); pnlDetails.add(spnFG, new GridBagConstraints(6, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); spnFG.setModel(spnFgModel); spnFG.setEditor(new JSpinner.NumberEditor(spnFG, "0.000")); spnFG.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { // set the new FG, and update alc: myRecipe.setEstFg(Double.parseDouble(spnFG.getValue() .toString())); displayRecipe(); } }); } { lblIBUvalue = new JLabel(); pnlDetails.add(lblIBUvalue, new GridBagConstraints(8, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblIBUvalue.setText("IBUs"); } { lblColourValue = new JLabel(); pnlDetails.add(lblColourValue, new GridBagConstraints(8, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblColourValue.setText("Colour"); } { lblAlcValue = new JLabel(); pnlDetails.add(lblAlcValue, new GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); lblAlcValue.setText("Alc"); } { scpComments = new JScrollPane(); pnlDetails.add(scpComments, new GridBagConstraints( 6, 4, 4, 2, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); { txtComments = new JTextArea(); scpComments.setViewportView(txtComments); txtComments.setText("Comments"); txtComments.setWrapStyleWord(true); // txtComments.setPreferredSize(new java.awt.Dimension(117, 42)); txtComments.setLineWrap(true); txtComments.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if (!txtComments.getText().equals(myRecipe.getComments())) { myRecipe.setComments(txtComments.getText()); } } }); } } { cmbYeastModel = new ComboModel(); cmbYeast = new JComboBox(); pnlDetails.add(cmbYeast, new GridBagConstraints(1, 3, 5, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbYeast.setModel(cmbYeastModel); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); } { cmbSizeUnitsModel = new ComboModel(); cmbSizeUnits = new JComboBox(); pnlDetails.add(cmbSizeUnits, new GridBagConstraints(2, 4, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbSizeUnits.setModel(cmbSizeUnitsModel); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { myRecipe.setPostBoilVolUnits(q); myRecipe.setPreBoilVolUnits(q); displayRecipe(); } } }); } { lblSizeUnits = new JLabel(); pnlDetails.add(lblSizeUnits, new GridBagConstraints(2, 5, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); lblSizeUnits.setText("Size Units"); } { boilTimeLable = new JLabel(); pnlDetails.add(boilTimeLable, new GridBagConstraints(4, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); boilTimeLable.setText("Boil Min:"); } { evapLabel = new JLabel(); pnlDetails.add(evapLabel, new GridBagConstraints(4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); evapLabel.setText("Evap/hr:"); } { boilMinText = new JTextField(); pnlDetails.add(boilMinText, new GridBagConstraints(5, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilMinText.setText("60"); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); } { evapText = new JTextField(); pnlDetails.add(evapText, new GridBagConstraints(5, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); evapText.setText("4"); evapText.addFocusListener(this); evapText.addActionListener(this); } { alcMethodComboModel = new DefaultComboBoxModel(new String[]{"Volume", "Weight"}); alcMethodCombo = new JComboBox(alcMethodComboModel); pnlDetails.add(alcMethodCombo, new GridBagConstraints(9, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { ibuMethodComboModel = new DefaultComboBoxModel(new String[]{"Tinseth", "Garetz", "Rager"}); ibuMethodCombo = new JComboBox(ibuMethodComboModel); pnlDetails.add(ibuMethodCombo, new GridBagConstraints(9, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } { colourMethodComboModel = new DefaultComboBoxModel(new String[]{"SRM", "EBC"}); colourMethodCombo = new JComboBox(colourMethodComboModel); pnlDetails.add(colourMethodCombo, new GridBagConstraints(9, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); } } { SBNotifier sbn = new SBNotifier(); stylePanel = new StylePanel(sbn); jTabbedPane1.addTab("Style", null, stylePanel, null); } { miscPanel = new MiscPanel(myRecipe); jTabbedPane1.addTab("Misc", null, miscPanel, null); } { notesPanel = new NotesPanel(); jTabbedPane1.addTab("Notes", null, notesPanel, null); } { dilutionPanel = new DilutionPanel(); jTabbedPane1.addTab("Dilution", null, dilutionPanel, null); } } { pnlTables = new JPanel(); BoxLayout pnlMaltsLayout = new BoxLayout(pnlTables, javax.swing.BoxLayout.Y_AXIS); pnlMain.add(pnlTables, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); pnlTables.setLayout(pnlMaltsLayout); { pnlMalt = new JPanel(); pnlTables.add(pnlMalt); BorderLayout pnlMaltLayout1 = new BorderLayout(); pnlMalt.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Fermentables", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlMalt.setLayout(pnlMaltLayout1); { jScrollPane1 = new JScrollPane(); pnlMalt.add(jScrollPane1, BorderLayout.CENTER); { maltTableModel = new MaltTableModel(this); maltTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, maltTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane1.setViewportView(maltTable); maltTable.setModel(maltTableModel); maltTable.getTableHeader().setReorderingAllowed(false); TableColumn maltColumn = maltTable.getColumnModel().getColumn(0); // set up malt list combo JComboBox maltComboBox = new JComboBox(); cmbMaltModel = new ComboModel(); maltComboBox.setModel(cmbMaltModel); maltColumn.setCellEditor(new DefaultCellEditor(maltComboBox)); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); } } } }); // set up malt units combo JComboBox maltUnitsComboBox = new JComboBox(); cmbMaltUnitsModel = new ComboModel(); maltUnitsComboBox.setModel(cmbMaltUnitsModel); maltColumn = maltTable.getColumnModel().getColumn(2); maltColumn.setCellEditor(new DefaultCellEditor(maltUnitsComboBox)); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setUnitsFull(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); } } { tblMaltTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"Malt", "Amount", "Units", "Points", "Lov", "Cost/U", "%"}); tblMaltTotals = new JTable(); pnlMalt.add(tblMaltTotals, BorderLayout.SOUTH); tblMaltTotals.setModel(tblMaltTotalsModel); tblMaltTotals.getTableHeader().setEnabled(false); tblMaltTotals.setAutoCreateColumnsFromModel(false); } } { pnlMaltButtons = new JPanel(); pnlTables.add(pnlMaltButtons); FlowLayout pnlMaltButtonsLayout = new FlowLayout(); pnlMaltButtonsLayout.setAlignment(FlowLayout.LEFT); pnlMaltButtonsLayout.setVgap(0); pnlMaltButtons.setLayout(pnlMaltButtonsLayout); pnlMaltButtons.setPreferredSize(new java.awt.Dimension(390, 34)); { tlbMalt = new JToolBar(); pnlMaltButtons.add(tlbMalt); tlbMalt.setPreferredSize(new java.awt.Dimension(140, 20)); tlbMalt.setFloatable(false); { btnAddMalt = new JButton(); tlbMalt.add(btnAddMalt); btnAddMalt.setText("+"); btnAddMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Fermentable f = new Fermentable(myRecipe.getMaltUnits()); myRecipe.addMalt(f); maltTable.updateUI(); displayRecipe(); } } }); } { btnDelMalt = new JButton(); tlbMalt.add(btnDelMalt); btnDelMalt.setText("-"); btnDelMalt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = maltTable.getSelectedRow(); myRecipe.delMalt(i); maltTable.updateUI(); displayRecipe(); } } }); } } } { pnlHops = new JPanel(); BorderLayout pnlHopsLayout = new BorderLayout(); pnlHops.setBorder(BorderFactory.createTitledBorder(new LineBorder( new java.awt.Color(0, 0, 0), 1, false), "Hops", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog", 1, 12), new java.awt.Color(51, 51, 51))); pnlHops.setLayout(pnlHopsLayout); pnlTables.add(pnlHops); { tblHopsTotalsModel = new DefaultTableModel(new String[][]{{""}}, new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9"}); tblHopsTotals = new JTable(); pnlHops.add(tblHopsTotals, BorderLayout.SOUTH); tblHopsTotals.setModel(tblHopsTotalsModel); tblHopsTotals.setAutoCreateColumnsFromModel(false); } { jScrollPane2 = new JScrollPane(); pnlHops.add(jScrollPane2, BorderLayout.CENTER); { hopsTableModel = new HopsTableModel(this); hopsTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, hopsTableModel .getDescriptionAt(rowIndex)); } }; jScrollPane2.setViewportView(hopsTable); hopsTable.setModel(hopsTableModel); hopsTable.getTableHeader().setReorderingAllowed(false); TableColumn hopColumn = hopsTable.getColumnModel().getColumn(0); JComboBox hopComboBox = new JComboBox(); cmbHopsModel = new ComboModel(); hopComboBox.setModel(cmbHopsModel); hopColumn.setCellEditor(new DefaultCellEditor(hopComboBox)); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); } } }); // set up hop units combo JComboBox hopsUnitsComboBox = new JComboBox(); cmbHopsUnitsModel = new ComboModel(); hopsUnitsComboBox.setModel(cmbHopsUnitsModel); hopColumn = hopsTable.getColumnModel().getColumn(4); hopColumn.setCellEditor(new DefaultCellEditor(hopsUnitsComboBox)); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.setUnitsFull(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); // set up hop type combo String[] forms = {"Leaf", "Pellet", "Plug"}; JComboBox hopsFormComboBox = new JComboBox(forms); hopColumn = hopsTable.getColumnModel().getColumn(1); hopColumn.setCellEditor(new DefaultCellEditor(hopsFormComboBox)); // set up hop add combo String[] add = {"Boil", "FWH", "Dry", "Mash"}; JComboBox hopsAddComboBox = new JComboBox(add); hopColumn = hopsTable.getColumnModel().getColumn(5); hopColumn.setCellEditor(new DefaultCellEditor(hopsAddComboBox)); } } } { pnlHopsButtons = new JPanel(); FlowLayout pnlHopsButtonsLayout = new FlowLayout(); pnlHopsButtonsLayout.setAlignment(FlowLayout.LEFT); pnlHopsButtonsLayout.setVgap(0); pnlHopsButtons.setLayout(pnlHopsButtonsLayout); pnlTables.add(pnlHopsButtons); pnlHopsButtons.setPreferredSize(new java.awt.Dimension(512, 16)); { tlbHops = new JToolBar(); pnlHopsButtons.add(tlbHops); tlbHops.setPreferredSize(new java.awt.Dimension(70, 19)); tlbHops.setFloatable(false); { btnAddHop = new JButton(); tlbHops.add(btnAddHop); btnAddHop.setText("+"); btnAddHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Hop h = new Hop(myRecipe.getHopUnits()); myRecipe.addHop(h); hopsTable.updateUI(); displayRecipe(); } } }); } { btnDelHop = new JButton(); tlbHops.add(btnDelHop); btnDelHop.setText("-"); btnDelHop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = hopsTable.getSelectedRow(); myRecipe.delHop(i); hopsTable.updateUI(); displayRecipe(); } } }); } } } } { statusPanel = new JPanel(); FlowLayout statusPanelLayout = new FlowLayout(); statusPanelLayout.setAlignment(FlowLayout.LEFT); statusPanelLayout.setHgap(2); statusPanelLayout.setVgap(2); statusPanel.setLayout(statusPanelLayout); pnlMain.add(statusPanel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { fileNamePanel = new JPanel(); statusPanel.add(fileNamePanel); fileNamePanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { fileNameLabel = new JLabel(); fileNamePanel.add(fileNameLabel); fileNameLabel.setText("File Name"); fileNameLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { ibuMethodPanel = new JPanel(); statusPanel.add(ibuMethodPanel); ibuMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { ibuMethodLabel = new JLabel(); ibuMethodPanel.add(ibuMethodLabel); ibuMethodLabel.setText("IBU Method:"); ibuMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } { alcMethodPanel = new JPanel(); statusPanel.add(alcMethodPanel); alcMethodPanel.setBorder(BorderFactory .createBevelBorder(BevelBorder.LOWERED)); { alcMethodLabel = new JLabel(); alcMethodPanel.add(alcMethodLabel); alcMethodLabel.setText("Alc Method:"); alcMethodLabel.setFont(new java.awt.Font("Dialog", 1, 10)); } } } } { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { fileMenu = new JMenu(); jMenuBar1.add(fileMenu); fileMenu.setText("File"); { newFileMenuItem = new JMenuItem(); fileMenu.add(newFileMenuItem); newFileMenuItem.setText("New"); newFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. myRecipe = new Recipe(); currentFile = null; attachRecipeData(); displayRecipe(); } }); } { openFileMenuItem = new JMenuItem(); fileMenu.add(openFileMenuItem); openFileMenuItem.setText("Open"); openFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show open dialog; this method does // not return until the dialog is closed String[] ext = {"xml", "qbrew"}; String desc = "StrangBrew and QBrew recipes"; sbFileFilter saveFileFilter = new sbFileFilter(ext, desc); // fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setFileFilter(saveFileFilter); int returnVal = fileChooser.showOpenDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); Debug.print("Opening: " + file.getName() + ".\n"); ImportXml imp = new ImportXml(file.toString()); myRecipe = imp.handler.getRecipe(); myRecipe.calcMaltTotals(); myRecipe.calcHopsTotals(); myRecipe.mash.calcMashSchedule(); attachRecipeData(); currentFile = file; displayRecipe(); } else { Debug.print("Open command cancelled by user.\n"); } } }); } { findFileMenuItem = new JMenuItem(); findFileMenuItem.setText("Find"); fileMenu.add(findFileMenuItem); final JFrame owner = this; findFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // open the find dialog FindDialog fd = new FindDialog(owner); fd.setVisible(true); } }); } { saveMenuItem = new JMenuItem(); fileMenu.add(saveMenuItem); saveMenuItem.setText("Save"); saveMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int choice = 1; if (currentFile != null) { File file = currentFile; //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toXML()); out.close(); Debug.print("Saved: " + file.getAbsoluteFile()); currentFile = file; } catch (Exception e) { // TODO: handle io exception } } // prompt to save if not already saved else { choice = JOptionPane.showConfirmDialog(null, "File not saved. Do you wish to save it?", "File note saved", JOptionPane.YES_NO_OPTION); } if (choice == 0) { // same as save as: saveAs(); } } }); } { saveAsMenuItem = new JMenuItem(); fileMenu.add(saveAsMenuItem); saveAsMenuItem.setText("Save As ..."); saveAsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // This is just a test right now to see that // stuff is changed. Debug.print(myRecipe.toXML()); saveAs(); } }); } { exportMenu = new JMenu(); fileMenu.add(exportMenu); exportMenu.setText("Export"); { exportHTMLmenu = new JMenuItem(); exportMenu.add(exportHTMLmenu); exportHTMLmenu.setText("HTML"); exportHTMLmenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"html", "htm"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "HTML"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".html")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { saveAsHTML(file); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Save command cancelled by user.\n"); } } }); exportTextMenuItem = new JMenuItem(); exportMenu.add(exportTextMenuItem); exportTextMenuItem.setText("Text"); exportTextMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"txt"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "Text"); fileChooser.setFileFilter(saveFileFilter); fileChooser.setSelectedFile(new File(myRecipe.getName() + ".txt")); int returnVal = fileChooser.showSaveDialog(jMenuBar1); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application would save the file. try { FileWriter out = new FileWriter(file); out.write(myRecipe.toText()); out.close(); } catch (Exception e) { // TODO: handle io exception } } else { Debug.print("Export text command cancelled by user.\n"); } } }); } } { jSeparator2 = new JSeparator(); fileMenu.add(jSeparator2); } { exitMenuItem = new JMenuItem(); fileMenu.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // exit program System.exit(0); } }); } } { jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); { final JFrame owner = this; editPrefsMenuItem = new JMenuItem(); jMenu4.add(editPrefsMenuItem); editPrefsMenuItem.setText("Preferences..."); editPrefsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { PreferencesDialog d = new PreferencesDialog(owner, preferences); d.setVisible(true); } }); } { jSeparator1 = new JSeparator(); jMenu4.add(jSeparator1); } { deleteMenuItem = new JMenuItem(); jMenu4.add(deleteMenuItem); deleteMenuItem.setText("Delete"); deleteMenuItem.setEnabled(false); } } { mnuView = new JMenu(); jMenuBar1.add(mnuView); mnuView.setText("View"); { mashManagerMenuItem = new JMenuItem(); mnuView.add(mashManagerMenuItem); mashManagerMenuItem.setText("Mash Manager..."); mashManagerMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { mashMgr = new MashManager(myRecipe); mashMgr.setVisible(true); } }); } } { jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); { helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("Help"); } { aboutMenuItem = new JMenuItem(); jMenu5.add(aboutMenuItem); aboutMenuItem.setText("About..."); final JFrame owner = this; aboutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { aboutDlg = new AboutDialog(owner); aboutDlg.setVisible(true); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
| 1,117,035
|
public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { myRecipe.setPostBoilVolUnits(q); myRecipe.setPreBoilVolUnits(q); displayRecipe(); } }
|
public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { myRecipe.setPreBoilVolUnits(q); displayRecipe(); } }
| 1,117,036
|
public static void main(String[] args) { Recipe myRecipe = new Recipe(); if (args.length != 1) { System.err.println("Usage: filename or --gui"); System.exit(1); } else if (args[0].equals("--gui")) { MainView view = new SWTMainView(); view.init(); MainController controller = new MainController(view, myRecipe); controller.execute(); } else { // this is copied from the ImportXml main method // import an xml file, and write a bunch of stuff about it // Dont't know how to get the recipe returned from this thing, though // Use an instance of the ImportXml as the SAX event handler ImportXml imp = new ImportXml(args[0]); myRecipe = imp.handler.getRecipe(); } myRecipe.testRecipe(); }
|
public static void main(String[] args) { Recipe myRecipe = new Recipe(); if (args.length != 1) { System.err.println("Usage: filename or --gui"); System.exit(1); } else if (args[0].equals("--gui")) { MainView view = new SWTMainView(); MainController controller = new MainController(view, myRecipe); controller.execute(); } else { // this is copied from the ImportXml main method // import an xml file, and write a bunch of stuff about it // Dont't know how to get the recipe returned from this thing, though // Use an instance of the ImportXml as the SAX event handler ImportXml imp = new ImportXml(args[0]); myRecipe = imp.handler.getRecipe(); } myRecipe.testRecipe(); }
| 1,117,037
|
public int getProgress() { if ( !isSearching ) { return 100; } else { return 0; } }
|
public int getProgress() { switch ( browseHostStatus ) { return 100; } else { return 0; } }
| 1,117,038
|
public int getProgress() { if ( !isSearching ) { return 100; } else { return 0; } }
|
public int getProgress() { if ( !isSearching ) { return 100; } else { return 0; } }
| 1,117,039
|
public void run() { BrowseHostConnection connection = new BrowseHostConnection( destAddress, hostGUID, BrowseHostResults.this ); try { connection.sendBrowseHostRequest(); } catch ( BrowseHostException exp ) { NLogger.warn(BrowseHostResults.class, exp, exp); browseHostError = BROWSE_HOST_ERROR; stopSearching(); } catch ( IOException exp ) {// TODO integrate error handling if no results have been returned NLogger.warn(BrowseHostResults.class, exp, exp); browseHostError = CONNECTION_ERROR; stopSearching(); } }
|
public void run() { BrowseHostConnection connection = new BrowseHostConnection( destAddress, hostGUID, BrowseHostResults.this ); try { connection.sendBrowseHostRequest(); } catch ( BrowseHostException exp ) { NLogger.warn(BrowseHostResults.class, exp, exp); browseHostStatus = BROWSE_HOST_ERROR; stopSearching(); } catch ( IOException exp ) {// TODO integrate error handling if no results have been returned NLogger.warn(BrowseHostResults.class, exp, exp); browseHostError = CONNECTION_ERROR; stopSearching(); } }
| 1,117,040
|
public void run() { BrowseHostConnection connection = new BrowseHostConnection( destAddress, hostGUID, BrowseHostResults.this ); try { connection.sendBrowseHostRequest(); } catch ( BrowseHostException exp ) { NLogger.warn(BrowseHostResults.class, exp, exp); browseHostError = BROWSE_HOST_ERROR; stopSearching(); } catch ( IOException exp ) {// TODO integrate error handling if no results have been returned NLogger.warn(BrowseHostResults.class, exp, exp); browseHostError = CONNECTION_ERROR; stopSearching(); } }
|
public void run() { BrowseHostConnection connection = new BrowseHostConnection( destAddress, hostGUID, BrowseHostResults.this ); try { connection.sendBrowseHostRequest(); } catch ( BrowseHostException exp ) { NLogger.warn(BrowseHostResults.class, exp, exp); browseHostError = BROWSE_HOST_ERROR; stopSearching(); } catch ( IOException exp ) {// TODO integrate error handling if no results have been returned NLogger.warn(BrowseHostResults.class, exp, exp); browseHostStatus = CONNECTION_ERROR; stopSearching(); } }
| 1,117,041
|
private void initShapeTypes(Session session) { Vector st = ((CityMapTopic) as.getLiveTopic(getCityMap(session))).getShapeTypes(); // ### ugly System.out.println(">>> there are " + st.size() + " shape types:"); Vector shapeTypes = new Vector(); for (int i = 0; i < st.size(); i++) { TypeTopic shapeType = (TypeTopic) as.getLiveTopic((BaseTopic) st.elementAt(i)); shapeTypes.addElement(new ShapeType(shapeType.getID(), shapeType.getPluralNaming(), false)); // isSelected=false System.out.println(" > " + shapeType.getName()); } session.setAttribute("shapeTypes", shapeTypes); }
|
private void initShapeTypes(Session session) { Vector st = ((CityMapTopic) as.getLiveTopic(getCityMap(session))).getShapeTypes(); // ### ugly System.out.println(">>> there are " + st.size() + " shape types:"); Vector shapeTypes = new Vector(); for (int i = 0; i < st.size(); i++) { TypeTopic shapeType = (TypeTopic) as.getLiveTopic((BaseTopic) st.elementAt(i)); shapeTypes.addElement(new ShapeType(shapeType.getID(), shapeType.getPluralNaming(), as.getTopicProperty(shapeType, PROPERTY_COLOR), false)); // isSelected=false System.out.println(" > " + shapeType.getName()); } session.setAttribute("shapeTypes", shapeTypes); }
| 1,117,042
|
private void updateShapes(Session session) { try { Vector shapes = new Vector(); Vector shapeTypes = getShapeTypes(session); String mapID = getCityMap(session).getID(); // for all shape types ... Enumeration e = shapeTypes.elements(); while (e.hasMoreElements()) { ShapeType shapeType = (ShapeType) e.nextElement(); // if type is selected ... if (shapeType.isSelected) { // ... query all shapes and add Shape objects to the "shapes" vector Vector shapeTopics = cm.getViewTopics(mapID, 1, shapeType.typeID); Enumeration e2 = shapeTopics.elements(); while (e2.hasMoreElements()) { PresentableTopic shapeTopic = (PresentableTopic) e2.nextElement(); String icon = as.getLiveTopic(shapeTopic).getIconfile(); // --- load shape image and calculate position --- String url = as.getCorporateWebBaseURL() + FILESERVER_ICONS_PATH + icon; // Note 1: Toolkit.getImage() is used here instead of createImage() in order to utilize // the Toolkits caching mechanism // Note 2: ImageIcon is a kluge to make sure the image is fully loaded before we proceed Image image = new ImageIcon(Toolkit.getDefaultToolkit().getImage(new URL(url))).getImage(); int width = image.getWidth(null); int height = image.getHeight(null); System.out.println(">>> shape size: " + width + "x" + height); Point point = shapeTopic.getGeometry(); point.translate(-width / 2, -height / 2); // shapes.addElement(new Shape(url, point)); // ### involve icon size } } } session.setAttribute("shapes", shapes); System.out.println("> \"shapes\" stored in session: " + shapes.size() + " shapes"); } catch (Throwable e) { System.out.println("*** BrowseServlet.updateShapes(): " + e); } }
|
private void updateShapes(Session session) { try { Vector shapes = new Vector(); Vector shapeTypes = getShapeTypes(session); String mapID = getCityMap(session).getID(); // for all shape types ... Enumeration e = shapeTypes.elements(); while (e.hasMoreElements()) { ShapeType shapeType = (ShapeType) e.nextElement(); // if type is selected ... if (shapeType.isSelected) { // ... query all shapes and add Shape objects to the "shapes" vector Vector shapeTopics = cm.getViewTopics(mapID, 1, shapeType.typeID); Enumeration e2 = shapeTopics.elements(); while (e2.hasMoreElements()) { PresentableTopic shapeTopic = (PresentableTopic) e2.nextElement(); String icon = as.getLiveTopic(shapeTopic).getIconfile(); // --- load shape image and calculate position --- String url = as.getCorporateWebBaseURL() + FILESERVER_ICONS_PATH + icon; // Note 1: Toolkit.getImage() is used here instead of createImage() in order to utilize // the Toolkits caching mechanism // Note 2: ImageIcon is a kluge to make sure the image is fully loaded before we proceed Image image = new ImageIcon(Toolkit.getDefaultToolkit().getImage(new URL(url))).getImage(); int width = image.getWidth(null); int height = image.getHeight(null); Dimension size = new Dimension(width, height); Point point = shapeTopic.getGeometry(); point.translate(-width / 2, -height / 2); // shapes.addElement(new Shape(url, point)); // ### involve icon size } } } session.setAttribute("shapes", shapes); System.out.println("> \"shapes\" stored in session: " + shapes.size() + " shapes"); } catch (Throwable e) { System.out.println("*** BrowseServlet.updateShapes(): " + e); } }
| 1,117,043
|
private void updateShapes(Session session) { try { Vector shapes = new Vector(); Vector shapeTypes = getShapeTypes(session); String mapID = getCityMap(session).getID(); // for all shape types ... Enumeration e = shapeTypes.elements(); while (e.hasMoreElements()) { ShapeType shapeType = (ShapeType) e.nextElement(); // if type is selected ... if (shapeType.isSelected) { // ... query all shapes and add Shape objects to the "shapes" vector Vector shapeTopics = cm.getViewTopics(mapID, 1, shapeType.typeID); Enumeration e2 = shapeTopics.elements(); while (e2.hasMoreElements()) { PresentableTopic shapeTopic = (PresentableTopic) e2.nextElement(); String icon = as.getLiveTopic(shapeTopic).getIconfile(); // --- load shape image and calculate position --- String url = as.getCorporateWebBaseURL() + FILESERVER_ICONS_PATH + icon; // Note 1: Toolkit.getImage() is used here instead of createImage() in order to utilize // the Toolkits caching mechanism // Note 2: ImageIcon is a kluge to make sure the image is fully loaded before we proceed Image image = new ImageIcon(Toolkit.getDefaultToolkit().getImage(new URL(url))).getImage(); int width = image.getWidth(null); int height = image.getHeight(null); System.out.println(">>> shape size: " + width + "x" + height); Point point = shapeTopic.getGeometry(); point.translate(-width / 2, -height / 2); // shapes.addElement(new Shape(url, point)); // ### involve icon size } } } session.setAttribute("shapes", shapes); System.out.println("> \"shapes\" stored in session: " + shapes.size() + " shapes"); } catch (Throwable e) { System.out.println("*** BrowseServlet.updateShapes(): " + e); } }
|
private void updateShapes(Session session) { try { Vector shapes = new Vector(); Vector shapeTypes = getShapeTypes(session); String mapID = getCityMap(session).getID(); // for all shape types ... Enumeration e = shapeTypes.elements(); while (e.hasMoreElements()) { ShapeType shapeType = (ShapeType) e.nextElement(); // if type is selected ... if (shapeType.isSelected) { // ... query all shapes and add Shape objects to the "shapes" vector Vector shapeTopics = cm.getViewTopics(mapID, 1, shapeType.typeID); Enumeration e2 = shapeTopics.elements(); while (e2.hasMoreElements()) { PresentableTopic shapeTopic = (PresentableTopic) e2.nextElement(); String icon = as.getLiveTopic(shapeTopic).getIconfile(); // --- load shape image and calculate position --- String url = as.getCorporateWebBaseURL() + FILESERVER_ICONS_PATH + icon; // Note 1: Toolkit.getImage() is used here instead of createImage() in order to utilize // the Toolkits caching mechanism // Note 2: ImageIcon is a kluge to make sure the image is fully loaded before we proceed Image image = new ImageIcon(Toolkit.getDefaultToolkit().getImage(new URL(url))).getImage(); int width = image.getWidth(null); int height = image.getHeight(null); System.out.println(">>> shape size: " + width + "x" + height); Point point = shapeTopic.getGeometry(); point.translate(-width / 2, -height / 2); // shapes.addElement(new Shape(url, point, size)); // ### involve icon size } } } session.setAttribute("shapes", shapes); System.out.println("> \"shapes\" stored in session: " + shapes.size() + " shapes"); } catch (Throwable e) { System.out.println("*** BrowseServlet.updateShapes(): " + e); } }
| 1,117,044
|
public String getUrl() { return "job/"+name+'/'; }
|
public String getUrl() { try { return "job/"+ URLEncoder.encode(name,"UTF-8")+'/'; } catch (UnsupportedEncodingException e) { throw new Error(e); } }
| 1,117,045
|
public void createSelectionDisplay(BasicSeismogramDisplay creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionWindow = new JDialog(); //selectionWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); selectionWindow.setSize(400, 220); JToolBar infoBar = new JToolBar(); infoBar.add(new FilterSelection(selectionDisplay)); infoBar.setFloatable(false); selectionWindow.getContentPane().add(infoBar, BorderLayout.SOUTH); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getCurrentSelection().getInternalConfig(); LocalSeismogramImpl first = ((LocalSeismogramImpl)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig(first, tr.getTimeRange((LocalSeismogram)first))); ar.visibleAmpCalc(tr); selectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder); creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, creator.getName() + "." + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } selectionWindow.getContentPane().add(selectionDisplay); Toolkit tk = Toolkit.getDefaultToolkit(); selectionWindow.setLocation(tk.getScreenSize().width, tk.getScreenSize().height - selectionDisplays * 250); selectionDisplays++; selectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getCurrentSelection().getInternalConfig(); LocalSeismogramImpl first = ((LocalSeismogramImpl)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig(first, tr.getTimeRange((LocalSeismogram)first))); ar.visibleAmpCalc(tr); creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, first.getName() + " " + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } } }
|
public void createSelectionDisplay(BasicSeismogramDisplay creator){ if(selectionDisplay == null){ logger.debug("creating selection display"); selectionWindow = new JDialog(); //selectionWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); selectionWindow.setSize(400, 220); JToolBar infoBar = new JToolBar(); infoBar.add(new FilterSelection(selectionDisplay)); infoBar.setFloatable(false); selectionWindow.getContentPane().add(infoBar, BorderLayout.SOUTH); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getCurrentSelection().getInternalConfig(); LocalSeismogramImpl first = ((LocalSeismogramImpl)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig(first, tr.getTimeRange((LocalSeismogram)first))); ar.visibleAmpCalc(tr); selectionDisplay = new VerticalSeismogramDisplay(mouseForwarder, motionForwarder); creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, creator.getName() + "." + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } selectionWindow.getContentPane().add(selectionDisplay); Toolkit tk = Toolkit.getDefaultToolkit(); selectionWindow.setLocation(tk.getScreenSize().width, tk.getScreenSize().height - selectionDisplays * 250); selectionDisplays++; selectionWindow.setVisible(true); }else{ logger.debug("adding another selection"); Iterator e = creator.getSeismograms().iterator(); TimeConfigRegistrar tr = creator.getCurrentSelection().getInternalConfig(); LocalSeismogramImpl first = ((LocalSeismogramImpl)e.next()); AmpConfigRegistrar ar = new AmpConfigRegistrar(new OffsetMeanAmpConfig(first, tr.getTimeRange((LocalSeismogram)first))); ar.visibleAmpCalc(tr); creator.getCurrentSelection().setDisplay(selectionDisplay.addDisplay(first, tr, creator.getName() + "." + creator.getCurrentSelection().getColor())); while(e.hasNext()){ selectionDisplay.addSeismogram(((LocalSeismogramImpl)e.next()), 0); } } }
| 1,117,046
|
private void compareSymbol(String str, ATSymbol sym) { try { assertEquals(str, sym.getText().asNativeText().javaValue); } catch (XTypeMismatch e) { fail(e.getMessage()); } }
|
private void compareSymbol(String str, ATSymbol sym) { try { assertEquals(str, sym.base_getText().asNativeText().javaValue); } catch (XTypeMismatch e) { fail(e.getMessage()); } }
| 1,117,047
|
public static final AGSymbol alloc(String javaRepresentation) { return alloc(NATText.atValue(javaRepresentation)); }
|
public static final AGSymbol alloc(String javaRepresentation) { return alloc(NATText.atValue(javaRepresentation)); }
| 1,117,048
|
private NFA<Object, String> createNFA(Protocol protocol){ EList states = protocol.getStates(); provervisual.State initState = null; HashSet <Object>finalStates = new HashSet<Object>(); HashSet <Object>actionStates = new HashSet<Object>(); for(Iterator i = states.iterator(); i.hasNext();){ Object element = i.next(); provervisual.State state = (provervisual.State) element; if(state instanceof InitialState){ initState = state; }else if(state instanceof FinalState){ finalStates.add(state); }else{ actionStates.add(element); } } EList operations = protocol.getOperations(); Map<Object, List<Pair<Object, String>>> node2arcs = this.<Object, String> makeNode2Arcs(); for(Iterator i = operations.iterator(); i.hasNext();){ Operation op = (Operation) i.next() ; String guard = ""; if(op.getOperationGuard() != null) guard = op.getOperationGuard(); addTrans(node2arcs, op.getStartState(), "<"+op.getOperationAbbrev()+ "["+guard+"]>", op.getEndState() ); } NFA<Object, String> nfa = makeNFA(initState, new HashSet<Object>(finalStates), node2arcs); return nfa; }
|
private NFA<Object, String> createNFA(Protocol protocol){ EList states = protocol.getStates(); provervisual.State initState = null; HashSet <Object>finalStates = new HashSet<Object>(); HashSet <Object>actionStates = new HashSet<Object>(); for(Iterator i = states.iterator(); i.hasNext();){ Object element = i.next(); provervisual.State state = (provervisual.State) element; if(state instanceof InitialState){ initState = state; }else if(state instanceof FinalState){ finalStates.add(state); }else{ actionStates.add(element); } } EList operations = protocol.getOperations(); Map<Object, List<Pair<Object, String>>> node2arcs = this.<Object, String> makeNode2Arcs(); for(Iterator i = operations.iterator(); i.hasNext();){ Operation op = (Operation) i.next() ; String guard = ""; if(op.getOperationGuard() != null) guard = "["+op.getOperationGuard()+"]"; addTrans(node2arcs, op.getStartState(), "<"+op.getOperationAbbrev()+ "["+guard+"]>", op.getEndState() ); } NFA<Object, String> nfa = makeNFA(initState, new HashSet<Object>(finalStates), node2arcs); return nfa; }
| 1,117,050
|
private NFA<Object, String> createNFA(Protocol protocol){ EList states = protocol.getStates(); provervisual.State initState = null; HashSet <Object>finalStates = new HashSet<Object>(); HashSet <Object>actionStates = new HashSet<Object>(); for(Iterator i = states.iterator(); i.hasNext();){ Object element = i.next(); provervisual.State state = (provervisual.State) element; if(state instanceof InitialState){ initState = state; }else if(state instanceof FinalState){ finalStates.add(state); }else{ actionStates.add(element); } } EList operations = protocol.getOperations(); Map<Object, List<Pair<Object, String>>> node2arcs = this.<Object, String> makeNode2Arcs(); for(Iterator i = operations.iterator(); i.hasNext();){ Operation op = (Operation) i.next() ; String guard = ""; if(op.getOperationGuard() != null) guard = op.getOperationGuard(); addTrans(node2arcs, op.getStartState(), "<"+op.getOperationAbbrev()+ "["+guard+"]>", op.getEndState() ); } NFA<Object, String> nfa = makeNFA(initState, new HashSet<Object>(finalStates), node2arcs); return nfa; }
|
private NFA<Object, String> createNFA(Protocol protocol){ EList states = protocol.getStates(); provervisual.State initState = null; HashSet <Object>finalStates = new HashSet<Object>(); HashSet <Object>actionStates = new HashSet<Object>(); for(Iterator i = states.iterator(); i.hasNext();){ Object element = i.next(); provervisual.State state = (provervisual.State) element; if(state instanceof InitialState){ initState = state; }else if(state instanceof FinalState){ finalStates.add(state); }else{ actionStates.add(element); } } EList operations = protocol.getOperations(); Map<Object, List<Pair<Object, String>>> node2arcs = this.<Object, String> makeNode2Arcs(); for(Iterator i = operations.iterator(); i.hasNext();){ Operation op = (Operation) i.next() ; String guard = ""; if(op.getOperationGuard() != null) guard = op.getOperationGuard(); addTrans(node2arcs, op.getStartState(), "<"+op.getOperationAbbrev()+ guard+">", op.getEndState() ); } NFA<Object, String> nfa = makeNFA(initState, new HashSet<Object>(finalStates), node2arcs); return nfa; }
| 1,117,051
|
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 0) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[0]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
|
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[0]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
| 1,117,052
|
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 0) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[0]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
|
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 0) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
| 1,117,053
|
public static void handle(Throwable thrown) { handle("An uncaught exception has occured. Please report this to geebugs@seis.sc.edu", thrown); }
|
public static void handle(Throwable thrown) { handle("An uncaught exception has occured.", thrown); }
| 1,117,054
|
public void addZoomListener(ZoomListener zl){ System.out.println("ZoomListener: " + zl); listenerList.add(ZoomListener.class, zl); }
|
public void addZoomListener(ZoomListener zl){ listenerList.add(ZoomListener.class, zl); }
| 1,117,055
|
public char asChar() throws XIllegalArgument { if (javaValue.length() == 1) { return javaValue.charAt(0); } else { throw new XIllegalArgument("Expected a character, given a string: " + javaValue); } }
|
public char asChar() throws XTypeMismatch { if (javaValue.length() == 1) { return javaValue.charAt(0); } else { throw new XIllegalArgument("Expected a character, given a string: " + javaValue); } }
| 1,117,056
|
public char asChar() throws XIllegalArgument { if (javaValue.length() == 1) { return javaValue.charAt(0); } else { throw new XIllegalArgument("Expected a character, given a string: " + javaValue); } }
|
public char asChar() throws XIllegalArgument { if (javaValue.length() == 1) { return javaValue.charAt(0); } else { throw new XTypeMismatch(Character.class, this); } }
| 1,117,057
|
public OMStation(Station stat){ super(stat.my_location.latitude, stat.my_location.longitude, xPoints, yPoints, OMPoly.COORDMODE_ORIGIN); station = stat; setFillPaint(Color.BLUE); setLinePaint(Color.BLACK); generate(getProjection()); }
|
public OMStation(Station stat){ super(stat.my_location.latitude, stat.my_location.longitude, xPoints, yPoints, OMPoly.COORDMODE_ORIGIN); station = stat; setFillPaint(STATION); setLinePaint(Color.BLACK); generate(getProjection()); }
| 1,117,058
|
public void deselect(){ setFillPaint(Color.BLUE); selected = false; }
|
public void deselect(){ setFillPaint(STATION); selected = false; }
| 1,117,059
|
public void init(boolean content) throws WebdavIntfException { if (!content) { return; } try { if ((eventInfo == null) && exists) { String entityName = cdURI.getEntityName(); if (entityName == null) { return; } if (debug) { debugMsg("SEARCH: compNode retrieve event on path " + cdURI.getCal().getPath() + " with name " + entityName); } if (events == null) { events = svci.findEventsByName(cdURI.getCal(), entityName); } if ((events == null) || (events.size() == 0)) { exists = false; } else { if (events.size() == 1) { /* Non recurring or no overrides */ eventInfo = (EventInfo)events.iterator().next(); } else { /* Find the master */ // XXX Check the guids here? Iterator it = events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); if (ei.getEvent().getRecurring()) { eventInfo = ei; } } if (eventInfo == null) { throw new WebdavIntfException("Missing master for " + cdURI); } } } } if (eventInfo != null) { BwEvent event = eventInfo.getEvent(); creDate = event.getCreated(); lastmodDate = event.getLastmod(); } name = cdURI.getEntityName(); } catch (WebdavIntfException wie) { throw wie; } catch (Throwable t) { throw new WebdavIntfException(t); } }
|
public void init(boolean content) throws WebdavIntfException { if (!content) { return; } try { if ((eventInfo == null) && exists) { String entityName = cdURI.getEntityName(); if (entityName == null) { return; } if (debug) { debugMsg("SEARCH: compNode retrieve event on path " + cdURI.getCal().getPath() + " with name " + entityName); } if (events == null) { events = getSvci().findEventsByName(cdURI.getCal(), entityName); } if ((events == null) || (events.size() == 0)) { exists = false; } else { if (events.size() == 1) { /* Non recurring or no overrides */ eventInfo = (EventInfo)events.iterator().next(); } else { /* Find the master */ // XXX Check the guids here? Iterator it = events.iterator(); while (it.hasNext()) { EventInfo ei = (EventInfo)it.next(); if (ei.getEvent().getRecurring()) { eventInfo = ei; } } if (eventInfo == null) { throw new WebdavIntfException("Missing master for " + cdURI); } } } } if (eventInfo != null) { BwEvent event = eventInfo.getEvent(); creDate = event.getCreated(); lastmodDate = event.getLastmod(); } name = cdURI.getEntityName(); } catch (WebdavIntfException wie) { throw wie; } catch (Throwable t) { throw new WebdavIntfException(t); } }
| 1,117,060
|
public EventInfo(BwEvent event) { setEvent(event); }
|
public EventInfo(BwEvent event) { setEvent(event); }
| 1,117,061
|
public static void init(String[] args) { Properties props = initProperties(args); /* Check for properties on the command line and load them if they exist. */ /** Configure log4j, not required for DHI, but is useful. */ BasicConfigurator.configure(); logger.info("Logging configured"); /* Initialize the ORB. This must be done before the corba system can * be used. Parameters passed in via the args and props configure the * ORB. Consult the docummentation for your orb for more information. */ orb = (org.omg.CORBA_2_3.ORB)org.omg.CORBA.ORB.init(args, props); logger.info("orb initialized, class="+orb.getClass().getName()); /* Valuetypes are corba objects that are sent "over the wire" and need * a factory to handle the unmarshalling on the client side, so that the * correct object is created locally. The AllVTFactory.register method * registers factories for all of the IDL defined valuetypes found in * the fissuresImpl package. */ AllVTFactory vt = new AllVTFactory(); vt.register(orb); logger.info("register valuetype factories"); /* Here we pick a name server to connect to. These are two choices for * the IRIS DMC and USC SCEPP, others may exist. Port 6371 are used by * both USC and the DMC, but this is not required.*/ fisName = new FissuresNamingServiceImpl(orb); logger.info("create fisName helper with orb"); //fisName.setNameServiceCorbaLoc("corbaloc:iiop:dmc.iris.washington.edu:6371/NameService"); fisName.setNameServiceCorbaLoc("corbaloc:iiop:pooh.seis.sc.edu:6371/NameService"); //try { NamingContext nc = fisName.getNameService(); logger.info("got fis name service"); }
|
public static void init(String[] args) { Properties props = initProperties(args); /* Check for properties on the command line and load them if they exist. */ /** Configure log4j, not required for DHI, but is useful. */ BasicConfigurator.configure(); logger.info("Logging configured"); /* Initialize the ORB. This must be done before the corba system can * be used. Parameters passed in via the args and props configure the * ORB. Consult the docummentation for your orb for more information. */ orb = (org.omg.CORBA_2_3.ORB)org.omg.CORBA.ORB.init(args, props); logger.info("orb initialized, class="+orb.getClass().getName()); /* Valuetypes are corba objects that are sent "over the wire" and need * a factory to handle the unmarshalling on the client side, so that the * correct object is created locally. The AllVTFactory.register method * registers factories for all of the IDL defined valuetypes found in * the fissuresImpl package. */ AllVTFactory vt = new AllVTFactory(); vt.register(orb); logger.info("register valuetype factories"); /* Here we pick a name server to connect to. These are two choices for * the IRIS DMC and USC SCEPP, others may exist. Port 6371 are used by * both USC and the DMC, but this is not required.*/ fisName = new FissuresNamingService(orb); logger.info("create fisName helper with orb"); //fisName.setNameServiceCorbaLoc("corbaloc:iiop:dmc.iris.washington.edu:6371/NameService"); fisName.setNameServiceCorbaLoc("corbaloc:iiop:pooh.seis.sc.edu:6371/NameService"); //try { NamingContext nc = fisName.getNameService(); logger.info("got fis name service"); }
| 1,117,062
|
public FissuresNamingServiceImpl(org.omg.CORBA_2_3.ORB orb) throws InvalidName { org.omg.CORBA.Object obj = null; obj = orb.resolve_initial_references("NameService"); namingContext = NamingContextExtHelper.narrow(obj); }
|
public FissuresNamingServiceImpl(org.omg.CORBA_2_3.ORB orb) throws InvalidName { org.omg.CORBA.Object obj = null; obj = orb.resolve_initial_references("NameService"); namingContext = NamingContextExtHelper.narrow(obj); }
| 1,117,063
|
public PlottableDC getPlottableDC(String dns, String objectname) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { PlottableDC plottabledc = PlottableDCHelper.narrow(getPlottableDC(dns, objectname)); return plottabledc; }
|
public PlottableDC getPlottableDC(String dns, String objectname) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { PlottableDC plottabledc = PlottableDCHelper.narrow(getPlottableDCObject(dns, objectname)); return plottabledc; }
| 1,117,064
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound, CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) { dns = dns + "/" + interfacename + ".interface"; } if(objectname != null && objectname.length() != 0) { dns = dns + "/" + objectname + ".object" + getVersion(); } logger.info("the final dns resolved is " + dns); // try 2 times in case of an exception int maxTry = 2; for(int i = 0; i < 2; i++) { try { NameComponent[] names = getNameService().to_name(dns); //return resolveBySteps(names); // for debugging return getNameService().resolve(names); } catch(org.omg.CORBA.SystemException e) { logger.info("retry=" + i + " " + e); if(i == maxTry) { throw e; } } catch(NotFound nfe) { logger.info("retry=" + i + "NOT FOUND Exception caught while resolving name context and the name not found is " + nfe.rest_of_name[0].id); if(i == maxTry) { throw nfe; } } catch(InvalidName ine) { logger.info("retry=" + i + "INVALID NAME Exception caught while resolving name context", ine); if(i == maxTry) { throw ine; } } catch(CannotProceed cpe) { logger.info("retry=" + i + "CANNOT PROCEED Exception caught while resolving dns name context"); if(i == maxTry) { throw cpe; } } } throw new RuntimeException("This code should never happen"); }
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound, CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) { dns = dns + "/" + interfacename + ".interface"; } if(objectname != null && objectname.length() != 0) { dns = dns + "/" + objectname + ".object" + getVersion(); } logger.info("the final dns resolved is " + dns); // try 2 times in case of an exception int maxTry = 2; for(int i = 0; i < 2; i++) { try { NameComponent[] names = getNameService().to_name(dns); //return resolveBySteps(names); // for debugging return getNameService().resolve(names); } catch(org.omg.CORBA.SystemException e) { logger.info("retry=" + i + " " + e); if(i == maxTry) { throw e; } } catch(NotFound nfe) { logger.info("retry=" + i + "NOT FOUND Exception caught while resolving name context and the name not found is " + nfe.rest_of_name[0].id); if(i == maxTry) { throw nfe; } } catch(InvalidName ine) { logger.info("retry=" + i + "INVALID NAME Exception caught while resolving name context", ine); if(i == maxTry) { throw ine; } } catch(CannotProceed cpe) { logger.info("retry=" + i + "CANNOT PROCEED Exception caught while resolving dns name context"); if(i == maxTry) { throw cpe; } } } throw new RuntimeException("This code should never happen"); }
| 1,117,065
|
public void setAllBeginTime(MicroSecondDate b){ Iterator e = seismos.keySet().iterator(); while(e.hasNext()){ timeConfig.setBeginTime((DataSetSeismogram)e.next(), b); } }
|
public void setAllBeginTime(MicroSecondDate b){ Iterator e = seismos.keySet().iterator(); while(e.hasNext()){ timeConfig.setBeginTime((DataSetSeismogram)e.next(), b); } }
| 1,117,066
|
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.Profile2EditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(ProfileNode_profileEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(ProfileNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(ProfileContentsEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); }
|
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(Profile2EditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(ProfileNode_profileEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(ProfileNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(ProfileContentsEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); }
| 1,117,067
|
public void removeSeismogram(LocalSeismogram aSeis){ MicroSecondTimeRange calcIntv; if(this.timeConfig == null) calcIntv = new MicroSecondTimeRange(((LocalSeismogramImpl)aSeis).getBeginTime(), ((LocalSeismogramImpl)aSeis).getEndTime()); else calcIntv = timeConfig.getTimeRange(aSeis); if(seismos.contains(aSeis)){ LocalSeismogramImpl seis = (LocalSeismogramImpl)aSeis; int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { seismos.remove(aSeis); return; } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); if(meanDiff == this.ampRange.getMaxValue()) this.ampRange = null; } catch (Exception e) { this.ampRange = null; } seismos.remove(aSeis); if(ampRange == null){ Iterator e = seismos.iterator(); while(e.hasNext()) this.getAmpRange(((LocalSeismogram)e.next()), calcIntv); this.updateAmpSyncListeners(); } } }
|
public void removeSeismogram(LocalSeismogram aSeis){ MicroSecondTimeRange calcIntv; if(this.timeConfig == null) calcIntv = new MicroSecondTimeRange(((LocalSeismogramImpl)aSeis).getBeginTime(), ((LocalSeismogramImpl)aSeis).getEndTime()); else calcIntv = timeConfig.getTimeRange(aSeis); if(seismos.contains(aSeis)){ LocalSeismogramImpl seis = (LocalSeismogramImpl)aSeis; int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), calcIntv.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { seismos.remove(aSeis); return; } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); if(meanDiff >= this.ampRange.getMaxValue() - 1) this.ampRange = null; } catch (Exception e) { this.ampRange = null; } seismos.remove(aSeis); if(ampRange == null){ Iterator e = seismos.iterator(); while(e.hasNext()) this.getAmpRange(((LocalSeismogram)e.next()), calcIntv); this.updateAmpSyncListeners(); } } }
| 1,117,068
|
public DateTime(Object instant, DateTimeZone zone) { super(instant, zone); }
|
public DateTime(Object instant, DateTimeZone zone) { super(instant, zone); }
| 1,117,070
|
public ATObject meta_select(ATObject receiver, ATSymbol selector) throws InterpreterException { String jSelector = Reflection.upSelector(selector); try { return Symbiosis.readField(wrappedObject_, wrappedObject_.getClass(), jSelector); } catch (XUndefinedField e) { return super.meta_select(receiver, selector); } }
|
public ATObject meta_select(ATObject receiver, ATSymbol selector) throws InterpreterException { String jSelector = Reflection.upSelector(selector); try { return Symbiosis.readField(wrappedObject_, wrappedObject_.getClass(), jSelector); } catch (XUndefinedField e) { Method[] choices = Symbiosis.getMethods(wrappedObject_.getClass(), jSelector, false); if (choices.length > 0) { return new JavaMethod(this, wrappedObject_, choices); } else { return super.meta_select(receiver, selector); } } }
| 1,117,071
|
public ATObject meta_select(ATObject receiver, ATSymbol selector) throws InterpreterException { String jSelector = Reflection.upSelector(selector); try { return Symbiosis.readField(null, wrappedClass_, jSelector); } catch (XUndefinedField e) { return super.meta_select(receiver, selector); } }
|
public ATObject meta_select(ATObject receiver, ATSymbol selector) throws InterpreterException { String jSelector = Reflection.upSelector(selector); try { return Symbiosis.readField(null, wrappedClass_, jSelector); } catch (XUndefinedField e) { Method[] choices = Symbiosis.getMethods(wrappedClass_, jSelector, true); if (choices.length > 0) { return new JavaMethod(this, null, choices); } else { return super.meta_select(receiver, selector); } } }
| 1,117,072
|
public boolean removeDisplay(BasicSeismogramDisplay display){ if(basicDisplays.contains(display)){ if(basicDisplays.size() == 1){ this.removeAll(); return true; } super.remove(display); basicDisplays.remove(display); sorter.remove(display.getName()); ((BasicSeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); ((BasicSeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder(); super.revalidate(); display.destroy(); repaint(); return true; } return false; }
|
public boolean removeDisplay(BasicSeismogramDisplay display){ if(basicDisplays.contains(display)){ if(basicDisplays.size() == 1){ this.removeAll(); return true; } super.remove(display); basicDisplays.remove(display); sorter.remove(display.getSeismograms()[0].toString()); ((BasicSeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); ((BasicSeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder(); super.revalidate(); display.destroy(); repaint(); return true; } return false; }
| 1,117,073
|
public static void insertParameterRef(Element paramRef, String name, String href, Object value) { // write(href, value); //Element paramRef = doc.createElement("parameterRef"); paramRef.setAttribute("name", name); paramRef.setAttributeNS(xlinkNS,"xlink:type", "type/xml"); if(href.startsWith("file:")) { href = href.substring(href.indexOf("file:")+1); } href.replace(' ', '_'); paramRef.setAttributeNS(xlinkNS, "xlink:href", href); if(!(value instanceof String)) { paramRef.setAttribute("objectType", getObjectType(value)); } /* try { DocumentBuilderFactory factory = DocumentBuilderFactory.getInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); } catch(Exception e) { e.printStackTrace(); }*/ }
|
public static void insertParameterRef(Element paramRef, String name, String href, Object value) { // write(href, value); //Element paramRef = doc.createElement("parameterRef"); paramRef.setAttribute("name", name); paramRef.setAttributeNS(xlinkNS,"xlink:type", "type/xml"); if(href.startsWith("file:")) { href = href.substring(href.indexOf("file:")+5); } href.replace(' ', '_'); paramRef.setAttributeNS(xlinkNS, "xlink:href", href); if(!(value instanceof String)) { paramRef.setAttribute("objectType", getObjectType(value)); } /* try { DocumentBuilderFactory factory = DocumentBuilderFactory.getInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); } catch(Exception e) { e.printStackTrace(); }*/ }
| 1,117,074
|
public static void insertParameterRef(Element paramRef, String name, String href, Object value) { // write(href, value); //Element paramRef = doc.createElement("parameterRef"); paramRef.setAttribute("name", name); paramRef.setAttributeNS(xlinkNS,"xlink:type", "type/xml"); if(href.startsWith("file:")) { href = href.substring(href.indexOf("file:")+1); } href.replace(' ', '_'); paramRef.setAttributeNS(xlinkNS, "xlink:href", href); if(!(value instanceof String)) { paramRef.setAttribute("objectType", getObjectType(value)); } /* try { DocumentBuilderFactory factory = DocumentBuilderFactory.getInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); } catch(Exception e) { e.printStackTrace(); }*/ }
|
public static void insertParameterRef(Element paramRef, String name, String href, Object value) { // write(href, value); //Element paramRef = doc.createElement("parameterRef"); paramRef.setAttribute("name", name); paramRef.setAttributeNS(xlinkNS,"xlink:type", "type/xml"); if(href.startsWith("file:")) { href = href.substring(href.indexOf("file:")+1); } href = href.replace(' ', '_'); paramRef.setAttributeNS(xlinkNS, "xlink:href", href); if(!(value instanceof String)) { paramRef.setAttribute("objectType", getObjectType(value)); } /* try { DocumentBuilderFactory factory = DocumentBuilderFactory.getInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); } catch(Exception e) { e.printStackTrace(); }*/ }
| 1,117,075
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
|
public static void insert(XMLStreamWriter writer, Channel channel) throws XMLStreamException{ writer.writeStartElement("id"); XMLChannelId.insert(writer, channel.get_id()); XMLUtil.writeEndElementWithNewLine(writer); Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
| 1,117,076
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
|
public static void insert(Element element, Channel channel) { XMLUtil.writeTextElement(writer, "name", channel.name); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
| 1,117,077
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
| 1,117,078
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
| 1,117,079
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
| 1,117,080
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
|
public static void insert(Element element, Channel channel) { Document doc = element.getOwnerDocument(); Element id = doc.createElement("id"); XMLChannelId.insert(id, channel.get_id()); element.appendChild(id); element.appendChild(XMLUtil.createTextElement(doc, "name", channel.name)); Element an_orientation = doc.createElement("an_orientation"); XMLOrientation.insert(an_orientation, channel.an_orientation); element.appendChild(an_orientation); Element sampling_info = doc.createElement("sampling_info"); XMLSampling.insert(sampling_info, channel.sampling_info); element.appendChild(sampling_info); Element effective_time = doc.createElement("effective_time"); XMLTimeRange.insert(effective_time, channel.effective_time); element.appendChild(effective_time); Element my_site = doc.createElement("my_site"); XMLSite.insert(my_site, channel.my_site); element.appendChild(my_site); }
| 1,117,081
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.