bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); }
|
public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); }
| 1,115,817
|
public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); }
|
public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(SBStringUtils.xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); }
| 1,115,818
|
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return data.getStepType(row); case 1 : return data.getStepMethod(row); case 2 : return new Double(data.getStepStartTemp(row)) ; case 3 : return new Double(data.getStepEndTemp(row)) ; case 4 : return new Integer(data.getStepRampMin(row)); case 5 : return new Integer(data.getStepMin(row)); } } catch (Exception e) { Debug.print(e.toString()); }; return ""; }
|
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return data.getStepType(row); case 1 : return data.getStepMethod(row); case 2 : return SBStringUtils.df1.format(data.getStepStartTemp(row)); case 3 : return new Double(data.getStepEndTemp(row)) ; case 4 : return new Integer(data.getStepRampMin(row)); case 5 : return new Integer(data.getStepMin(row)); } } catch (Exception e) { Debug.print(e.toString()); }; return ""; }
| 1,115,820
|
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return data.getStepType(row); case 1 : return data.getStepMethod(row); case 2 : return new Double(data.getStepStartTemp(row)) ; case 3 : return new Double(data.getStepEndTemp(row)) ; case 4 : return new Integer(data.getStepRampMin(row)); case 5 : return new Integer(data.getStepMin(row)); } } catch (Exception e) { Debug.print(e.toString()); }; return ""; }
|
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return data.getStepType(row); case 1 : return data.getStepMethod(row); case 2 : return new Double(data.getStepStartTemp(row)) ; case 3 : return SBStringUtils.df1.format(data.getStepEndTemp(row)) ; case 4 : return new Integer(data.getStepRampMin(row)); case 5 : return new Integer(data.getStepMin(row)); } } catch (Exception e) { Debug.print(e.toString()); }; return ""; }
| 1,115,821
|
private static void setDuplexReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String interfaceName = null; // String target = null; String bind = null; String unbind = null; boolean optional = false; for (int i = 0; i < parser.getAttributeCount(); i++) { // if (parser.getAttributeName(i).equals("name")) { // if (checkNMToken(parser.getAttributeValue(i))) { // name = parser.getAttributeValue(i); // // } else { // throw new IllegalXMLException("Attribute \"" // + parser.getAttributeName(i) // + "\" in duplex-reference-tag is invalid."); // } // } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in duplex-reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("optional")) { optional = parseBoolean(parser, i); // } else if (parser.getAttributeName(i).equals("target")) { // target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser);// if (name == null)// missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); // try { // Filter filter; // if (target != null) { // filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" // + interfaceName + ")" + target + ")"); // } else { // filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" // + interfaceName + ")"); // } DuplexReference ref = new DuplexReference(interfaceName, optional, bind, unbind, bc); compConf.addDuplexReference(ref); // } catch (InvalidSyntaxException e) { // throw new IllegalXMLException( // "Couldn't create filter for reference \"" + name + "\"", e); // } }
|
private static void setDuplexReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String interfaceName = null; // String target = null; String bind = null; String unbind = null; boolean optional = false; for (int i = 0; i < parser.getAttributeCount(); i++) { // if (parser.getAttributeName(i).equals("name")) { // if (checkNMToken(parser.getAttributeValue(i))) { // name = parser.getAttributeValue(i); // // } else { // throw new IllegalXMLException("Attribute \"" // + parser.getAttributeName(i) // + "\" in duplex-reference-tag is invalid."); // } // } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in duplex-reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("optional")) { optional = parseBoolean(parser, i); // } else if (parser.getAttributeName(i).equals("target")) { // target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser);// if (name == null)// missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); // try { // Filter filter; // if (target != null) { // filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" // + interfaceName + ")" + target + ")"); // } else { // filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" // + interfaceName + ")"); // } DuplexReference ref = new DuplexReference(interfaceName, optional, bind, unbind, bc); compConf.addDuplexReference(ref); // } catch (InvalidSyntaxException e) { // throw new IllegalXMLException( // "Couldn't create filter for reference \"" + name + "\"", e); // } }
| 1,115,822
|
private static void setReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String name = null; String interfaceName = null; String target = null; String bind = null; String unbind = null; boolean optional = false; // default value boolean multiple = false; // default value boolean dynamic = false; // default value for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { if (checkNMToken(parser.getAttributeValue(i))) { name = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid."); } } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("cardinality")) { String val = parser.getAttributeValue(i); if ("1..1".equals(val)) { multiple = optional = false; } else if ("0..1".equals(val)) { optional = true; multiple = false; } else if ("1..n".equals(val)) { optional = false; multiple = true; } else if ("0..n".equals(val)) { multiple = optional = true; } else { invalidValue(parser, new String[] { "1..1", "0..1", "1..n", "0..n" }, i); } } else if (parser.getAttributeName(i).equals("policy")) { String val = parser.getAttributeValue(i); if ("static".equals(val)) { dynamic = false; } else if ("dynamic".equals(val)) { dynamic = true; } else { invalidValue(parser, new String[] { "static", "dynamic" }, i); } } else if (parser.getAttributeName(i).equals("target")) { target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser); if (name == null) missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); try { Filter filter; if (target != null) { filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); } Reference ref = new Reference(name, filter, interfaceName, optional, multiple, dynamic, bind, unbind, bc); compConf.addReference(ref); } catch (InvalidSyntaxException e) { throw new IllegalXMLException( "Couldn't create filter for reference \"" + name + "\"", e); } }
|
private static void setReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String name = null; String interfaceName = null; String target = null; String bind = null; String unbind = null; boolean optional = false; // default value boolean multiple = false; // default value boolean dynamic = false; // default value for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { if (checkNMToken(parser.getAttributeValue(i))) { name = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid."); } } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("cardinality")) { String val = parser.getAttributeValue(i); if ("1..1".equals(val)) { multiple = optional = false; } else if ("0..1".equals(val)) { optional = true; multiple = false; } else if ("1..n".equals(val)) { optional = false; multiple = true; } else if ("0..n".equals(val)) { multiple = optional = true; } else { invalidValue(parser, new String[] { "1..1", "0..1", "1..n", "0..n" }, i); } } else if (parser.getAttributeName(i).equals("policy")) { String val = parser.getAttributeValue(i); if ("static".equals(val)) { dynamic = false; } else if ("dynamic".equals(val)) { dynamic = true; } else { invalidValue(parser, new String[] { "static", "dynamic" }, i); } } else if (parser.getAttributeName(i).equals("target")) { target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser); if (name == null) missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); try { StringBuffer sb = new StringBuffer(); sb.append("(|("); sb.append(Constants.OBJECTCLASS); sb.append("="); sb.append(interfaceName); sb.append(")(&("); sb.append(Constants.OBJECTCLASS); sb.append("="); sb.append(DuplexFactoryComponent.class.getName()); sb.append(")("); sb.append(org.bamja.core.impl.Constants.OBJECT_CLASS); sb.append("="); sb.append(interfaceName); sb.append(")))"); if (target != null) { filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); } Reference ref = new Reference(name, filter, interfaceName, optional, multiple, dynamic, bind, unbind, bc); compConf.addReference(ref); } catch (InvalidSyntaxException e) { throw new IllegalXMLException( "Couldn't create filter for reference \"" + name + "\"", e); } }
| 1,115,823
|
private static void setReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String name = null; String interfaceName = null; String target = null; String bind = null; String unbind = null; boolean optional = false; // default value boolean multiple = false; // default value boolean dynamic = false; // default value for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { if (checkNMToken(parser.getAttributeValue(i))) { name = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid."); } } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("cardinality")) { String val = parser.getAttributeValue(i); if ("1..1".equals(val)) { multiple = optional = false; } else if ("0..1".equals(val)) { optional = true; multiple = false; } else if ("1..n".equals(val)) { optional = false; multiple = true; } else if ("0..n".equals(val)) { multiple = optional = true; } else { invalidValue(parser, new String[] { "1..1", "0..1", "1..n", "0..n" }, i); } } else if (parser.getAttributeName(i).equals("policy")) { String val = parser.getAttributeValue(i); if ("static".equals(val)) { dynamic = false; } else if ("dynamic".equals(val)) { dynamic = true; } else { invalidValue(parser, new String[] { "static", "dynamic" }, i); } } else if (parser.getAttributeName(i).equals("target")) { target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser); if (name == null) missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); try { Filter filter; if (target != null) { filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); } Reference ref = new Reference(name, filter, interfaceName, optional, multiple, dynamic, bind, unbind, bc); compConf.addReference(ref); } catch (InvalidSyntaxException e) { throw new IllegalXMLException( "Couldn't create filter for reference \"" + name + "\"", e); } }
|
private static void setReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String name = null; String interfaceName = null; String target = null; String bind = null; String unbind = null; boolean optional = false; // default value boolean multiple = false; // default value boolean dynamic = false; // default value for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { if (checkNMToken(parser.getAttributeValue(i))) { name = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid."); } } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("cardinality")) { String val = parser.getAttributeValue(i); if ("1..1".equals(val)) { multiple = optional = false; } else if ("0..1".equals(val)) { optional = true; multiple = false; } else if ("1..n".equals(val)) { optional = false; multiple = true; } else if ("0..n".equals(val)) { multiple = optional = true; } else { invalidValue(parser, new String[] { "1..1", "0..1", "1..n", "0..n" }, i); } } else if (parser.getAttributeName(i).equals("policy")) { String val = parser.getAttributeValue(i); if ("static".equals(val)) { dynamic = false; } else if ("dynamic".equals(val)) { dynamic = true; } else { invalidValue(parser, new String[] { "static", "dynamic" }, i); } } else if (parser.getAttributeName(i).equals("target")) { target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser); if (name == null) missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); try { Filter filter; if (target != null) { filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); } Reference ref = new Reference(name, filter, interfaceName, optional, multiple, dynamic, bind, unbind, bc); compConf.addReference(ref); } catch (InvalidSyntaxException e) { throw new IllegalXMLException( "Couldn't create filter for reference \"" + name + "\"", e); } }
| 1,115,824
|
private static void setService(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { boolean interfaceFound = false; /* If there is an attribute in the service tag */ for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("servicefactory")) { // && boolean isServiceFactory = parseBoolean(parser, i); if (isServiceFactory && (compConf.isImmediate() || compConf.getFactory() != null)) { throw new IllegalXMLException( "Attribute servicefactory in service-tag " + "cannot be set to \"true\" when component " + "is either an immediate component or " + "a factory component."); } compConf.setServiceFactory(isServiceFactory); } else { throw new IllegalXMLException("Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in service-tag"); } } int event = parser.next(); while (event != XmlPullParser.END_TAG) { if (event != XmlPullParser.START_TAG) { event = parser.next(); continue; } if (isInSCRNamespace(parser, "provide", 3)) { String interfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("interface")) { interfaceName = parser.getAttributeValue(i); interfaceFound = true; } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in provide-tag"); } } if (interfaceName == null) missingAttr(parser, "interface"); compConf.addService(interfaceName); skip(parser); } else if (isInSCRNamespace(parser, "duplex-reference", 3)) { handleDuplexReference(compConf, parser, declaringBundle); } else if (isInSCRNamespace(parser, "virtual_provide", 3)) { String virtualInterfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { virtualInterfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in virtual_provide-tag"); } } if (virtualInterfaceName == null) missingAttr(parser, "name"); compConf.addVirtuallService(virtualInterfaceName); skip(parser); } else { skip(parser); } event = parser.getEventType(); } /* check if required attributes has been set */ if (!interfaceFound) { throw new IllegalXMLException( "Service-tag did not contain a proper \"provides\"-tag."); } }
|
private static void setService(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { boolean interfaceFound = false; /* If there is an attribute in the service tag */ for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("servicefactory")) { // && boolean isServiceFactory = parseBoolean(parser, i); if (isServiceFactory && (compConf.isImmediate() || compConf.getFactory() != null)) { throw new IllegalXMLException( "Attribute servicefactory in service-tag " + "cannot be set to \"true\" when component " + "is either an immediate component or " + "a factory component."); } compConf.setServiceFactory(isServiceFactory); } else { throw new IllegalXMLException("Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in service-tag"); } } int event = parser.next(); while (event != XmlPullParser.END_TAG) { if (event != XmlPullParser.START_TAG) { event = parser.next(); continue; } if (isInSCRNamespace(parser, "provide", 3)) { String interfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("interface")) { interfaceName = parser.getAttributeValue(i); interfaceFound = true; } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in provide-tag"); } } if (interfaceName == null) missingAttr(parser, "interface"); compConf.addService(interfaceName); skip(parser); } else if (isInSCRNamespace(parser, "duplex-reference", 3)) { if (compConf.isServiceFactory() || compConf.isImmediate() || compConf.getFactory() != null) { throw new IllegalXMLException( "Element duplex-reference cannot be set when component " + "is an immediate, a servicefactory or " + "a factory component."); } setDuplexReference(compConf, parser, declaringBundle); } else if (isInSCRNamespace(parser, "virtual_provide", 3)) { String virtualInterfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { virtualInterfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in virtual_provide-tag"); } } if (virtualInterfaceName == null) missingAttr(parser, "name"); compConf.addVirtuallService(virtualInterfaceName); skip(parser); } else { skip(parser); } event = parser.getEventType(); } /* check if required attributes has been set */ if (!interfaceFound) { throw new IllegalXMLException( "Service-tag did not contain a proper \"provides\"-tag."); } }
| 1,115,826
|
private static void setService(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { boolean interfaceFound = false; /* If there is an attribute in the service tag */ for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("servicefactory")) { // && boolean isServiceFactory = parseBoolean(parser, i); if (isServiceFactory && (compConf.isImmediate() || compConf.getFactory() != null)) { throw new IllegalXMLException( "Attribute servicefactory in service-tag " + "cannot be set to \"true\" when component " + "is either an immediate component or " + "a factory component."); } compConf.setServiceFactory(isServiceFactory); } else { throw new IllegalXMLException("Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in service-tag"); } } int event = parser.next(); while (event != XmlPullParser.END_TAG) { if (event != XmlPullParser.START_TAG) { event = parser.next(); continue; } if (isInSCRNamespace(parser, "provide", 3)) { String interfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("interface")) { interfaceName = parser.getAttributeValue(i); interfaceFound = true; } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in provide-tag"); } } if (interfaceName == null) missingAttr(parser, "interface"); compConf.addService(interfaceName); skip(parser); } else if (isInSCRNamespace(parser, "duplex-reference", 3)) { handleDuplexReference(compConf, parser, declaringBundle); } else if (isInSCRNamespace(parser, "virtual_provide", 3)) { String virtualInterfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { virtualInterfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in virtual_provide-tag"); } } if (virtualInterfaceName == null) missingAttr(parser, "name"); compConf.addVirtuallService(virtualInterfaceName); skip(parser); } else { skip(parser); } event = parser.getEventType(); } /* check if required attributes has been set */ if (!interfaceFound) { throw new IllegalXMLException( "Service-tag did not contain a proper \"provides\"-tag."); } }
|
private static void setService(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { boolean interfaceFound = false; /* If there is an attribute in the service tag */ for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("servicefactory")) { // && boolean isServiceFactory = parseBoolean(parser, i); if (isServiceFactory && (compConf.isImmediate() || compConf.getFactory() != null)) { throw new IllegalXMLException( "Attribute servicefactory in service-tag " + "cannot be set to \"true\" when component " + "is either an immediate component or " + "a factory component."); } compConf.setServiceFactory(isServiceFactory); } else { throw new IllegalXMLException("Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in service-tag"); } } int event = parser.next(); while (event != XmlPullParser.END_TAG) { if (event != XmlPullParser.START_TAG) { event = parser.next(); continue; } if (isInSCRNamespace(parser, "provide", 3)) { String interfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("interface")) { interfaceName = parser.getAttributeValue(i); interfaceFound = true; } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in provide-tag"); } } if (interfaceName == null) missingAttr(parser, "interface"); compConf.addService(interfaceName); skip(parser); } else if (isInSCRNamespace(parser, "duplex-reference", 3)) { handleDuplexReference(compConf, parser, declaringBundle); } else if (isInSCRNamespace(parser, "virtual_provide", 3)) { String virtualInterfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { virtualInterfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in virtual_provide-tag"); } } if (virtualInterfaceName == null) missingAttr(parser, "name"); compConf.addVirtualService(virtualInterfaceName); skip(parser); } else { skip(parser); } event = parser.getEventType(); } /* check if required attributes has been set */ if (!interfaceFound) { throw new IllegalXMLException( "Service-tag did not contain a proper \"provides\"-tag."); } }
| 1,115,827
|
private void displayDilution(){ postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); diluteWithText.setValue(new Double(myRecipe.dilution.getAddVol())); totalVolumeSpinner.setValue(new Double(myRecipe.dilution.getDilVol())); ibuDilutedSpin.setValue(new Double(myRecipe.dilution.getDilIbu())); colourDilutedLabel.setText(SBStringUtils.format(myRecipe.dilution.getDilSrm(), 0)); abvDilutedLabel.setText(SBStringUtils.format(myRecipe.dilution.getDilAlc(), 1)); ogDilutedSpin.setValue(new Double(myRecipe.dilution.getDilOG())); // recipe values: ibuRecipeLabel.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); colourRecipeLabel.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); abvRecipeLabel.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); ogRecipeLabel.setText(SBStringUtils.format(myRecipe.getEstOg(), 3)); // style values Style s = myRecipe.getStyleObj(); ogLowLabel.setText(SBStringUtils.format(s.getOgLow(), 3)); ogHighLabel.setText(SBStringUtils.format(s.getOgHigh(), 3)); abvLowLabel.setText(SBStringUtils.format(s.getAlcLow(), 1)); abvHighLabel.setText(SBStringUtils.format(s.getAlcHigh(), 1)); colourLowLabel.setText(SBStringUtils.format(s.getSrmLow(), 1)); colourHighLabel.setText(SBStringUtils.format(s.getSrmHigh(), 1)); ibuLowLabel.setText(SBStringUtils.format(s.getIbuLow(), 1)); ibuHighLabel.setText(SBStringUtils.format(s.getIbuHigh(), 1)); }
|
public void displayDilution(){ postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); diluteWithText.setValue(new Double(myRecipe.dilution.getAddVol())); totalVolumeSpinner.setValue(new Double(myRecipe.dilution.getDilVol())); ibuDilutedSpin.setValue(new Double(myRecipe.dilution.getDilIbu())); colourDilutedLabel.setText(SBStringUtils.format(myRecipe.dilution.getDilSrm(), 0)); abvDilutedLabel.setText(SBStringUtils.format(myRecipe.dilution.getDilAlc(), 1)); ogDilutedSpin.setValue(new Double(myRecipe.dilution.getDilOG())); // recipe values: ibuRecipeLabel.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); colourRecipeLabel.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); abvRecipeLabel.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); ogRecipeLabel.setText(SBStringUtils.format(myRecipe.getEstOg(), 3)); // style values Style s = myRecipe.getStyleObj(); ogLowLabel.setText(SBStringUtils.format(s.getOgLow(), 3)); ogHighLabel.setText(SBStringUtils.format(s.getOgHigh(), 3)); abvLowLabel.setText(SBStringUtils.format(s.getAlcLow(), 1)); abvHighLabel.setText(SBStringUtils.format(s.getAlcHigh(), 1)); colourLowLabel.setText(SBStringUtils.format(s.getSrmLow(), 1)); colourHighLabel.setText(SBStringUtils.format(s.getSrmHigh(), 1)); ibuLowLabel.setText(SBStringUtils.format(s.getIbuLow(), 1)); ibuHighLabel.setText(SBStringUtils.format(s.getIbuHigh(), 1)); }
| 1,115,829
|
public Object log(Object param) throws ParseException { if (param instanceof Number) { double num = ((Number) param).doubleValue(); if( num > 0) return new Double(Math.log(num)/LOG10); else { Complex temp = new Complex(num); return temp.log().div(CLOG10); } } else if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); } throw new ParseException("Invalid parameter type"); }
|
public Object log(Object param) throws ParseException { if (param instanceof Number) { double num = ((Number) param).doubleValue(); if( num > 0) return new Double(Math.log(num)/LOG10); else { Complex temp = new Complex(num); return temp.log().div(CLOG10); } } else if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); } throw new ParseException("Invalid parameter type"); }
| 1,115,830
|
public Object log(Object param) throws ParseException { if (param instanceof Number) { double num = ((Number) param).doubleValue(); if( num > 0) return new Double(Math.log(num)/LOG10); else { Complex temp = new Complex(num); return temp.log().div(CLOG10); } } else if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); } throw new ParseException("Invalid parameter type"); }
|
public Object log(Object param) throws ParseException { if (param instanceof Number) { double num = ((Number) param).doubleValue(); if( num > 0) return new Double(Math.log(num)/LOG10); else { Complex temp = new Complex(num); return temp.log().div(CLOG10); } } else if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); } throw new ParseException("Invalid parameter type"); }
| 1,115,831
|
public void addFile(String file, String revision) { m_files.addElement(new RCSFile(file, revision)); }
|
public void addFile(String file, String revision) { m_files.addElement(new RCSFile(file, revision)); }
| 1,115,832
|
public void testsendPasswordConfirmation() throws MessagingException { PasswordConfirmationMailForm mailForm = new PasswordConfirmationMailForm(); Operator operator = new Operator(); mailForm.setOperator(operator); List<Server> serverList = new ArrayList<Server>(); // Server transportServer = OperatorTestSupport.createServer();// Server accessServer = OperatorTestSupport.createServer(operator); ConfigurableMailSender sender = new ConfigurableMailSenderImpl(); expect(operatorDao.findServerActive(mailForm.getOperator())).andReturn(serverList); replay(operatorDao); expect(configurableMailSenderFactory.create(serverList)).andReturn(sender); replay(operatorDao); serverMgr.sendPasswordConfirmation(mailForm); }
|
public void testsendPasswordConfirmation() throws MessagingException { PasswordConfirmationMailForm mailForm = new PasswordConfirmationMailForm(); Operator operator = new Operator(); mailForm.setOperator(operator); List<Server> serverList = new ArrayList<Server>(); // Server transportServer = OperatorTestSupport.createServer();// Server accessServer = OperatorTestSupport.createServer(operator); expect(operatorDao.findServerActive(mailForm.getOperator())).andReturn(serverList); replay(operatorDao); expect(configurableMailSenderFactory.create(serverList)).andReturn(sender); replay(operatorDao); serverMgr.sendPasswordConfirmation(mailForm); }
| 1,115,835
|
public void testsendPasswordConfirmation() throws MessagingException { PasswordConfirmationMailForm mailForm = new PasswordConfirmationMailForm(); Operator operator = new Operator(); mailForm.setOperator(operator); List<Server> serverList = new ArrayList<Server>(); // Server transportServer = OperatorTestSupport.createServer();// Server accessServer = OperatorTestSupport.createServer(operator); ConfigurableMailSender sender = new ConfigurableMailSenderImpl(); expect(operatorDao.findServerActive(mailForm.getOperator())).andReturn(serverList); replay(operatorDao); expect(configurableMailSenderFactory.create(serverList)).andReturn(sender); replay(operatorDao); serverMgr.sendPasswordConfirmation(mailForm); }
|
public void testsendPasswordConfirmation() throws MessagingException { PasswordConfirmationMailForm mailForm = new PasswordConfirmationMailForm(); Operator operator = new Operator(); mailForm.setOperator(operator); List<Server> serverList = new ArrayList<Server>(); // Server transportServer = OperatorTestSupport.createServer();// Server accessServer = OperatorTestSupport.createServer(operator); ConfigurableMailSender sender = new ConfigurableMailSenderImpl(); expect(operatorDao.findServerActive(mailForm.getOperator())).andReturn(serverList); replay(configurableMailSenderFactory); expect(mailMessageComposer.composeMessage("PASSWORD", mailForm)).andReturn(decoratedPreparator); replay(mailMessageComposer); sender.send(decoratedPreparator); replay(sender); expect(configurableMailSenderFactory.create(serverList)).andReturn(sender); replay(configurableMailSenderFactory); expect(mailMessageComposer.composeMessage("PASSWORD", mailForm)).andReturn(decoratedPreparator); replay(mailMessageComposer); sender.send(decoratedPreparator); replay(sender); serverMgr.sendPasswordConfirmation(mailForm); }
| 1,115,836
|
public Operator createLocalDefaultOperator() { Operator operator = OperatorCreator.operatorFactory("DEFAULT", OperationMode.LOCAL, Locale.getDefault()); Entity entity = OperatorCreator.entityFactory(operator, "DEFAULT"); Identity identity = AuthenticationCreator.identityFactory("manager", "Manager account"); User user = AuthorizationCreator.userFactory(entity, identity); return operator; }
|
public Operator createLocalDefaultOperator() { Operator operator = OperatorCreator.operatorFactory("DEFAULT", OperationMode.LOCAL, Locale.getDefault()); Entity entity = OperatorCreator.entityFactory(operator, "DEFAULT"); Identity identity = AuthenticationCreator.identityFactory("manager", "Manager account"); User user = AuthorizationCreator.userFactory(entity, identity); return operator; }
| 1,115,837
|
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == ratioText) { double d = Double.parseDouble(ratioText.getText()); myRecipe.mash.setMashRatio(d); } else if (o == volUnitsCombo) { String s = (String) volUnitsComboModel.getSelectedItem(); myRecipe.mash.setMashVolUnits(s); } else if (o == ratioUnitsCombo) { String s = (String) ratioUnitsCombo.getSelectedItem(); myRecipe.mash.setMashRatioU(s); } else if (o == tempFrb) { myRecipe.mash.setMashTempUnits("F"); myRecipe.mash.calcMashSchedule(); } else if (o == tempCrb) { myRecipe.mash.setMashTempUnits("C"); myRecipe.mash.calcMashSchedule(); } else if (o == grainTempText) { String s = grainTempText.getText(); myRecipe.mash.setGrainTemp(Double.parseDouble(s)); } else if (o == boilTempTxt) { String s = boilTempTxt.getText(); myRecipe.mash.setBoilTempF(Double.parseDouble(s)); } else if (o == tunLossTxt) { String s = tunLossTxt.getText(); myRecipe.mash.setTunLossF(Double.parseDouble(s)); } tblMash.updateUI(); displayMash(); }
|
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == ratioText) { double d = Double.parseDouble(ratioText.getText()); myRecipe.mash.setMashRatio(d); } else if (o == volUnitsCombo) { String s = (String) volUnitsComboModel.getSelectedItem(); myRecipe.mash.setMashVolUnits(s); } else if (o == ratioUnitsCombo) { String s = (String) ratioUnitsCombo.getSelectedItem(); myRecipe.mash.setMashRatioU(s); } else if (o == tempFrb) { myRecipe.mash.setMashTempUnits("F"); myRecipe.mash.calcMashSchedule(); } else if (o == tempCrb) { myRecipe.mash.setMashTempUnits("C"); myRecipe.mash.calcMashSchedule(); } else if (o == grainTempText) { String s = grainTempText.getText(); myRecipe.mash.setGrainTemp(Double.parseDouble(s)); } else if (o == boilTempTxt) { String s = boilTempTxt.getText(); myRecipe.mash.setBoilTemp(Double.parseDouble(s)); } else if (o == tunLossTxt) { String s = tunLossTxt.getText(); myRecipe.mash.setTunLossF(Double.parseDouble(s)); } tblMash.updateUI(); displayMash(); }
| 1,115,838
|
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == ratioText) { double d = Double.parseDouble(ratioText.getText()); myRecipe.mash.setMashRatio(d); } else if (o == volUnitsCombo) { String s = (String) volUnitsComboModel.getSelectedItem(); myRecipe.mash.setMashVolUnits(s); } else if (o == ratioUnitsCombo) { String s = (String) ratioUnitsCombo.getSelectedItem(); myRecipe.mash.setMashRatioU(s); } else if (o == tempFrb) { myRecipe.mash.setMashTempUnits("F"); myRecipe.mash.calcMashSchedule(); } else if (o == tempCrb) { myRecipe.mash.setMashTempUnits("C"); myRecipe.mash.calcMashSchedule(); } else if (o == grainTempText) { String s = grainTempText.getText(); myRecipe.mash.setGrainTemp(Double.parseDouble(s)); } else if (o == boilTempTxt) { String s = boilTempTxt.getText(); myRecipe.mash.setBoilTempF(Double.parseDouble(s)); } else if (o == tunLossTxt) { String s = tunLossTxt.getText(); myRecipe.mash.setTunLossF(Double.parseDouble(s)); } tblMash.updateUI(); displayMash(); }
|
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == ratioText) { double d = Double.parseDouble(ratioText.getText()); myRecipe.mash.setMashRatio(d); } else if (o == volUnitsCombo) { String s = (String) volUnitsComboModel.getSelectedItem(); myRecipe.mash.setMashVolUnits(s); } else if (o == ratioUnitsCombo) { String s = (String) ratioUnitsCombo.getSelectedItem(); myRecipe.mash.setMashRatioU(s); } else if (o == tempFrb) { myRecipe.mash.setMashTempUnits("F"); myRecipe.mash.calcMashSchedule(); } else if (o == tempCrb) { myRecipe.mash.setMashTempUnits("C"); myRecipe.mash.calcMashSchedule(); } else if (o == grainTempText) { String s = grainTempText.getText(); myRecipe.mash.setGrainTemp(Double.parseDouble(s)); } else if (o == boilTempTxt) { String s = boilTempTxt.getText(); myRecipe.mash.setBoilTempF(Double.parseDouble(s)); } else if (o == tunLossTxt) { String s = tunLossTxt.getText(); myRecipe.mash.setTunLoss(Double.parseDouble(s)); } tblMash.updateUI(); displayMash(); }
| 1,115,839
|
public void displayMash() { if (myRecipe != null) { recipeNameLabel.setText(myRecipe.getName()); volUnitsComboModel.addOrInsert(myRecipe.mash.getMashVolUnits()); // temp units: if (myRecipe.mash.getMashTempUnits().equals("F")) tempFrb.setSelected(true); else tempCrb.setSelected(true); grainTempULabel.setText(myRecipe.mash.getMashTempUnits()); tempLostULabel.setText(myRecipe.mash.getMashTempUnits()); // set totals: String mashWeightTotal = SBStringUtils.format(myRecipe.getTotalMash(), 1) + " " + myRecipe.getMaltUnits(); totalMashLabel.setText(mashWeightTotal); totalTimeLabel.setText(new Integer(myRecipe.mash.getMashTotalTime()).toString()); volLabel.setText(myRecipe.mash.getMashTotalVol()); grainTempText.setText(new Double(myRecipe.mash.getGrainTemp()).toString()); boilTempTxt.setText(new Double(myRecipe.mash.getBoilTempF()).toString()); tunLossTxt.setText(new Double(myRecipe.mash.getTunLossF()).toString()); tempFrb.setSelected(myRecipe.mash.getMashTempUnits().equalsIgnoreCase("F")); } }
|
public void displayMash() { if (myRecipe != null) { recipeNameLabel.setText(myRecipe.getName()); volUnitsComboModel.addOrInsert(myRecipe.mash.getMashVolUnits()); // temp units: if (myRecipe.mash.getMashTempUnits().equals("F")) tempFrb.setSelected(true); else tempCrb.setSelected(true); grainTempULabel.setText(myRecipe.mash.getMashTempUnits()); tempLostULabel.setText(myRecipe.mash.getMashTempUnits()); // set totals: String mashWeightTotal = SBStringUtils.format(myRecipe.getTotalMash(), 1) + " " + myRecipe.getMaltUnits(); totalMashLabel.setText(mashWeightTotal); totalTimeLabel.setText(new Integer(myRecipe.mash.getMashTotalTime()).toString()); volLabel.setText(myRecipe.mash.getMashTotalVol()); grainTempText.setText(new Double(myRecipe.mash.getGrainTemp()).toString()); boilTempTxt.setText(new Double(myRecipe.mash.getBoilTempF()).toString()); tunLossTxt.setText(new Double(myRecipe.mash.getTunLossF()).toString()); tempFrb.setSelected(myRecipe.mash.getMashTempUnits().equalsIgnoreCase("F")); } }
| 1,115,840
|
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, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(158, 230)); { 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, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(158, 230)); { 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,115,841
|
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, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(158, 230)); { 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, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(158, 230)); { 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)); boilTempULbl.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,115,842
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); }
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); }
| 1,115,843
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); }
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters for(int i=1;i < curNumberOfParameters;++i) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); }
| 1,115,844
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); }
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); }
| 1,115,845
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); }
|
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(result); }
| 1,115,846
|
public UnitRangeImpl getAmpRange(){ return ampConfig.getAmpRange(); }
|
public UnitRangeImpl getAmpRange(LocalSeismogram seis){ return ampConfig.getAmpRange(seis); }
| 1,115,847
|
private void layoutUi() { JPanel buttons = new JPanel(); okButton = new JButton("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttons.add(cancelButton); buttons.add(okButton); getContentPane().setLayout(new BorderLayout()); this.setFocusTraversalKeysEnabled(false); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { pnlCalculations = new JPanel(); jTabbedPane1.addTab("Calculations", null, pnlCalculations, null); { try { { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; thisLayout.rowHeights = new int[]{7, 7, 7, 7}; thisLayout.columnWeights = new double[]{0.1, 0.2}; thisLayout.columnWidths = new int[]{7, 7}; pnlCalculations.setLayout(thisLayout); pnlCalculations.setPreferredSize(new java.awt.Dimension(524, 372)); { { bgHopsCalc = new ButtonGroup(); { pnlHops = new JPanel(); GridLayout pnlHopsLayout = new GridLayout(2, 2); pnlHopsLayout.setColumns(2); pnlHopsLayout.setHgap(5); pnlHopsLayout.setVgap(5); pnlHopsLayout.setRows(2); pnlHops.setLayout(pnlHopsLayout); pnlCalculations.add(pnlHops, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHops .setBorder(BorderFactory .createTitledBorder("Hops:")); { jLabelc1 = new JLabel(); pnlHops.add(jLabelc1); jLabelc1.setText("Pellet Hops +%"); } { txtPellet = new JTextField(); pnlHops.add(txtPellet); txtPellet.setPreferredSize(new java.awt.Dimension(20, 20)); } { jLabelc2 = new JLabel(); pnlHops.add(jLabelc2); jLabelc2.setText("Tinseth Utilization Factor"); } { txtTinsethUtil = new JTextField(); pnlHops.add(txtTinsethUtil); txtTinsethUtil.setText("4.15"); } } { pnlAlc = new JPanel(); BoxLayout pnlAlcLayout = new BoxLayout(pnlAlc, javax.swing.BoxLayout.Y_AXIS); pnlAlc.setLayout(pnlAlcLayout); pnlCalculations.add(pnlAlc, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlAlc.setBorder(BorderFactory .createTitledBorder("Alcohol By:")); { rbABV = new JRadioButton(); pnlAlc.add(rbABV); bgAlc.add(rbABV); rbABV.setText("Volume"); } { rbABW = new JRadioButton(); pnlAlc.add(rbABW); bgAlc.add(rbABW); rbABW.setText("Weight"); } } { pnlHopTimes = new JPanel(); GridLayout pnlHopTimesLayout = new GridLayout(3, 2); pnlHopTimesLayout.setColumns(2); pnlHopTimesLayout.setHgap(5); pnlHopTimesLayout.setVgap(5); pnlHopTimesLayout.setRows(3); pnlHopTimes.setLayout(pnlHopTimesLayout); pnlCalculations.add(pnlHopTimes, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHopTimes.setBorder(BorderFactory .createTitledBorder("Hop Times:")); { jLabelc3 = new JLabel(); pnlHopTimes.add(jLabelc3); jLabelc3.setText("Dry (min):"); } { txtDryHopTime = new JTextField(); pnlHopTimes.add(txtDryHopTime); txtDryHopTime.setText("0.0"); } { jLabelc4 = new JLabel(); pnlHopTimes.add(jLabelc4); jLabelc4.setText("FWH, boil minus (min):"); } { txtFWHTime = new JTextField(); pnlHopTimes.add(txtFWHTime); txtFWHTime.setText("20.0"); } { jLabelc5 = new JLabel(); pnlHopTimes.add(jLabelc5); jLabelc5.setText("Mash Hop (min):"); } { txtMashHopTime = new JTextField(); pnlHopTimes.add(txtMashHopTime); txtMashHopTime.setText("2.0"); } } } pnlHopsCalc = new JPanel(); BoxLayout pnlHopsCalcLayout = new BoxLayout(pnlHopsCalc, javax.swing.BoxLayout.Y_AXIS); pnlHopsCalc.setLayout(pnlHopsCalcLayout); pnlCalculations.add(pnlHopsCalc, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlWaterUsage(), new GridBagConstraints(1, 2, 1, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlColourOptions(), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlEvaporation(), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHopsCalc.setPreferredSize(new java.awt.Dimension(117, 107)); pnlHopsCalc.setBorder(BorderFactory .createTitledBorder("IBU Calc Method:")); { rbTinseth = new JRadioButton(); pnlHopsCalc.add(rbTinseth); rbTinseth.setText("Tinseth"); bgHopsCalc.add(rbTinseth); } { rbRager = new JRadioButton(); pnlHopsCalc.add(rbRager); rbRager.setText("Rager"); bgHopsCalc.add(rbRager); } { rbGaretz = new JRadioButton(); pnlHopsCalc.add(rbGaretz); rbGaretz.setText("Garetz"); bgHopsCalc.add(rbGaretz); } } } } catch (Exception e) { e.printStackTrace(); } } } { costCarbPanel = new JPanel(); BorderLayout costCarbPanelLayout = new BorderLayout(); costCarbPanel.setLayout(costCarbPanelLayout); jTabbedPane1.addTab("Cost & Carb", null, costCarbPanel, null); { carbPanel = new JPanel(); costCarbPanel.add(carbPanel, BorderLayout.CENTER); carbPanel.setBorder(BorderFactory.createTitledBorder(null, "Carbonation", TitledBorder.LEADING, TitledBorder.TOP)); { jLabel3 = new JLabel(); carbPanel.add(jLabel3); jLabel3.setText("Not implemented"); } } { jPanel2 = new JPanel(); costCarbPanel.add(jPanel2, BorderLayout.NORTH); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.rowWeights = new double[]{0.1, 0.1, 0.4}; jPanel2Layout.rowHeights = new int[]{7, 7, 7}; jPanel2Layout.columnWeights = new double[]{0.1, 0.1, 0.1}; jPanel2Layout.columnWidths = new int[]{7, 7, 7}; jPanel2.setPreferredSize(new java.awt.Dimension(232, 176)); jPanel2.setBorder(BorderFactory.createTitledBorder("Cost")); jPanel2.setLayout(jPanel2Layout); { jLabel1 = new JLabel(); jPanel2.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); jLabel1.setText("Other Cost:"); } { txtOtherCost = new JTextField(); jPanel2.add(txtOtherCost, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); txtOtherCost.setText("$0.00"); } { jLabel2 = new JLabel(); jPanel2.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); jLabel2.setText("Bottle Size:"); } { cmbBottleSize = new JComboBox(); cmbBottleSizeModel = new ComboModel(); cmbBottleSizeModel.setList(new Quantity().getListofUnits("vol")); cmbBottleSize.setModel(cmbBottleSizeModel); jPanel2.add(cmbBottleSize, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jPanel2.add(getTxtBottleSize(), new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } } { } } { pnlBrewer = new JPanel(); GridBagLayout pnlBrewerLayout = new GridBagLayout(); pnlBrewerLayout.rowWeights = new double[]{0.1, 0.1, 0.3, 0.3}; pnlBrewerLayout.rowHeights = new int[]{2, 2, 7, 7}; pnlBrewerLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1}; pnlBrewerLayout.columnWidths = new int[]{7, 7, 7, 7}; pnlBrewer.setLayout(pnlBrewerLayout); jTabbedPane1.addTab("Brewer", null, pnlBrewer, null); { jLabel4 = new JLabel(); pnlBrewer.add(jLabel4, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Name:"); } { txtBrewerName = new JTextField(); pnlBrewer.add(txtBrewerName, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtBrewerName.setText("Your Name"); } { jLabel5 = new JLabel(); pnlBrewer.add(jLabel5, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("Phone:"); } { txtPhone = new JTextField(); pnlBrewer.add(txtPhone, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtPhone.setText("Your Phone"); } { jLabel6 = new JLabel(); pnlBrewer.add(jLabel6, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Club Name:"); } { txtClubName = new JTextField(); pnlBrewer.add(txtClubName, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtClubName.setText("Club Name"); } { jLabel7 = new JLabel(); pnlBrewer.add(jLabel7, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Email:"); } { txtEmail = new JTextField(); pnlBrewer.add(txtEmail, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtEmail.setText("Email"); } } { pnlDatabase = new JPanel(); BorderLayout pnlDatabaseLayout = new BorderLayout(); pnlDatabase.setLayout(pnlDatabaseLayout); pnlDatabase.add(getPnlDefaultDB(), BorderLayout.NORTH); pnlDatabase.add(getPnlSortOrder(), BorderLayout.WEST); jTabbedPane1.addTab("Database", null, pnlDatabase, null); pnlDatabase.setVisible(false); } newRecipePanel = new JPanel(); GridBagLayout newRecipePanelLayout = new GridBagLayout(); newRecipePanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; newRecipePanelLayout.rowHeights = new int[]{7, 7, 7, 7}; newRecipePanelLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1}; newRecipePanelLayout.columnWidths = new int[]{7, 7, 7, 7}; newRecipePanel.setLayout(newRecipePanelLayout); jTabbedPane1.addTab("New Recipe Defaults", null, newRecipePanel, null); appearancePanel = new JPanel(); BorderLayout appearancePanelLayout = new BorderLayout(); appearancePanel.setLayout(appearancePanelLayout); jTabbedPane1.addTab("Appearance", null, appearancePanel, null); colourPanel = new JPanel(); appearancePanel.add(colourPanel, BorderLayout.CENTER); GridBagLayout colourPanelLayout = new GridBagLayout(); colourPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; colourPanelLayout.rowHeights = new int[]{7, 7, 7, 7}; colourPanelLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; colourPanelLayout.columnWidths = new int[]{7, 7, 7, 7, 7, 7}; colourPanel.setLayout(colourPanelLayout); colourPanel.setPreferredSize(new java.awt.Dimension(340, 223)); colourPanel.setBorder(BorderFactory.createTitledBorder("Colour Swatch")); landfPanel = new JPanel(); appearancePanel.add(landfPanel, BorderLayout.NORTH); jLabel19 = new JLabel(); landfPanel.add(jLabel19); jLabel19.setText("Look and Feel:"); landfCombo = new JComboBox(looks.toArray()); landfPanel.add(landfCombo); colMethod1rb = new JRadioButton(); colMethod1rb.addActionListener(this); colourGroup.add(colMethod1rb); colourPanel.add(colMethod1rb, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colMethod1rb.setText("Colour Method 1"); colMethod2rb = new JRadioButton(); colMethod2rb.addActionListener(this); colourGroup.add(colMethod2rb); colourPanel.add(colMethod2rb, new GridBagConstraints(3, 0, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colMethod2rb.setText("Colour Method 2"); jLabel13 = new JLabel(); colourPanel.add(jLabel13, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel13.setText("Straw \n(2)"); jLabel14 = new JLabel(); colourPanel.add(jLabel14, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("Pale\n(4)"); jLabel15 = new JLabel(); colourPanel.add(jLabel15, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel15.setText("Amber\n(8)"); jLabel16 = new JLabel(); colourPanel.add(jLabel16, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel16.setText("Copper (15)"); jLabel17 = new JLabel(); colourPanel.add(jLabel17, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel17.setText("Brown (20)"); jLabel18 = new JLabel(); colourPanel.add(jLabel18, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel18.setText("Black (30)"); stawPanel = new JPanel(); colourPanel.add(stawPanel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); stawPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); palePanel = new JPanel(); colourPanel.add(palePanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); palePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); amberPanel = new JPanel(); colourPanel.add(amberPanel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); amberPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); copperPanel = new JPanel(); colourPanel.add(copperPanel, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); copperPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); brownPanel = new JPanel(); colourPanel.add(brownPanel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); brownPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); blackPanel = new JPanel(); colourPanel.add(blackPanel, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); blackPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); mashPanel = new JPanel(); newRecipePanel.add(mashPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mashPanel.setBorder(BorderFactory.createTitledBorder("Mash")); jLabel12 = new JLabel(); mashPanel.add(jLabel12); jLabel12.setText("Boil Temp (F):"); boilTempTxt = new JTextField(); mashPanel.add(boilTempTxt); boilTempTxt.setText("212"); } getContentPane().add(BorderLayout.CENTER, jTabbedPane1); getContentPane().add(BorderLayout.SOUTH, buttons); setSize(400, 400); }
|
private void layoutUi() { JPanel buttons = new JPanel(); okButton = new JButton("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttons.add(cancelButton); buttons.add(okButton); getContentPane().setLayout(new BorderLayout()); this.setFocusTraversalKeysEnabled(false); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { pnlCalculations = new JPanel(); jTabbedPane1.addTab("Calculations", null, pnlCalculations, null); { try { { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; thisLayout.rowHeights = new int[]{7, 7, 7, 7}; thisLayout.columnWeights = new double[]{0.1, 0.2}; thisLayout.columnWidths = new int[]{7, 7}; pnlCalculations.setLayout(thisLayout); pnlCalculations.setPreferredSize(new java.awt.Dimension(524, 372)); { { bgHopsCalc = new ButtonGroup(); { pnlHops = new JPanel(); GridLayout pnlHopsLayout = new GridLayout(2, 2); pnlHopsLayout.setColumns(2); pnlHopsLayout.setHgap(5); pnlHopsLayout.setVgap(5); pnlHopsLayout.setRows(2); pnlHops.setLayout(pnlHopsLayout); pnlCalculations.add(pnlHops, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHops .setBorder(BorderFactory .createTitledBorder("Hops:")); { jLabelc1 = new JLabel(); pnlHops.add(jLabelc1); jLabelc1.setText("Pellet Hops +%"); } { txtPellet = new JTextField(); pnlHops.add(txtPellet); txtPellet.setPreferredSize(new java.awt.Dimension(20, 20)); } { jLabelc2 = new JLabel(); pnlHops.add(jLabelc2); jLabelc2.setText("Tinseth Utilization Factor"); } { txtTinsethUtil = new JTextField(); pnlHops.add(txtTinsethUtil); txtTinsethUtil.setText("4.15"); } } { pnlAlc = new JPanel(); BoxLayout pnlAlcLayout = new BoxLayout(pnlAlc, javax.swing.BoxLayout.Y_AXIS); pnlAlc.setLayout(pnlAlcLayout); pnlCalculations.add(pnlAlc, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlAlc.setBorder(BorderFactory .createTitledBorder("Alcohol By:")); { rbABV = new JRadioButton(); pnlAlc.add(rbABV); bgAlc.add(rbABV); rbABV.setText("Volume"); } { rbABW = new JRadioButton(); pnlAlc.add(rbABW); bgAlc.add(rbABW); rbABW.setText("Weight"); } } { pnlHopTimes = new JPanel(); GridLayout pnlHopTimesLayout = new GridLayout(3, 2); pnlHopTimesLayout.setColumns(2); pnlHopTimesLayout.setHgap(5); pnlHopTimesLayout.setVgap(5); pnlHopTimesLayout.setRows(3); pnlHopTimes.setLayout(pnlHopTimesLayout); pnlCalculations.add(pnlHopTimes, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHopTimes.setBorder(BorderFactory .createTitledBorder("Hop Times:")); { jLabelc3 = new JLabel(); pnlHopTimes.add(jLabelc3); jLabelc3.setText("Dry (min):"); } { txtDryHopTime = new JTextField(); pnlHopTimes.add(txtDryHopTime); txtDryHopTime.setText("0.0"); } { jLabelc4 = new JLabel(); pnlHopTimes.add(jLabelc4); jLabelc4.setText("FWH, boil minus (min):"); } { txtFWHTime = new JTextField(); pnlHopTimes.add(txtFWHTime); txtFWHTime.setText("20.0"); } { jLabelc5 = new JLabel(); pnlHopTimes.add(jLabelc5); jLabelc5.setText("Mash Hop (min):"); } { txtMashHopTime = new JTextField(); pnlHopTimes.add(txtMashHopTime); txtMashHopTime.setText("2.0"); } } } pnlHopsCalc = new JPanel(); BoxLayout pnlHopsCalcLayout = new BoxLayout(pnlHopsCalc, javax.swing.BoxLayout.Y_AXIS); pnlHopsCalc.setLayout(pnlHopsCalcLayout); pnlCalculations.add(pnlHopsCalc, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlWaterUsage(), new GridBagConstraints(1, 2, 1, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlColourOptions(), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlEvaporation(), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHopsCalc.setPreferredSize(new java.awt.Dimension(117, 107)); pnlHopsCalc.setBorder(BorderFactory .createTitledBorder("IBU Calc Method:")); { rbTinseth = new JRadioButton(); pnlHopsCalc.add(rbTinseth); rbTinseth.setText("Tinseth"); bgHopsCalc.add(rbTinseth); } { rbRager = new JRadioButton(); pnlHopsCalc.add(rbRager); rbRager.setText("Rager"); bgHopsCalc.add(rbRager); } { rbGaretz = new JRadioButton(); pnlHopsCalc.add(rbGaretz); rbGaretz.setText("Garetz"); bgHopsCalc.add(rbGaretz); } } } } catch (Exception e) { e.printStackTrace(); } } } { costCarbPanel = new JPanel(); BorderLayout costCarbPanelLayout = new BorderLayout(); costCarbPanel.setLayout(costCarbPanelLayout); jTabbedPane1.addTab("Cost & Carb", null, costCarbPanel, null); { carbPanel = new JPanel(); costCarbPanel.add(carbPanel, BorderLayout.CENTER); carbPanel.setBorder(BorderFactory.createTitledBorder(null, "Carbonation", TitledBorder.LEADING, TitledBorder.TOP)); { jLabel3 = new JLabel(); carbPanel.add(jLabel3); jLabel3.setText("Not implemented"); } } { jPanel2 = new JPanel(); costCarbPanel.add(jPanel2, BorderLayout.NORTH); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.rowWeights = new double[]{0.1, 0.1, 0.4}; jPanel2Layout.rowHeights = new int[]{7, 7, 7}; jPanel2Layout.columnWeights = new double[]{0.1, 0.1, 0.1}; jPanel2Layout.columnWidths = new int[]{7, 7, 7}; jPanel2.setPreferredSize(new java.awt.Dimension(232, 176)); jPanel2.setBorder(BorderFactory.createTitledBorder("Cost")); jPanel2.setLayout(jPanel2Layout); { jLabel1 = new JLabel(); jPanel2.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); jLabel1.setText("Other Cost:"); } { txtOtherCost = new JTextField(); jPanel2.add(txtOtherCost, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); txtOtherCost.setText("$0.00"); } { jLabel2 = new JLabel(); jPanel2.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); jLabel2.setText("Bottle Size:"); } { cmbBottleSize = new JComboBox(); cmbBottleSizeModel = new ComboModel(); cmbBottleSizeModel.setList(new Quantity().getListofUnits("vol")); cmbBottleSize.setModel(cmbBottleSizeModel); jPanel2.add(cmbBottleSize, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jPanel2.add(getTxtBottleSize(), new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } } { } } { pnlBrewer = new JPanel(); GridBagLayout pnlBrewerLayout = new GridBagLayout(); pnlBrewerLayout.rowWeights = new double[]{0.1, 0.1, 0.3, 0.3}; pnlBrewerLayout.rowHeights = new int[]{2, 2, 7, 7}; pnlBrewerLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1}; pnlBrewerLayout.columnWidths = new int[]{7, 7, 7, 7}; pnlBrewer.setLayout(pnlBrewerLayout); jTabbedPane1.addTab("Brewer", null, pnlBrewer, null); { jLabel4 = new JLabel(); pnlBrewer.add(jLabel4, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Name:"); } { txtBrewerName = new JTextField(); pnlBrewer.add(txtBrewerName, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtBrewerName.setText("Your Name"); } { jLabel5 = new JLabel(); pnlBrewer.add(jLabel5, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("Phone:"); } { txtPhone = new JTextField(); pnlBrewer.add(txtPhone, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtPhone.setText("Your Phone"); } { jLabel6 = new JLabel(); pnlBrewer.add(jLabel6, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Club Name:"); } { txtClubName = new JTextField(); pnlBrewer.add(txtClubName, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtClubName.setText("Club Name"); } { jLabel7 = new JLabel(); pnlBrewer.add(jLabel7, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Email:"); } { txtEmail = new JTextField(); pnlBrewer.add(txtEmail, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtEmail.setText("Email"); } } { pnlDatabase = new JPanel(); BorderLayout pnlDatabaseLayout = new BorderLayout(); pnlDatabase.setLayout(pnlDatabaseLayout); pnlDatabase.add(getPnlDefaultDB(), BorderLayout.NORTH); pnlDatabase.add(getPnlSortOrder(), BorderLayout.WEST); jTabbedPane1.addTab("Database", null, pnlDatabase, null); pnlDatabase.setVisible(false); } newRecipePanel = new JPanel(); GridBagLayout newRecipePanelLayout = new GridBagLayout(); newRecipePanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; newRecipePanelLayout.rowHeights = new int[]{7, 7, 7, 7}; newRecipePanelLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1}; newRecipePanelLayout.columnWidths = new int[]{7, 7, 7, 7}; newRecipePanel.setLayout(newRecipePanelLayout); jTabbedPane1.addTab("New Recipe Defaults", null, newRecipePanel, null); appearancePanel = new JPanel(); BorderLayout appearancePanelLayout = new BorderLayout(); appearancePanel.setLayout(appearancePanelLayout); jTabbedPane1.addTab("Appearance", null, appearancePanel, null); colourPanel = new JPanel(); appearancePanel.add(colourPanel, BorderLayout.CENTER); GridBagLayout colourPanelLayout = new GridBagLayout(); colourPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; colourPanelLayout.rowHeights = new int[]{7, 7, 7, 7}; colourPanelLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; colourPanelLayout.columnWidths = new int[]{7, 7, 7, 7, 7, 7}; colourPanel.setLayout(colourPanelLayout); colourPanel.setPreferredSize(new java.awt.Dimension(340, 223)); colourPanel.setBorder(BorderFactory.createTitledBorder("Colour Swatch")); landfPanel = new JPanel(); appearancePanel.add(landfPanel, BorderLayout.NORTH); jLabel19 = new JLabel(); landfPanel.add(jLabel19); jLabel19.setText("Look and Feel:"); landfCombo = new JComboBox(looks.toArray()); landfPanel.add(landfCombo); colMethod1rb = new JRadioButton(); colMethod1rb.addActionListener(this); colourGroup.add(colMethod1rb); colourPanel.add(colMethod1rb, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colMethod1rb.setText("Colour Method 1"); colMethod2rb = new JRadioButton(); colMethod2rb.addActionListener(this); colourGroup.add(colMethod2rb); colourPanel.add(colMethod2rb, new GridBagConstraints(3, 0, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colMethod2rb.setText("Colour Method 2"); jLabel13 = new JLabel(); colourPanel.add(jLabel13, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel13.setText("Straw \n(2)"); jLabel14 = new JLabel(); colourPanel.add(jLabel14, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("Pale\n(4)"); jLabel15 = new JLabel(); colourPanel.add(jLabel15, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel15.setText("Amber\n(8)"); jLabel16 = new JLabel(); colourPanel.add(jLabel16, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel16.setText("Copper (15)"); jLabel17 = new JLabel(); colourPanel.add(jLabel17, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel17.setText("Brown (20)"); jLabel18 = new JLabel(); colourPanel.add(jLabel18, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel18.setText("Black (30)"); stawPanel = new JPanel(); colourPanel.add(stawPanel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); stawPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); palePanel = new JPanel(); colourPanel.add(palePanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); palePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); amberPanel = new JPanel(); colourPanel.add(amberPanel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); amberPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); copperPanel = new JPanel(); colourPanel.add(copperPanel, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); copperPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); brownPanel = new JPanel(); colourPanel.add(brownPanel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); brownPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); blackPanel = new JPanel(); colourPanel.add(blackPanel, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); blackPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); mashPanel = new JPanel(); newRecipePanel.add(mashPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mashPanel.setBorder(BorderFactory.createTitledBorder("Mash")); jLabel12 = new JLabel(); mashPanel.add(jLabel12); jLabel12.setText("Boil Temp (F):"); boilTempTxt = new JTextField(); mashPanel.add(boilTempTxt); boilTempTxt.setText("212"); } getContentPane().add(BorderLayout.CENTER, jTabbedPane1); getContentPane().add(BorderLayout.SOUTH, buttons); setSize(500, 500); }
| 1,115,848
|
public BigReals(int scale,int roundMode) { this.roundMode = roundMode; this.scale = scale; }
|
public BigReals(int scale,int roundMode) { this.roundMode = roundMode; this.scale = scale; }
| 1,115,850
|
public Number div(Number num1, Number num2) { BigDecimal a = (BigDecimal) num1; BigDecimal b = (BigDecimal) num2; if(scale>0) return a.divide(b,scale,roundMode); else return a.divide(b,roundMode); }
|
public Number div(Number num1, Number num2) { BigDecimal a = (BigDecimal) num1; BigDecimal b = (BigDecimal) num2; if(scale>0) return a.divide(b,scale,roundMode); else return a.divide(b,roundMode); }
| 1,115,851
|
public String toXML() { StringBuffer sb = new StringBuffer(); sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); sb.append("<STRANGEBREWRECIPE version = \"" + version + "\">\n"); sb.append("<!-- This is a SBJava export. StrangeBrew 1.8 will not import it. -->\n"); sb.append(" <DETAILS>\n"); sb.append(" <NAME>" + SBStringUtils.subEntities(name) + "</NAME>\n"); sb.append(" <BREWER>" + SBStringUtils.subEntities(brewer) + "</BREWER>\n"); sb.append(" <NOTES>" + SBStringUtils.subEntities(comments) + "</NOTES>\n"); sb.append(" <EFFICIENCY>" + efficiency + "</EFFICIENCY>\n"); sb.append(" <OG>" + SBStringUtils.format(estOg, 3) + "</OG>\n"); sb.append(" <FG>" + SBStringUtils.format(estFg, 3) + "</FG>\n"); sb.append(" <STYLE>" + style.getName() + "</STYLE>\n"); sb.append(" <MASH>" + mashed + "</MASH>\n"); sb.append(" <LOV>" + SBStringUtils.format(srm, 1) + "</LOV>\n"); sb.append(" <IBU>" + SBStringUtils.format(ibu, 1) + "</IBU>\n"); sb.append(" <ALC>" + SBStringUtils.format(alcohol, 1) + "</ALC>\n"); sb.append(" <BOIL_TIME>" + boilMinutes + "</BOIL_TIME>\n"); sb.append(" <PRESIZE>" + preBoilVol.getValue() + "</PRESIZE>\n"); sb.append(" <SIZE>" + postBoilVol.getValue() + "</SIZE>\n"); sb.append(" <SIZE_UNITS>" + postBoilVol.getUnits() + "</SIZE_UNITS>\n"); sb.append(" <MALT_UNITS>" + maltUnits + "</MALT_UNITS>\n"); sb.append(" <HOPS_UNITS>" + hopUnits + "</HOPS_UNITS>\n"); sb.append(" <YEAST>" + yeast.getName() + "</YEAST>\n"); SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); sb.append(" <RECIPE_DATE>" + df.format(created.getTime()) + "</RECIPE_DATE>\n"); sb.append(" <ATTENUATION>" + attenuation + "</ATTENUATION>\n"); sb.append(" <!-- SBJ1.0 Extensions: -->\n"); sb.append(" <ALC_METHOD>" + alcMethod + "</ALC_METHOD>\n"); sb.append(" <IBU_METHOD>" + ibuCalcMethod + "</IBU_METHOD>\n"); sb.append(" <COLOUR_METHOD>" + colourMethod + "</COLOUR_METHOD>\n"); sb.append(" <EVAP>" + evap + "</EVAP>\n"); sb.append(" <EVAP_METHOD>" + evapMethod + "</EVAP_METHOD>\n"); sb.append(" <KETTLE_LOSS>" + kettleLoss + "</KETTLE_LOSS>\n"); sb.append(" <TRUB_LOSS>" + trubLoss + "</TRUB_LOSS>\n"); sb.append(" <MISC_LOSS>" + miscLoss + "</MISC_LOSS>\n"); sb.append(" <PELLET_HOP_PCT>" + pelletHopPct + "</PELLET_HOP_PCT>\n"); sb.append(" <YEAST_COST>" + yeast.getCostPerU() + "</YEAST_COST>\n"); sb.append(" <OTHER_COST>" + otherCost + "</OTHER_COST>\n"); sb.append(" <!-- END SBJ1.0 Extensions -->\n"); sb.append(" </DETAILS>\n"); // fermentables list: sb.append(" <FERMENTABLES>\n"); for (int i = 0; i < fermentables.size(); i++) { Fermentable m = (Fermentable) fermentables.get(i); sb.append(m.toXML()); } sb.append(" </FERMENTABLES>\n"); // hops list: sb.append(" <HOPS>\n"); for (int i = 0; i < hops.size(); i++) { Hop h = (Hop) hops.get(i); sb.append(h.toXML()); } sb.append(" </HOPS>\n"); // misc ingredients list: sb.append(" <MISC>\n"); for (int i = 0; i < misc.size(); i++) { Misc mi = (Misc) misc.get(i); sb.append(mi.toXML()); } sb.append(" </MISC>\n"); sb.append(mash.toXml()); // notes list: sb.append(" <NOTES>\n"); for (int i = 0; i < notes.size(); i++) { sb.append(((Note) notes.get(i)).toXML()); } sb.append(" </NOTES>\n"); sb.append("</STRANGEBREWRECIPE>"); return sb.toString(); }
|
public String toXML() { StringBuffer sb = new StringBuffer(); sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); sb.append("<STRANGEBREWRECIPE version = \"" + version + "\">\n"); sb.append("<!-- This is a SBJava export. StrangeBrew 1.8 will not import it. -->\n"); sb.append(" <DETAILS>\n"); sb.append(" <NAME>" + SBStringUtils.subEntities(name) + "</NAME>\n"); sb.append(" <BREWER>" + SBStringUtils.subEntities(brewer) + "</BREWER>\n"); sb.append(" <NOTES>" + SBStringUtils.subEntities(comments) + "</NOTES>\n"); sb.append(" <EFFICIENCY>" + efficiency + "</EFFICIENCY>\n"); sb.append(" <OG>" + SBStringUtils.format(estOg, 3) + "</OG>\n"); sb.append(" <FG>" + SBStringUtils.format(estFg, 3) + "</FG>\n"); sb.append(" <STYLE>" + style.getName() + "</STYLE>\n"); sb.append(" <MASH>" + mashed + "</MASH>\n"); sb.append(" <LOV>" + SBStringUtils.format(srm, 1) + "</LOV>\n"); sb.append(" <IBU>" + SBStringUtils.format(ibu, 1) + "</IBU>\n"); sb.append(" <ALC>" + SBStringUtils.format(alcohol, 1) + "</ALC>\n"); sb.append(" <BOIL_TIME>" + boilMinutes + "</BOIL_TIME>\n"); sb.append(" <PRESIZE>" + preBoilVol.getValue() + "</PRESIZE>\n"); sb.append(" <SIZE>" + postBoilVol.getValue() + "</SIZE>\n"); sb.append(" <SIZE_UNITS>" + postBoilVol.getUnits() + "</SIZE_UNITS>\n"); sb.append(" <MALT_UNITS>" + maltUnits + "</MALT_UNITS>\n"); sb.append(" <HOPS_UNITS>" + hopUnits + "</HOPS_UNITS>\n"); sb.append(" <YEAST>" + yeast.getName() + "</YEAST>\n"); SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); sb.append(" <RECIPE_DATE>" + df.format(created.getTime()) + "</RECIPE_DATE>\n"); sb.append(" <ATTENUATION>" + attenuation + "</ATTENUATION>\n"); sb.append(" <!-- SBJ1.0 Extensions: -->\n"); sb.append(" <ALC_METHOD>" + alcMethod + "</ALC_METHOD>\n"); sb.append(" <IBU_METHOD>" + ibuCalcMethod + "</IBU_METHOD>\n"); sb.append(" <COLOUR_METHOD>" + colourMethod + "</COLOUR_METHOD>\n"); sb.append(" <EVAP>" + evap + "</EVAP>\n"); sb.append(" <EVAP_METHOD>" + evapMethod + "</EVAP_METHOD>\n"); sb.append(" <KETTLE_LOSS>" + kettleLoss + "</KETTLE_LOSS>\n"); sb.append(" <TRUB_LOSS>" + trubLoss + "</TRUB_LOSS>\n"); sb.append(" <MISC_LOSS>" + miscLoss + "</MISC_LOSS>\n"); sb.append(" <PELLET_HOP_PCT>" + pelletHopPct + "</PELLET_HOP_PCT>\n"); sb.append(" <YEAST_COST>" + yeast.getCostPerU() + "</YEAST_COST>\n"); sb.append(" <OTHER_COST>" + otherCost + "</OTHER_COST>\n"); sb.append(" <!-- END SBJ1.0 Extensions -->\n"); sb.append(" </DETAILS>\n"); // fermentables list: sb.append(" <FERMENTABLES>\n"); for (int i = 0; i < fermentables.size(); i++) { Fermentable m = (Fermentable) fermentables.get(i); sb.append(m.toXML()); } sb.append(" </FERMENTABLES>\n"); // hops list: sb.append(" <HOPS>\n"); for (int i = 0; i < hops.size(); i++) { Hop h = (Hop) hops.get(i); sb.append(h.toXML()); } sb.append(" </HOPS>\n"); // misc ingredients list: sb.append(" <MISC>\n"); for (int i = 0; i < misc.size(); i++) { Misc mi = (Misc) misc.get(i); sb.append(mi.toXML()); } sb.append(" </MISC>\n"); sb.append(mash.toXml()); // notes list: sb.append(" <NOTES>\n"); for (int i = 0; i < notes.size(); i++) { sb.append(((Note) notes.get(i)).toXML()); } sb.append(" </NOTES>\n"); sb.append("</STRANGEBREWRECIPE>"); return sb.toString(); }
| 1,115,854
|
public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <HOP>"+getName()+"</HOP>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <TIME>"+getMinutes()+"</TIME>\n" ); sb.append( " <UNITS>"+getUnitsAbrv()+"</UNITS>\n" ); sb.append( " <FORM>"+getType()+"</FORM>\n" ); sb.append( " <ALPHA>"+alpha+"</ALPHA>\n" ); sb.append( " <COSTOZ>"+getCostPerU()+"</COSTOZ>\n" ); sb.append( " <ADD>"+add+"</ADD>\n" ); sb.append( " <DESCRIPTION>"+getDescription()+"</DESCRIPTION>\n" ); sb.append( " <DATE>"+getDate()+"</DATE>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); }
|
public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <HOP>"+getName()+"</HOP>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <TIME>"+getMinutes()+"</TIME>\n" ); sb.append( " <UNITS>"+getUnitsAbrv()+"</UNITS>\n" ); sb.append( " <FORM>"+getType()+"</FORM>\n" ); sb.append( " <ALPHA>"+alpha+"</ALPHA>\n" ); sb.append( " <COSTOZ>"+getCostPerU()+"</COSTOZ>\n" ); sb.append( " <ADD>"+add+"</ADD>\n" ); sb.append( " <DESCRIPTION>"+SBStringUtils.subEntities(getDescription())+"</DESCRIPTION>\n" ); sb.append( " <DATE>"+getDate()+"</DATE>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); }
| 1,115,855
|
public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <NAME>"+getName()+"</NAME>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <UNITS>"+getUnits()+"</UNITS>\n" ); sb.append( " <STAGE>"+stage+"</STAGE>\n" ); sb.append( " <TIME>"+time+"</TIME>\n" ); sb.append( " <COMMENTS>"+comments+"</COMMENTS>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); }
|
public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <NAME>"+getName()+"</NAME>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <UNITS>"+getUnits()+"</UNITS>\n" ); sb.append( " <STAGE>"+stage+"</STAGE>\n" ); sb.append( " <TIME>"+time+"</TIME>\n" ); sb.append( " <COMMENTS>"+SBStringUtils.subEntities(comments)+"</COMMENTS>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); }
| 1,115,856
|
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; }
|
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.isEmpty() ? null : m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; }
| 1,115,857
|
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; }
|
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; }
| 1,115,858
|
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; }
|
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; return r;
| 1,115,859
|
public static LocalSeismogramImpl getSeismogram(PSNEventRecord evRec) throws FissuresException{ MicroSecondDate beginTime = microSecondDateFromPSN(evRec.getFixedHeader().getDateTime()); Time time = beginTime.getFissuresTime(); TimeSeriesDataSel data = new TimeSeriesDataSel(); if (evRec.isSampleDataShort()){ data.sht_values(evRec.getSampleDataShort()); } else if(evRec.isSampleDataInt()){ data.int_values(evRec.getSampleDataInt()); } else if(evRec.isSampleDataFloat()){ data.flt_values(evRec.getSampleDataFloat()); } else if(evRec.isSampleDataDouble()){ data.dbl_values(evRec.getSampleDataDouble()); } else throw new FissuresException(); ChannelId channelId = getChannelId(evRec); String eventName = " "; if (evRec.getVariableHeader().hasComment()){ eventName = evRec.getVariableHeader().getComment(); } String seisId = channelId.network_id.network_code + ":" + channelId.station_code + ":" + channelId.site_code + ":" + channelId.channel_code + ":" + time.date_time; return new LocalSeismogramImpl(seisId, time, evRec.getFixedHeader().getSampleCount(), new SamplingImpl(1, new TimeInterval(1.0/evRec.getFixedHeader().getSampleRate(), UnitImpl.SECOND) ), UnitImpl.COUNT, channelId, data); }
|
public static LocalSeismogramImpl getSeismogram(PSNEventRecord evRec) throws FissuresException{ MicroSecondDate beginTime = microSecondDateFromPSN(evRec.getFixedHeader().getDateTime()); Time time = beginTime.getFissuresTime(); TimeSeriesDataSel data = new TimeSeriesDataSel(); if (evRec.isSampleDataShort()){ data.sht_values(evRec.getSampleDataShort()); } else if(evRec.isSampleDataInt()){ data.int_values(evRec.getSampleDataInt()); } else if(evRec.isSampleDataFloat()){ data.flt_values(evRec.getSampleDataFloat()); } else if(evRec.isSampleDataDouble()){ data.dbl_values(evRec.getSampleDataDouble()); } else throw new FissuresException(); ChannelId channelId = getChannelId(evRec); String eventName = " "; if (evRec.getVariableHeader().hasComment()){ eventName = evRec.getVariableHeader().getComment(); } String seisId = channelId.network_id.network_code + ":" + channelId.station_code + ":" + channelId.site_code + ":" + channelId.channel_code + ":" + time.date_time; return new LocalSeismogramImpl(seisId, time, evRec.getFixedHeader().getSampleCount(), new SamplingImpl(1, new TimeInterval(1.0/evRec.getFixedHeader().getSampleRate(), UnitImpl.SECOND) ), UnitImpl.COUNT, channelId, data); }
| 1,115,860
|
void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); dataset = new XMLDataSet(docBuilder, base, "genid"+Math.round(Math.random()*Integer.MAX_VALUE), dsName, userName); Iterator it = paramRefs.keySet().iterator(); while (it.hasNext()) { String key = (String)it.next(); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName, "Added parameter "+key); try { dataset.addParameterRef(new URL(base, (String)paramRefs.get(key)), key, audit); } catch (MalformedURLException e) { //can't happen? e.printStackTrace(); System.err.println("Caught exception on parameterRef " +key+", continuing..."); } // end of try-catch } // end of while (it.hasNext()) File[] sacFiles = directory.listFiles(); //SacTimeSeries sac = new SacTimeSeries(); for (int i=0; i<sacFiles.length; i++) { if (excludes.contains(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) if (paramRefs.containsValue(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) try { //sac.read(sacFiles[i].getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from sacFiles[i].getCanonicalPath()"); URL seisURL = new URL(base, sacFiles[i].getName()); dataset.addSeismogramRef(seisURL, sacFiles[i].getName(), new Property[0], new ParameterRef[0], audit); } catch (Exception e) { e.printStackTrace(); System.err.println("Caught exception on " +sacFiles[i].getName()+", continuing..."); } // end of try-catch } // end of for (int i=0; i<sacFiles.length; i++) }
|
void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); dataset = new XMLDataSet(docBuilder, base, "genid"+Math.round(Math.random()*Integer.MAX_VALUE), dsName, userName); Iterator it = paramRefs.keySet().iterator(); while (it.hasNext()) { String key = (String)it.next(); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName, "Added parameter "+key); try { URL dirURL = new URL(base, directory.getName()); dataset.addParameterRef(new URL(dirURL, (String)paramRefs.get(key)), key, audit); } catch (MalformedURLException e) { //can't happen? e.printStackTrace(); System.err.println("Caught exception on parameterRef " +key+", continuing..."); } // end of try-catch } // end of while (it.hasNext()) File[] sacFiles = directory.listFiles(); //SacTimeSeries sac = new SacTimeSeries(); for (int i=0; i<sacFiles.length; i++) { if (excludes.contains(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) if (paramRefs.containsValue(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) try { //sac.read(sacFiles[i].getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from sacFiles[i].getCanonicalPath()"); URL seisURL = new URL(base, sacFiles[i].getName()); dataset.addSeismogramRef(seisURL, sacFiles[i].getName(), new Property[0], new ParameterRef[0], audit); } catch (Exception e) { e.printStackTrace(); System.err.println("Caught exception on " +sacFiles[i].getName()+", continuing..."); } // end of try-catch } // end of for (int i=0; i<sacFiles.length; i++) }
| 1,115,861
|
protected SortedMap<Integer,RunT> _getRuns() { if(notLoaded) { // if none is loaded yet, do so immediately. synchronized(this) { if(notLoaded) { notLoaded = false; _reload(); } } } if(nextUpdate<System.currentTimeMillis()) { if(!reloadingInProgress) { // schedule a new reloading operation. // we don't want to block the current thread, // so reloading is done asynchronously. reloadingInProgress = true; synchronized(reloadQueue) { reloadQueue.add(this); reloadQueue.notify(); } } } return runs; }
|
protected SortedMap<Integer,RunT> _getRuns() { if(notLoaded || runs==null) { // if none is loaded yet, do so immediately. synchronized(this) { if(notLoaded || runs==null) { notLoaded = false; _reload(); } } } if(nextUpdate<System.currentTimeMillis()) { if(!reloadingInProgress) { // schedule a new reloading operation. // we don't want to block the current thread, // so reloading is done asynchronously. reloadingInProgress = true; synchronized(reloadQueue) { reloadQueue.add(this); reloadQueue.notify(); } } } return runs; }
| 1,115,862
|
public JEP() { debug = false; topNode = null; traverse = false; allowUndeclared = false; implicitMul = false; initSymTab(); initFunTab(); errorList = new Vector(); ev = new EvaluatorVisitor(); parser = new Parser(new StringReader("")); //Ensure errors are reported for the initial expression //e.g. No expression entered parseExpression(""); }
|
public JEP() { topNode = null; traverse = false; allowUndeclared = false; implicitMul = false; initSymTab(); initFunTab(); errorList = new Vector(); ev = new EvaluatorVisitor(); parser = new Parser(new StringReader("")); //Ensure errors are reported for the initial expression //e.g. No expression entered parseExpression(""); }
| 1,115,864
|
private SymbolTable() {}
|
public SymbolTable(VariableFactory varFac) { vf = varFac; }
| 1,115,865
|
public Node parseStream(java.io.Reader stream, JEP jep_in) throws ParseException { restart(stream,jep_in); // Parse the expression, and return the enable_tracing(); Node res = Start(); if(res == null) throw new ParseException("No expression entered"); return res.jjtGetChild(0); }
|
public Node parseStream(java.io.Reader stream, JEP jep_in) throws ParseException { restart(stream,jep_in); // Parse the expression, and return the enable_tracing(); Node res = Start(); if(res == null) throw new ParseException("No expression entered"); return res.jjtGetChild(0); }
| 1,115,866
|
public Object acosh(Object param) throws ParseException { if (param instanceof Complex) { return ((Complex)param).acosh(); } else if (param instanceof Number) { Complex temp = new Complex(((Number)param).doubleValue(),0.0); return temp.acosh(); } throw new ParseException("Invalid parameter type"); }
|
public Object acosh(Object param) throws ParseException { if (param instanceof Complex) { return ((Complex)param).acosh(); } else if (param instanceof Number) { Complex temp = new Complex(((Number)param).doubleValue(),0.0); return temp.acosh(); } throw new ParseException("Invalid parameter type"); }
| 1,115,867
|
public void execute() throws BuildException { File savedDir = m_dir; // may be altered in validate try { validate(); final Properties userList = new Properties(); loadUserlist(userList); for (Enumeration e = m_cvsUsers.elements(); e.hasMoreElements();) { final CvsUser user = (CvsUser) e.nextElement(); user.validate(); userList.put(user.getUserID(), user.getDisplayname()); } setCommand("log"); if (getTag() != null) { CvsVersion myCvsVersion = new CvsVersion(); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (myCvsVersion.supportsCvsLogWithSOption()) { addCommandArgument("-S"); } } if (null != m_start) { final SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); // We want something of the form: -d ">=YYYY-MM-dd" final String dateRange = ">=" + outputDate.format(m_start); // Supply '-d' as a separate argument - Bug# 14397 addCommandArgument("-d"); addCommandArgument(dateRange); } // Check if list of files to check has been specified if (!m_filesets.isEmpty()) { for (String file : m_filesets) { addCommandArgument(file); } } final ChangeLogParser parser = new hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser(); final RedirectingStreamHandler handler = new RedirectingStreamHandler(parser); log(getCommand(), Project.MSG_VERBOSE); setDest(m_dir); setExecuteStreamHandler(handler); super.execute(); final String errors = handler.getErrors(); if (null != errors) { log(errors, Project.MSG_ERR); } final CVSEntry[] entrySet = parser.getEntrySetAsArray(); final CVSEntry[] filteredEntrySet = filterEntrySet(entrySet); replaceAuthorIdWithName(userList, filteredEntrySet); writeChangeLog(filteredEntrySet); } finally { m_dir = savedDir; } }
|
public void execute() throws BuildException { File savedDir = m_dir; // may be altered in validate try { validate(); final Properties userList = new Properties(); loadUserlist(userList); for (Enumeration e = m_cvsUsers.elements(); e.hasMoreElements();) { final CvsUser user = (CvsUser) e.nextElement(); user.validate(); userList.put(user.getUserID(), user.getDisplayname()); } setCommand("log"); if (getTag() != null) { CvsVersion myCvsVersion = new CvsVersion(); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (myCvsVersion.supportsCvsLogWithSOption()) { addCommandArgument("-S"); } } if (null != m_start) { final SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); // We want something of the form: -d ">=YYYY-MM-dd" final String dateRange = ">=" + outputDate.format(m_start); // Supply '-d' as a separate argument - Bug# 14397 addCommandArgument("-d"); addCommandArgument(dateRange); } // Check if list of files to check has been specified if (!m_filesets.isEmpty()) { for (String file : m_filesets) { addCommandArgument(file); } } final ChangeLogParser parser = new hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser(); final RedirectingStreamHandler handler = new RedirectingStreamHandler(parser); log(getCommand(), Project.MSG_VERBOSE); setDest(m_dir); setExecuteStreamHandler(handler); super.execute(); final String errors = handler.getErrors(); if (null != errors) { log(errors, Project.MSG_ERR); } final CVSEntry[] entrySet = parser.getEntrySetAsArray(); final CVSEntry[] filteredEntrySet = filterEntrySet(entrySet); replaceAuthorIdWithName(userList, filteredEntrySet); writeChangeLog(filteredEntrySet); } finally { m_dir = savedDir; } }
| 1,115,868
|
public void execute() throws BuildException { File savedDir = m_dir; // may be altered in validate try { validate(); final Properties userList = new Properties(); loadUserlist(userList); for (Enumeration e = m_cvsUsers.elements(); e.hasMoreElements();) { final CvsUser user = (CvsUser) e.nextElement(); user.validate(); userList.put(user.getUserID(), user.getDisplayname()); } setCommand("log"); if (getTag() != null) { CvsVersion myCvsVersion = new CvsVersion(); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (myCvsVersion.supportsCvsLogWithSOption()) { addCommandArgument("-S"); } } if (null != m_start) { final SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); // We want something of the form: -d ">=YYYY-MM-dd" final String dateRange = ">=" + outputDate.format(m_start); // Supply '-d' as a separate argument - Bug# 14397 addCommandArgument("-d"); addCommandArgument(dateRange); } // Check if list of files to check has been specified if (!m_filesets.isEmpty()) { for (String file : m_filesets) { addCommandArgument(file); } } final ChangeLogParser parser = new hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser(); final RedirectingStreamHandler handler = new RedirectingStreamHandler(parser); log(getCommand(), Project.MSG_VERBOSE); setDest(m_dir); setExecuteStreamHandler(handler); super.execute(); final String errors = handler.getErrors(); if (null != errors) { log(errors, Project.MSG_ERR); } final CVSEntry[] entrySet = parser.getEntrySetAsArray(); final CVSEntry[] filteredEntrySet = filterEntrySet(entrySet); replaceAuthorIdWithName(userList, filteredEntrySet); writeChangeLog(filteredEntrySet); } finally { m_dir = savedDir; } }
|
public void execute() throws BuildException { File savedDir = m_dir; // may be altered in validate try { validate(); final Properties userList = new Properties(); loadUserlist(userList); for (Enumeration e = m_cvsUsers.elements(); e.hasMoreElements();) { final CvsUser user = (CvsUser) e.nextElement(); user.validate(); userList.put(user.getUserID(), user.getDisplayname()); } setCommand("log"); if (getTag() != null) { CvsVersion myCvsVersion = new CvsVersion(); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (myCvsVersion.supportsCvsLogWithSOption()) { addCommandArgument("-S"); } } if (null != m_start) { final SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); // We want something of the form: -d ">=YYYY-MM-dd" final String dateRange = ">=" + outputDate.format(m_start); // Supply '-d' as a separate argument - Bug# 14397 addCommandArgument("-d"); addCommandArgument(dateRange); } // Check if list of files to check has been specified if (!m_filesets.isEmpty()) { for (String file : m_filesets) { addCommandArgument(file); } } final ChangeLogParser parser = new hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser(); final RedirectingStreamHandler handler = new RedirectingStreamHandler(parser); log(getCommand(), Project.MSG_VERBOSE); setDest(m_dir); setExecuteStreamHandler(handler); super.execute(); final String errors = handler.getErrors(); if (null != errors) { log(errors, Project.MSG_ERR); } final CVSEntry[] entrySet = parser.getEntrySetAsArray(); final CVSEntry[] filteredEntrySet = filterEntrySet(entrySet); replaceAuthorIdWithName(userList, filteredEntrySet); writeChangeLog(filteredEntrySet); } finally { m_dir = savedDir; } }
| 1,115,869
|
public Object sinh(Object param) throws ParseException { if (param instanceof Number) { double value = ((Number)param).doubleValue(); return new Double((Math.exp(value)-Math.exp(-value))/2); } else if (param instanceof Complex) { return ((Complex)param).sinh(); } throw new ParseException("Invalid parameter type"); }
|
public Object sinh(Object param) throws ParseException { if (param instanceof Complex) { return ((Complex)param).sinh(); } else if (param instanceof Number) { double value = ((Number)param).doubleValue(); return new Double((Math.exp(value)-Math.exp(-value))/2); } else if (param instanceof Complex) { return ((Complex)param).sinh(); } throw new ParseException("Invalid parameter type"); }
| 1,115,871
|
public Object sinh(Object param) throws ParseException { if (param instanceof Number) { double value = ((Number)param).doubleValue(); return new Double((Math.exp(value)-Math.exp(-value))/2); } else if (param instanceof Complex) { return ((Complex)param).sinh(); } throw new ParseException("Invalid parameter type"); }
|
public Object sinh(Object param) throws ParseException { if (param instanceof Number) { double value = ((Number)param).doubleValue(); return new Double((Math.exp(value)-Math.exp(-value))/2); } else if (param instanceof Complex) { return ((Complex)param).sinh(); } throw new ParseException("Invalid parameter type"); }
| 1,115,872
|
public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { Set<Project> upstream = Collections.EMPTY_SET; synchronized(this) { try { if(!Hudson.adminCheck(req,rsp)) return; req.setCharacterEncoding("UTF-8"); int scmidx = Integer.parseInt(req.getParameter("scm")); scm = SCMS.SCMS[scmidx].newInstance(req); disabled = req.getParameter("disable")!=null; jdk = req.getParameter("jdk"); if(req.getParameter("hasCustomQuietPeriod")!=null) { quietPeriod = Integer.parseInt(req.getParameter("quiet_period")); } else { quietPeriod = null; } if(req.getParameter("hasSlaveAffinity")!=null) { canRoam = false; assignedNode = req.getParameter("slave"); if(assignedNode !=null) { if(Hudson.getInstance().getSlave(assignedNode)==null) { assignedNode = null; // no such slave } } } else { canRoam = true; assignedNode = null; } buildDescribable(req, BuildStep.BUILDERS, builders, "builder"); buildDescribable(req, BuildStep.PUBLISHERS, publishers, "publisher"); for (Trigger t : triggers) t.stop(); buildDescribable(req, Triggers.TRIGGERS, triggers, "trigger"); for (Trigger t : triggers) t.start(this); updateTransientActions(); super.doConfigSubmit(req,rsp); } catch (FormException e) { sendError(e,req,rsp); } } if(req.getParameter("pseudoUpstreamTrigger")!=null) { upstream = new HashSet<Project>(Project.fromNameList(req.getParameter("upstreamProjects"))); } // this needs to be done after we release the lock on this, // or otherwise we could dead-lock for (Project p : Hudson.getInstance().getProjects()) { boolean isUpstream = upstream.contains(p); synchronized(p) { List<Project> newChildProjects = p.getDownstreamProjects(); if(isUpstream) { newChildProjects.add(this); } else { newChildProjects.remove(this); } if(newChildProjects.isEmpty()) { p.removePublisher(BuildTrigger.DESCRIPTOR); } else { p.addPublisher(new BuildTrigger(newChildProjects)); } } } }
|
public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { Set<Project> upstream = Collections.EMPTY_SET; synchronized(this) { try { if(!Hudson.adminCheck(req,rsp)) return; req.setCharacterEncoding("UTF-8"); int scmidx = Integer.parseInt(req.getParameter("scm")); scm = SCMS.SCMS[scmidx].newInstance(req); disabled = req.getParameter("disable")!=null; jdk = req.getParameter("jdk"); if(req.getParameter("hasCustomQuietPeriod")!=null) { quietPeriod = Integer.parseInt(req.getParameter("quiet_period")); } else { quietPeriod = null; } if(req.getParameter("hasSlaveAffinity")!=null) { canRoam = false; assignedNode = req.getParameter("slave"); if(assignedNode !=null) { if(Hudson.getInstance().getSlave(assignedNode)==null) { assignedNode = null; // no such slave } } } else { canRoam = true; assignedNode = null; } buildDescribable(req, BuildStep.BUILDERS, builders, "builder"); buildDescribable(req, BuildStep.PUBLISHERS, publishers, "publisher"); for (Trigger t : triggers) t.stop(); buildDescribable(req, Triggers.TRIGGERS, triggers, "trigger"); for (Trigger t : triggers) t.start(this); updateTransientActions(); super.doConfigSubmit(req,rsp); } catch (FormException e) { sendError(e,req,rsp); } } if(req.getParameter("pseudoUpstreamTrigger")!=null) { upstream = new HashSet<Project>(Project.fromNameList(req.getParameter("upstreamProjects"))); } // this needs to be done after we release the lock on this, // or otherwise we could dead-lock for (Project p : Hudson.getInstance().getProjects()) { boolean isUpstream = upstream.contains(p); synchronized(p) { List<Project> newChildProjects = p.getDownstreamProjects(); if(isUpstream) { if(!newChildProjects.contains(this)) newChildProjects.add(this); } else { newChildProjects.remove(this); } if(newChildProjects.isEmpty()) { p.removePublisher(BuildTrigger.DESCRIPTOR); } else { p.addPublisher(new BuildTrigger(newChildProjects)); } } } }
| 1,115,873
|
public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } }
|
public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } }
| 1,115,874
|
public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } }
|
public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = new SoftReference(createImage(w, h)); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } }
| 1,115,875
|
public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } }
|
public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)((Image)overSizedImage.get()).getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } }
| 1,115,876
|
public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } }
|
public void paint(Graphics g){ if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } }
| 1,115,877
|
public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } }
|
public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); redo = true; repaint(); } }
| 1,115,878
|
public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } }
|
public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } }
| 1,115,879
|
public void addSeismogram(LocalSeismogram newSeismogram){ SeismogramPlotter newPlotter = new SeismogramPlotter(newSeismogram, timeConfig, ampConfig); plotters.put(newPlotter, colors[plotters.size()%colors.length]); timeConfig.addSeismogram(newSeismogram); ampConfig.addSeismogram(newSeismogram); redo = true; }
|
public void addSeismogram(LocalSeismogram newSeismogram){ SeismogramPlotter newPlotter = new SeismogramPlotter(newSeismogram, timeConfig, ampConfig); plotters.put(newPlotter, colors[plotters.size()%colors.length]); timeConfig.addSeismogram(newSeismogram); ampConfig.addSeismogram(newSeismogram); overSizedImage = null; }
| 1,115,880
|
public void redraw(){ redo = true; repaint(); }
|
public void redraw(){ overSizedImage = null; repaint(); }
| 1,115,881
|
protected void resize() { Dimension dim = getSize(); Insets insets = getInsets(); timeScaleMap.setTotalPixels(dim.width-insets.left-insets.right); ampScaleMap.setTotalPixels(dim.height-insets.top-insets.bottom); redo = true; repaint(); }
|
protected void resize() { Dimension dim = getSize(); Insets insets = getInsets(); timeScaleMap.setTotalPixels(dim.width-insets.left-insets.right); ampScaleMap.setTotalPixels(dim.height-insets.top-insets.bottom); overSizedImage = null; repaint(); }
| 1,115,882
|
public void updateAmpRange(){ redo = true; this.ampScaleMap.setUnitRange(ampConfig.getAmpRange()); repaint(); }
|
public void updateAmpRange(){ overSizedImage = null; this.ampScaleMap.setUnitRange(ampConfig.getAmpRange()); repaint(); }
| 1,115,883
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
| 1,115,884
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
| 1,115,885
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
| 1,115,886
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
|
private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); }
| 1,115,887
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } }
| 1,115,888
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } }
| 1,115,889
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position );
| 1,115,890
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
| 1,115,891
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
| 1,115,892
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
| 1,115,893
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
|
private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); }
| 1,115,894
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } }
| 1,115,895
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } }
| 1,115,896
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position );
| 1,115,897
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
| 1,115,898
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
| 1,115,899
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
| 1,115,900
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
|
private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); }
| 1,115,901
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } }
| 1,115,902
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } }
| 1,115,903
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } }
|
public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position );
| 1,115,904
|
public FilePath getWorkspace() { Slave s = getSlave(); if(s ==null) return new FilePath(new File(root,"workspace")); else return s.getFilePath(); }
|
public FilePath getWorkspace() { Slave s = getSlave(); if(s ==null) return new FilePath(new File(root,"workspace")); else return s.getFilePath().child("workspace").child(getName()); }
| 1,115,905
|
private void initGUI() { try { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; thisLayout.columnWidths = new int[] {7, 7, 7}; thisLayout.rowWeights = new double[] {0.1, 0.8, 0.1, 0.1, 0.1, 0.1}; thisLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setTitle("Mash Manager"); { { } titlePanel = new JPanel(); FlowLayout titlePanelLayout = new FlowLayout(); titlePanelLayout.setAlignment(FlowLayout.LEFT); titlePanel.setLayout(titlePanelLayout); this.getContentPane().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.getContentPane().add( tablePanel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); tablePanel.setName(""); tablePanel.setBorder(BorderFactory.createTitledBorder("Mash Steps")); { jScrollPane1 = new JScrollPane(); tablePanel.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(424, -32)); { mashModel = new MashTableModel(this); tblMash = new JTable(); jScrollPane1.setViewportView(tblMash); tblMash.setModel(mashModel); tblMash.setAutoCreateColumnsFromModel(false); tblMash.getTableHeader().setReorderingAllowed(false); tblMash.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = tblMash.getSelectedRow(); directionsTextArea.setText(myRecipe.mash.getStepDirections(i)); } }); // 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)); } } { buttonsPanel = new JPanel(); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); tablePanel.add(buttonsPanel, BorderLayout.SOUTH); { addStepButton = new JButton(); buttonsPanel.add(addStepButton); addStepButton.setText("+"); addStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addStepButtonActionPerformed(evt); } }); } { delStepButton = new JButton(); buttonsPanel.add(delStepButton); delStepButton.setText("-"); delStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { delStepButtonActionPerformed(evt); } }); } { weightPanel = new JPanel(); BoxLayout statsPanelLayout = new BoxLayout(weightPanel, javax.swing.BoxLayout.X_AXIS); weightPanel.setLayout(statsPanelLayout); buttonsPanel.add(weightPanel); weightPanel.setBorder(BorderFactory.createTitledBorder("Total Weight")); weightPanel.setPreferredSize(new java.awt.Dimension(98, 39)); { totalMashLabel = new JLabel(); weightPanel.add(totalMashLabel); totalMashLabel.setPreferredSize(new java.awt.Dimension(118, 13)); totalMashLabel.setText("total"); } } { timePanel = new JPanel(); BoxLayout timePanelLayout = new BoxLayout(timePanel, javax.swing.BoxLayout.X_AXIS); timePanel.setLayout(timePanelLayout); buttonsPanel.add(timePanel); timePanel.setBorder(BorderFactory.createTitledBorder("Total Min")); timePanel.setPreferredSize(new java.awt.Dimension(79, 43)); { totalTimeLabel = new JLabel(); timePanel.add(totalTimeLabel); totalTimeLabel.setText("Time"); totalTimeLabel.setPreferredSize(new java.awt.Dimension(111, 17)); } } { volPanel = new JPanel(); BoxLayout volPanelLayout = new BoxLayout(volPanel, javax.swing.BoxLayout.X_AXIS); volPanel.setLayout(volPanelLayout); buttonsPanel.add(volPanel); volPanel.setBorder(BorderFactory.createTitledBorder("Total Vol")); volPanel.setPreferredSize(new java.awt.Dimension(117, 42)); { volLabel = new JLabel(); volPanel.add(volLabel); volLabel.setText("10"); } } } } { settingsPanel = new JPanel(); FlowLayout settingsPanelLayout = new FlowLayout(); settingsPanelLayout.setAlignment(FlowLayout.LEFT); settingsPanel.setLayout(settingsPanelLayout); this.getContentPane().add( settingsPanel, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { tempPanel = new JPanel(); settingsPanel.add(tempPanel); tempPanel.setBorder(BorderFactory.createTitledBorder("Temp Units")); { tempFrb = new JRadioButton(); tempPanel.add(tempFrb); tempFrb.setText("F"); tempFrb.addActionListener(this); } { tempCrb = new JRadioButton(); tempPanel.add(tempCrb); tempCrb.setText("C"); tempCrb.addActionListener(this); } tempUnitsButtonGroup = new ButtonGroup(); tempUnitsButtonGroup.add(tempFrb); tempUnitsButtonGroup.add(tempCrb); } { volUnitsPanel = new JPanel(); settingsPanel.add(volUnitsPanel); volUnitsPanel.setBorder(BorderFactory.createTitledBorder("Vol Units")); { // volList = new ArrayList(q.getListofUnits("vol")); volUnitsComboModel = new ComboModel(); volUnitsComboModel.setList(new Quantity().getListofUnits("vol")); volUnitsCombo = new JComboBox(); volUnitsPanel.add(volUnitsCombo); volUnitsCombo.setModel(volUnitsComboModel); volUnitsCombo.addActionListener(this); } } { ratioPanel = new JPanel(); settingsPanel.add(ratioPanel); ratioPanel.setBorder(BorderFactory.createTitledBorder("Mash Ratio")); { ratioLabel = new JLabel(); ratioPanel.add(ratioLabel); ratioLabel.setText("1:"); } { ratioText = new JTextField(); ratioPanel.add(ratioText); ratioText.setText("1.25"); ratioText.addFocusListener(this); ratioText.addActionListener(this); } { ComboBoxModel ratioUnitsComboModel = new DefaultComboBoxModel(new String[] { "qt/lb", "l/kg" }); ratioUnitsCombo = new JComboBox(); ratioPanel.add(ratioUnitsCombo); ratioUnitsCombo.setModel(ratioUnitsComboModel); ratioUnitsCombo.addActionListener(this); } } } { directionsPanel = new JPanel(); getContentPane().add(directionsPanel, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); BorderLayout directionsPanelLayout = new BorderLayout(); directionsPanel.setLayout(directionsPanelLayout); directionsPanel.setBorder(BorderFactory.createTitledBorder("Directions")); directionsPanel.setPreferredSize(new java.awt.Dimension(181, 75)); { directionsTextArea = new JTextArea(); directionsPanel.add(directionsTextArea, BorderLayout.CENTER); directionsTextArea.setText("Directions"); directionsTextArea.setPreferredSize(new java.awt.Dimension(171, 38)); directionsTextArea.setEditable(false); directionsTextArea.setLineWrap(true); } } { pnlButtons = new JPanel(); FlowLayout pnlButtonsLayout = new FlowLayout(); pnlButtonsLayout.setAlignment(FlowLayout.RIGHT); pnlButtons.setLayout(pnlButtonsLayout); getContentPane().add(pnlButtons, new GridBagConstraints(1, 6, 2, 1, 0.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { btnOk = new JButton(); pnlButtons.add(btnOk); btnOk.setText("OK"); btnOk.addActionListener(this); } } { moreSettingsPanel = new JPanel(); FlowLayout moreSettingsPanelLayout = new FlowLayout(); moreSettingsPanelLayout.setAlignment(FlowLayout.LEFT); moreSettingsPanel.setLayout(moreSettingsPanelLayout); this.getContentPane().add( moreSettingsPanel, new GridBagConstraints( 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); getContentPane().add(waterUsePanel, new GridBagConstraints(2, 1, 1, 3, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel7 = new JLabel(); waterUsePanel.add(jLabel7, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { jLabel8 = new JLabel(); waterUsePanel.add(jLabel8, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { jLabel9 = new JLabel(); waterUsePanel.add(jLabel9, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { jLabel10 = new JLabel(); waterUsePanel.add(jLabel10, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); } { chillShrinkLbl = new JLabel(); waterUsePanel.add(chillShrinkLbl, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { kettleTxt = new JFormattedTextField(); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); waterUsePanel.add(kettleTxt, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.setText("1"); } { kettleUnitsLbl = new JLabel(); waterUsePanel.add(kettleUnitsLbl, new GridBagConstraints(2, 7, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); } { trubLossTxt = new JFormattedTextField(); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); waterUsePanel.add(trubLossTxt, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.setText("jTextField1"); } { miscLossTxt = new JFormattedTextField(); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); waterUsePanel.add(miscLossTxt, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.setText("jTextField1"); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); } { trubLossUnitsLbl = new JLabel(); waterUsePanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); } { miscLosUnitsLbl = new JLabel(); waterUsePanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 10, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } } { grainTempPanel = new JPanel(); getContentPane().add(grainTempPanel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); BoxLayout grainTempPanelLayout = new BoxLayout( grainTempPanel, javax.swing.BoxLayout.X_AXIS); grainTempPanel.setLayout(grainTempPanelLayout); grainTempPanel.setBorder(BorderFactory.createTitledBorder("Grain Temp")); grainTempPanel.setPreferredSize(new java.awt.Dimension(94, 45)); { grainTempText = new JTextField(); grainTempPanel.add(grainTempText); grainTempText.setText("10"); grainTempText.setPreferredSize(new java.awt.Dimension(67, 15)); grainTempText.addFocusListener(this); grainTempText.addActionListener(this); } { grainTempULabel = new JLabel(); grainTempPanel.add(grainTempULabel); grainTempULabel.setText("F"); } } { tempLostPanel = new JPanel(); getContentPane().add(tempLostPanel, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); BoxLayout tempLostPanelLayout = new BoxLayout( tempLostPanel, javax.swing.BoxLayout.X_AXIS); tempLostPanel.setLayout(tempLostPanelLayout); tempLostPanel.setPreferredSize(new java.awt.Dimension(104, 45)); tempLostPanel.setBorder(BorderFactory.createTitledBorder("Tun Temp Lost")); { tunLossTxt = new JTextField(); tempLostPanel.add(tunLossTxt); tunLossTxt.addFocusListener(this); tunLossTxt.addActionListener(this); } { tempLostULabel = new JLabel(); tempLostPanel.add(tempLostULabel); tempLostULabel.setText("F"); } } boilTempPanel = new JPanel(); BoxLayout boilTempPanelLayout = new BoxLayout( boilTempPanel, javax.swing.BoxLayout.X_AXIS); boilTempPanel.setLayout(boilTempPanelLayout); getContentPane().add(boilTempPanel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); boilTempPanel.setBorder(BorderFactory.createTitledBorder(null, "Boil Temp", TitledBorder.LEADING, TitledBorder.TOP)); boilTempTxt = new JTextField(); boilTempPanel.add(boilTempTxt); boilTempTxt.setText("212"); boilTempTxt.addFocusListener(this); boilTempTxt.addActionListener(this); jLabel12 = new JLabel(); boilTempPanel.add(jLabel12); jLabel12.setText("F"); pack(); this.setSize(550, 400); } catch (Exception e) { e.printStackTrace(); } }
|
private void initGUI() { try { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; thisLayout.columnWidths = new int[] {7, 7, 7}; thisLayout.rowWeights = new double[] {0.1, 0.8, 0.1, 0.1, 0.1, 0.1}; thisLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setTitle("Mash Manager"); { { } titlePanel = new JPanel(); FlowLayout titlePanelLayout = new FlowLayout(); titlePanelLayout.setAlignment(FlowLayout.LEFT); titlePanel.setLayout(titlePanelLayout); this.getContentPane().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.getContentPane().add( tablePanel, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); tablePanel.setName(""); tablePanel.setBorder(BorderFactory.createTitledBorder("Mash Steps")); { jScrollPane1 = new JScrollPane(); tablePanel.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(424, -32)); { mashModel = new MashTableModel(this); tblMash = new JTable(); jScrollPane1.setViewportView(tblMash); tblMash.setModel(mashModel); tblMash.setAutoCreateColumnsFromModel(false); tblMash.getTableHeader().setReorderingAllowed(false); tblMash.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { int i = tblMash.getSelectedRow(); directionsTextArea.setText(myRecipe.mash.getStepDirections(i)); } }); // 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)); } } { buttonsPanel = new JPanel(); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); tablePanel.add(buttonsPanel, BorderLayout.SOUTH); { addStepButton = new JButton(); buttonsPanel.add(addStepButton); addStepButton.setText("+"); addStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addStepButtonActionPerformed(evt); } }); } { delStepButton = new JButton(); buttonsPanel.add(delStepButton); delStepButton.setText("-"); delStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { delStepButtonActionPerformed(evt); } }); } { weightPanel = new JPanel(); BoxLayout statsPanelLayout = new BoxLayout(weightPanel, javax.swing.BoxLayout.X_AXIS); weightPanel.setLayout(statsPanelLayout); buttonsPanel.add(weightPanel); weightPanel.setBorder(BorderFactory.createTitledBorder("Total Weight")); weightPanel.setPreferredSize(new java.awt.Dimension(98, 39)); { totalMashLabel = new JLabel(); weightPanel.add(totalMashLabel); totalMashLabel.setPreferredSize(new java.awt.Dimension(118, 13)); totalMashLabel.setText("total"); } } { timePanel = new JPanel(); BoxLayout timePanelLayout = new BoxLayout(timePanel, javax.swing.BoxLayout.X_AXIS); timePanel.setLayout(timePanelLayout); buttonsPanel.add(timePanel); timePanel.setBorder(BorderFactory.createTitledBorder("Total Min")); timePanel.setPreferredSize(new java.awt.Dimension(79, 43)); { totalTimeLabel = new JLabel(); timePanel.add(totalTimeLabel); totalTimeLabel.setText("Time"); totalTimeLabel.setPreferredSize(new java.awt.Dimension(111, 17)); } } { volPanel = new JPanel(); BoxLayout volPanelLayout = new BoxLayout(volPanel, javax.swing.BoxLayout.X_AXIS); volPanel.setLayout(volPanelLayout); buttonsPanel.add(volPanel); volPanel.setBorder(BorderFactory.createTitledBorder("Total Vol")); volPanel.setPreferredSize(new java.awt.Dimension(117, 42)); { volLabel = new JLabel(); volPanel.add(volLabel); volLabel.setText("10"); } } } } { settingsPanel = new JPanel(); FlowLayout settingsPanelLayout = new FlowLayout(); settingsPanelLayout.setAlignment(FlowLayout.LEFT); settingsPanel.setLayout(settingsPanelLayout); this.getContentPane().add( settingsPanel, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { tempPanel = new JPanel(); settingsPanel.add(tempPanel); tempPanel.setBorder(BorderFactory.createTitledBorder("Temp Units")); { tempFrb = new JRadioButton(); tempPanel.add(tempFrb); tempFrb.setText("F"); tempFrb.addActionListener(this); } { tempCrb = new JRadioButton(); tempPanel.add(tempCrb); tempCrb.setText("C"); tempCrb.addActionListener(this); } tempUnitsButtonGroup = new ButtonGroup(); tempUnitsButtonGroup.add(tempFrb); tempUnitsButtonGroup.add(tempCrb); } { volUnitsPanel = new JPanel(); settingsPanel.add(volUnitsPanel); volUnitsPanel.setBorder(BorderFactory.createTitledBorder("Vol Units")); { // volList = new ArrayList(q.getListofUnits("vol")); volUnitsComboModel = new ComboModel(); volUnitsComboModel.setList(new Quantity().getListofUnits("vol")); volUnitsCombo = new JComboBox(); volUnitsPanel.add(volUnitsCombo); volUnitsCombo.setModel(volUnitsComboModel); volUnitsCombo.addActionListener(this); } } { ratioPanel = new JPanel(); settingsPanel.add(ratioPanel); ratioPanel.setBorder(BorderFactory.createTitledBorder("Mash Ratio")); { ratioLabel = new JLabel(); ratioPanel.add(ratioLabel); ratioLabel.setText("1:"); } { ratioText = new JTextField(); ratioPanel.add(ratioText); ratioText.setText("1.25"); ratioText.addFocusListener(this); ratioText.addActionListener(this); } { ComboBoxModel ratioUnitsComboModel = new DefaultComboBoxModel(new String[] { "qt/lb", "l/kg" }); ratioUnitsCombo = new JComboBox(); ratioPanel.add(ratioUnitsCombo); ratioUnitsCombo.setModel(ratioUnitsComboModel); ratioUnitsCombo.addActionListener(this); } } } { directionsPanel = new JPanel(); getContentPane().add(directionsPanel, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); BorderLayout directionsPanelLayout = new BorderLayout(); directionsPanel.setLayout(directionsPanelLayout); directionsPanel.setBorder(BorderFactory.createTitledBorder("Directions")); directionsPanel.setPreferredSize(new java.awt.Dimension(181, 75)); { directionsTextArea = new JTextArea(); directionsPanel.add(directionsTextArea, BorderLayout.CENTER); directionsTextArea.setText("Directions"); directionsTextArea.setPreferredSize(new java.awt.Dimension(171, 38)); directionsTextArea.setEditable(false); directionsTextArea.setLineWrap(true); } } { pnlButtons = new JPanel(); FlowLayout pnlButtonsLayout = new FlowLayout(); pnlButtonsLayout.setAlignment(FlowLayout.RIGHT); pnlButtons.setLayout(pnlButtonsLayout); getContentPane().add(pnlButtons, new GridBagConstraints(1, 6, 2, 1, 0.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { btnOk = new JButton(); pnlButtons.add(btnOk); btnOk.setText("OK"); btnOk.addActionListener(this); } } { moreSettingsPanel = new JPanel(); FlowLayout moreSettingsPanelLayout = new FlowLayout(); moreSettingsPanelLayout.setAlignment(FlowLayout.LEFT); moreSettingsPanel.setLayout(moreSettingsPanelLayout); this.getContentPane().add( moreSettingsPanel, new GridBagConstraints( 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); getContentPane().add(waterUsePanel, new GridBagConstraints(2, 1, 1, 3, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel7 = new JLabel(); waterUsePanel.add(jLabel7, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { jLabel8 = new JLabel(); waterUsePanel.add(jLabel8, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { jLabel9 = new JLabel(); waterUsePanel.add(jLabel9, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { jLabel10 = new JLabel(); waterUsePanel.add(jLabel10, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); } { chillShrinkLbl = new JLabel(); waterUsePanel.add(chillShrinkLbl, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { kettleTxt = new JFormattedTextField(); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); waterUsePanel.add(kettleTxt, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.setText("1"); } { kettleUnitsLbl = new JLabel(); waterUsePanel.add(kettleUnitsLbl, new GridBagConstraints(2, 7, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); } { trubLossTxt = new JFormattedTextField(); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); waterUsePanel.add(trubLossTxt, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.setText("jTextField1"); } { miscLossTxt = new JFormattedTextField(); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); waterUsePanel.add(miscLossTxt, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.setText("jTextField1"); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); } { trubLossUnitsLbl = new JLabel(); waterUsePanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); } { miscLosUnitsLbl = new JLabel(); waterUsePanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 10, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } } { grainTempPanel = new JPanel(); getContentPane().add(grainTempPanel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); BoxLayout grainTempPanelLayout = new BoxLayout( grainTempPanel, javax.swing.BoxLayout.X_AXIS); grainTempPanel.setLayout(grainTempPanelLayout); grainTempPanel.setBorder(BorderFactory.createTitledBorder("Grain Temp")); grainTempPanel.setPreferredSize(new java.awt.Dimension(94, 45)); { grainTempText = new JTextField(); grainTempPanel.add(grainTempText); grainTempText.setText("10"); grainTempText.setPreferredSize(new java.awt.Dimension(67, 15)); grainTempText.addFocusListener(this); grainTempText.addActionListener(this); } { grainTempULabel = new JLabel(); grainTempPanel.add(grainTempULabel); grainTempULabel.setText("F"); } } { tempLostPanel = new JPanel(); getContentPane().add(tempLostPanel, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); BoxLayout tempLostPanelLayout = new BoxLayout( tempLostPanel, javax.swing.BoxLayout.X_AXIS); tempLostPanel.setLayout(tempLostPanelLayout); tempLostPanel.setPreferredSize(new java.awt.Dimension(104, 45)); tempLostPanel.setBorder(BorderFactory.createTitledBorder("Tun Temp Lost")); { tunLossTxt = new JTextField(); tempLostPanel.add(tunLossTxt); tunLossTxt.addFocusListener(this); tunLossTxt.addActionListener(this); } { tempLostULabel = new JLabel(); tempLostPanel.add(tempLostULabel); tempLostULabel.setText("F"); } } boilTempPanel = new JPanel(); BoxLayout boilTempPanelLayout = new BoxLayout( boilTempPanel, javax.swing.BoxLayout.X_AXIS); boilTempPanel.setLayout(boilTempPanelLayout); getContentPane().add(boilTempPanel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); boilTempPanel.setBorder(BorderFactory.createTitledBorder(null, "Boil Temp", TitledBorder.LEADING, TitledBorder.TOP)); boilTempTxt = new JTextField(); boilTempPanel.add(boilTempTxt); boilTempTxt.setText("212"); boilTempTxt.addFocusListener(this); boilTempTxt.addActionListener(this); jLabel12 = new JLabel(); boilTempPanel.add(jLabel12); jLabel12.setText("F"); pack(); this.setSize(600, 530); } catch (Exception e) { e.printStackTrace(); } }
| 1,115,906
|
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return df.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,115,907
|
public void setValueAt(Object value, int row, int col) { try { switch (col) { case 0 : try { Date d = df.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 = df.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,115,908
|
public void create(ServletAdapterList owner) { String name = beanName; if(name==null) name=urlPattern; owner.createHttpAdapter(name, urlPattern, endpoint); }
|
public void create(ServletAdapterList owner) { String name = beanName; if(name==null) name=urlPattern; owner.createAdapter(name, urlPattern, endpoint); }
| 1,115,910
|
private boolean equal(Object param1, Object param2) throws Exception { double tolerance = 1e-15; if ((param1 instanceof Complex) && (param2 instanceof Complex)) { return ((Complex)param1).equals((Complex)param2, tolerance); } if ((param1 instanceof Complex) && (param2 instanceof Number)) { return ((Complex)param1).equals(new Complex((Number) param2), tolerance); } if ((param2 instanceof Complex) && (param1 instanceof Number)) { return ((Complex)param2).equals(new Complex((Number) param1), tolerance); } if ((param1 instanceof Number) && (param2 instanceof Number)) { return Math.abs(((Number)param1).doubleValue()-((Number)param1).doubleValue()) < tolerance; } // test any other types here return param1.equals(param2); // throw new Exception("Unable to compare the values of this type"); }
|
private boolean equal(Object param1, Object param2) throws Exception { double tolerance = 1e-15; if ((param1 instanceof Complex) && (param2 instanceof Complex)) { return ((Complex)param1).equals((Complex)param2, tolerance); } if ((param1 instanceof Complex) && (param2 instanceof Number)) { return ((Complex)param1).equals(new Complex((Number) param2), tolerance); } if ((param2 instanceof Complex) && (param1 instanceof Number)) { return ((Complex)param2).equals(new Complex((Number) param1), tolerance); } if ((param1 instanceof Number) && (param2 instanceof Number)) { return Math.abs(((Number)param1).doubleValue()-((Number)param2).doubleValue()) < tolerance; } // test any other types here return param1.equals(param2); // throw new Exception("Unable to compare the values of this type"); }
| 1,115,911
|
public int deserialize(byte[] inbuf, int offset) throws UnsupportedEncodingException { fileIndex = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; fileSize = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; // Handle Gnotella termination of single null terminated file names right // this prevents strange results like a filename of 44khz which is meta // data of gnotella. // search for first null terminator int firstTerminatorIdx = offset; while ( inbuf[firstTerminatorIdx] != (byte) 0 ) { firstTerminatorIdx++; } // extract the file name fileName = new String( inbuf, offset, firstTerminatorIdx - offset, "UTF-8" ); int secondTerminatorIdx = firstTerminatorIdx + 1; // skip terminator //Find second null terminator. while ( inbuf[secondTerminatorIdx] != (byte) 0 ) { secondTerminatorIdx++; } // parse out extension data byte[] extensionArea = new byte[ secondTerminatorIdx - firstTerminatorIdx - 1 ]; System.arraycopy( inbuf, firstTerminatorIdx + 1, extensionArea, 0, secondTerminatorIdx - firstTerminatorIdx - 1 ); parseExtensionArea( extensionArea ); // skip second terminator offset = secondTerminatorIdx + 1; return offset; }
|
public int deserialize(byte[] inbuf, int offset) throws InvalidMessageException { fileIndex = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; fileSize = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; // Handle Gnotella termination of single null terminated file names right // this prevents strange results like a filename of 44khz which is meta // data of gnotella. // search for first null terminator int firstTerminatorIdx = offset; while ( inbuf[firstTerminatorIdx] != (byte) 0 ) { firstTerminatorIdx++; } // extract the file name fileName = new String( inbuf, offset, firstTerminatorIdx - offset, "UTF-8" ); int secondTerminatorIdx = firstTerminatorIdx + 1; // skip terminator //Find second null terminator. while ( inbuf[secondTerminatorIdx] != (byte) 0 ) { secondTerminatorIdx++; } // parse out extension data byte[] extensionArea = new byte[ secondTerminatorIdx - firstTerminatorIdx - 1 ]; System.arraycopy( inbuf, firstTerminatorIdx + 1, extensionArea, 0, secondTerminatorIdx - firstTerminatorIdx - 1 ); parseExtensionArea( extensionArea ); // skip second terminator offset = secondTerminatorIdx + 1; return offset; }
| 1,115,912
|
public int deserialize(byte[] inbuf, int offset) throws UnsupportedEncodingException { fileIndex = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; fileSize = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; // Handle Gnotella termination of single null terminated file names right // this prevents strange results like a filename of 44khz which is meta // data of gnotella. // search for first null terminator int firstTerminatorIdx = offset; while ( inbuf[firstTerminatorIdx] != (byte) 0 ) { firstTerminatorIdx++; } // extract the file name fileName = new String( inbuf, offset, firstTerminatorIdx - offset, "UTF-8" ); int secondTerminatorIdx = firstTerminatorIdx + 1; // skip terminator //Find second null terminator. while ( inbuf[secondTerminatorIdx] != (byte) 0 ) { secondTerminatorIdx++; } // parse out extension data byte[] extensionArea = new byte[ secondTerminatorIdx - firstTerminatorIdx - 1 ]; System.arraycopy( inbuf, firstTerminatorIdx + 1, extensionArea, 0, secondTerminatorIdx - firstTerminatorIdx - 1 ); parseExtensionArea( extensionArea ); // skip second terminator offset = secondTerminatorIdx + 1; return offset; }
|
public int deserialize(byte[] inbuf, int offset) throws UnsupportedEncodingException { fileIndex = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; fileSize = IOUtil.deserializeIntLE(inbuf, offset); offset += 4; // Handle Gnotella termination of single null terminated file names right // this prevents strange results like a filename of 44khz which is meta // data of gnotella. // search for first null terminator int firstTerminatorIdx = offset; while ( inbuf[firstTerminatorIdx] != (byte) 0 ) { firstTerminatorIdx++; } // extract the file name try { fileName = new String( inbuf, offset, firstTerminatorIdx - offset, "UTF-8" ); } catch ( UnsupportedEncodingException exp ) { NLogger.error(NLoggerNames.GLOBAL, exp ); throw new RuntimeException( exp ); } int secondTerminatorIdx = firstTerminatorIdx + 1; // skip terminator //Find second null terminator. while ( inbuf[secondTerminatorIdx] != (byte) 0 ) { secondTerminatorIdx++; } // parse out extension data byte[] extensionArea = new byte[ secondTerminatorIdx - firstTerminatorIdx - 1 ]; System.arraycopy( inbuf, firstTerminatorIdx + 1, extensionArea, 0, secondTerminatorIdx - firstTerminatorIdx - 1 ); parseExtensionArea( extensionArea ); // skip second terminator offset = secondTerminatorIdx + 1; return offset; }
| 1,115,913
|
private void sendQueryRoutingTable() { boolean isUltrapeer = hostMgr.isUltrapeer(); // check if we are a shilded leaf node or a Ultrapeer. // Forwarding QRT is not wanted otherwise. if ( !( hostMgr.isShieldedLeafNode() || isUltrapeer ) ) { return; } Host[] hosts = hostsContainer.getUltrapeerConnections(); // lazy initialize if needed. QueryRoutingTable currentTable = null; QueryRoutingTable lastSentTable; for (int i = 0; i < hosts.length; i++) { // first check if we are a UP or leaf supports QRP if ( isUltrapeer ) { if ( !hosts[i].isUPQueryRoutingSupported() ) { continue; } } else { if ( !hosts[i].isQueryRoutingSupported() ) { continue; } } if ( !hosts[i].isQRTableUpdateRequired() ) { continue; } NLogger.debug( MsgManager.class, "Updating QRTable for: " + hosts[i] ); if ( currentTable == null ) {// lazy initialize updateLocalQueryRoutingTable(); currentTable = lastSentQueryRoutingTable; } lastSentTable = hosts[i].getLastSentRoutingTable(); Iterator msgIterator = QueryRoutingTable.buildRouteTableUpdateMsgIterator( currentTable, lastSentTable ); RouteTableUpdateMsg msg; while ( msgIterator.hasNext() ) { msg = (RouteTableUpdateMsg) msgIterator.next(); hosts[i].queueMessageToSend( msg ); } // when setting the last sent routing table the next routing // table update time is set. hosts[i].setLastSentRoutingTable( currentTable ); } }
|
private void sendQueryRoutingTable() { boolean isUltrapeer = hostMgr.isUltrapeer(); // check if we are a shilded leaf node or a Ultrapeer. // Forwarding QRT is not wanted otherwise. if ( !( hostMgr.isShieldedLeafNode() || isUltrapeer ) ) { return; } Host[] hosts = hostsContainer.getUltrapeerConnections(); // lazy initialize if needed. QueryRoutingTable currentTable = null; QueryRoutingTable lastSentTable; for (int i = 0; i < hosts.length; i++) { // first check if we are a UP or leaf supports QRP if ( isUltrapeer ) { if ( !hosts[i].isUPQueryRoutingSupported() ) { continue; } } else { if ( !hosts[i].isQueryRoutingSupported() ) { continue; } } if ( !hosts[i].isQRTableUpdateRequired() ) { continue; } NLogger.debug( MsgManager.class, "Updating QRTable for: " + hosts[i] ); if ( currentTable == null ) {// lazy initialize updateLocalQueryRoutingTable(); currentTable = lastSentQueryRoutingTable; } lastSentTable = hosts[i].getLastSentRoutingTable(); Iterator msgIterator = QueryRoutingTable.buildRouteTableUpdateMsgIterator( currentTable, lastSentTable ); RouteTableUpdateMsg msg; while ( msgIterator.hasNext() ) { msg = (RouteTableUpdateMsg) msgIterator.next(); hosts[i].queueMessageToSend( msg ); } // when setting the last sent routing table the next routing // table update time is set. hosts[i].setLastSentRoutingTable( currentTable ); } }
| 1,115,914
|
private void sendQueryRoutingTable() { boolean isUltrapeer = hostMgr.isUltrapeer(); // check if we are a shilded leaf node or a Ultrapeer. // Forwarding QRT is not wanted otherwise. if ( !( hostMgr.isShieldedLeafNode() || isUltrapeer ) ) { return; } Host[] hosts = hostsContainer.getUltrapeerConnections(); // lazy initialize if needed. QueryRoutingTable currentTable = null; QueryRoutingTable lastSentTable; for (int i = 0; i < hosts.length; i++) { // first check if we are a UP or leaf supports QRP if ( isUltrapeer ) { if ( !hosts[i].isUPQueryRoutingSupported() ) { continue; } } else { if ( !hosts[i].isQueryRoutingSupported() ) { continue; } } if ( !hosts[i].isQRTableUpdateRequired() ) { continue; } NLogger.debug( MsgManager.class, "Updating QRTable for: " + hosts[i] ); if ( currentTable == null ) {// lazy initialize updateLocalQueryRoutingTable(); currentTable = lastSentQueryRoutingTable; } lastSentTable = hosts[i].getLastSentRoutingTable(); Iterator msgIterator = QueryRoutingTable.buildRouteTableUpdateMsgIterator( currentTable, lastSentTable ); RouteTableUpdateMsg msg; while ( msgIterator.hasNext() ) { msg = (RouteTableUpdateMsg) msgIterator.next(); hosts[i].queueMessageToSend( msg ); } // when setting the last sent routing table the next routing // table update time is set. hosts[i].setLastSentRoutingTable( currentTable ); } }
|
private void sendQueryRoutingTable() { boolean isUltrapeer = hostMgr.isUltrapeer(); // check if we are a shilded leaf node or a Ultrapeer. // Forwarding QRT is not wanted otherwise. if ( !( hostMgr.isShieldedLeafNode() || isUltrapeer ) ) { return; } Host[] hosts = hostsContainer.getUltrapeerConnections(); // lazy initialize if needed. QueryRoutingTable currentTable = null; QueryRoutingTable lastSentTable; for (int i = 0; i < hosts.length; i++) { // first check if we are a UP or leaf supports QRP if ( isUltrapeer ) { if ( !hosts[i].isUPQueryRoutingSupported() ) { continue; } } else { if ( !hosts[i].isQueryRoutingSupported() ) { continue; } } if ( !hosts[i].isQRTableUpdateRequired() ) { continue; } NLogger.debug( MsgManager.class, "Updating QRTable for: " + hosts[i] ); if ( currentTable == null ) {// lazy initialize updateLocalQueryRoutingTable(); currentTable = lastSentQueryRoutingTable; } lastSentTable = hosts[i].getLastSentRoutingTable(); Iterator<RouteTableUpdateMsg> msgIterator = QueryRoutingTable.buildRouteTableUpdateMsgIterator( currentTable, lastSentTable ); RouteTableUpdateMsg msg; while ( msgIterator.hasNext() ) { msg = (RouteTableUpdateMsg) msgIterator.next(); hosts[i].queueMessageToSend( msg ); } // when setting the last sent routing table the next routing // table update time is set. hosts[i].setLastSentRoutingTable( currentTable ); } }
| 1,115,915
|
private void sendQueryRoutingTable() { boolean isUltrapeer = hostMgr.isUltrapeer(); // check if we are a shilded leaf node or a Ultrapeer. // Forwarding QRT is not wanted otherwise. if ( !( hostMgr.isShieldedLeafNode() || isUltrapeer ) ) { return; } Host[] hosts = hostsContainer.getUltrapeerConnections(); // lazy initialize if needed. QueryRoutingTable currentTable = null; QueryRoutingTable lastSentTable; for (int i = 0; i < hosts.length; i++) { // first check if we are a UP or leaf supports QRP if ( isUltrapeer ) { if ( !hosts[i].isUPQueryRoutingSupported() ) { continue; } } else { if ( !hosts[i].isQueryRoutingSupported() ) { continue; } } if ( !hosts[i].isQRTableUpdateRequired() ) { continue; } NLogger.debug( MsgManager.class, "Updating QRTable for: " + hosts[i] ); if ( currentTable == null ) {// lazy initialize updateLocalQueryRoutingTable(); currentTable = lastSentQueryRoutingTable; } lastSentTable = hosts[i].getLastSentRoutingTable(); Iterator msgIterator = QueryRoutingTable.buildRouteTableUpdateMsgIterator( currentTable, lastSentTable ); RouteTableUpdateMsg msg; while ( msgIterator.hasNext() ) { msg = (RouteTableUpdateMsg) msgIterator.next(); hosts[i].queueMessageToSend( msg ); } // when setting the last sent routing table the next routing // table update time is set. hosts[i].setLastSentRoutingTable( currentTable ); } }
|
private void sendQueryRoutingTable() { boolean isUltrapeer = hostMgr.isUltrapeer(); // check if we are a shilded leaf node or a Ultrapeer. // Forwarding QRT is not wanted otherwise. if ( !( hostMgr.isShieldedLeafNode() || isUltrapeer ) ) { return; } Host[] hosts = hostsContainer.getUltrapeerConnections(); // lazy initialize if needed. QueryRoutingTable currentTable = null; QueryRoutingTable lastSentTable; for (int i = 0; i < hosts.length; i++) { // first check if we are a UP or leaf supports QRP if ( isUltrapeer ) { if ( !hosts[i].isUPQueryRoutingSupported() ) { continue; } } else { if ( !hosts[i].isQueryRoutingSupported() ) { continue; } } if ( !hosts[i].isQRTableUpdateRequired() ) { continue; } NLogger.debug( MsgManager.class, "Updating QRTable for: " + hosts[i] ); if ( currentTable == null ) {// lazy initialize updateLocalQueryRoutingTable(); currentTable = lastSentQueryRoutingTable; } lastSentTable = hosts[i].getLastSentRoutingTable(); Iterator msgIterator = QueryRoutingTable.buildRouteTableUpdateMsgIterator( currentTable, lastSentTable ); RouteTableUpdateMsg msg; while ( msgIterator.hasNext() ) { msg = msgIterator.next(); hosts[i].queueMessageToSend( msg ); } // when setting the last sent routing table the next routing // table update time is set. hosts[i].setLastSentRoutingTable( currentTable ); } }
| 1,115,916
|
public void pingHost( Host host, byte ttl ) { // Send ping msg. PingMsg pingMsg = new PingMsg(); pingMsg.getHeader().setTTL( ttl ); checkAndAddToPingRoutingTable( pingMsg.getHeader().getMsgID(), Host.LOCAL_HOST ); if ( NLogger.isDebugEnabled( NLoggerNames.OUTGOING_MESSAGES ) ) NLogger.debug( NLoggerNames.OUTGOING_MESSAGES, "Queueing Ping: " + pingMsg.getDebugString() + " - " + pingMsg.getHeader().getDebugString() + " - Host: " + host.toString() ); host.queueMessageToSend( pingMsg ); }
|
public void pingHost( Host host ) { // Send ping msg. PingMsg pingMsg = new PingMsg(); pingMsg.getHeader().setTTL( ttl ); checkAndAddToPingRoutingTable( pingMsg.getHeader().getMsgID(), Host.LOCAL_HOST ); if ( NLogger.isDebugEnabled( NLoggerNames.OUTGOING_MESSAGES ) ) NLogger.debug( NLoggerNames.OUTGOING_MESSAGES, "Queueing Ping: " + pingMsg.getDebugString() + " - " + pingMsg.getHeader().getDebugString() + " - Host: " + host.toString() ); host.queueMessageToSend( pingMsg ); }
| 1,115,918
|
public void pingHost( Host host, byte ttl ) { // Send ping msg. PingMsg pingMsg = new PingMsg(); pingMsg.getHeader().setTTL( ttl ); checkAndAddToPingRoutingTable( pingMsg.getHeader().getMsgID(), Host.LOCAL_HOST ); if ( NLogger.isDebugEnabled( NLoggerNames.OUTGOING_MESSAGES ) ) NLogger.debug( NLoggerNames.OUTGOING_MESSAGES, "Queueing Ping: " + pingMsg.getDebugString() + " - " + pingMsg.getHeader().getDebugString() + " - Host: " + host.toString() ); host.queueMessageToSend( pingMsg ); }
|
public void pingHost( Host host, byte ttl ) { // Send ping msg. PingMsg pingMsg = new PingMsg(); pingMsg.getHeader().setTTL( ttl ); checkAndAddToPingRoutingTable( pingMsg.getHeader().getMsgID(), Host.LOCAL_HOST ); if ( NLogger.isDebugEnabled( NLoggerNames.OUTGOING_MESSAGES ) ) NLogger.debug( NLoggerNames.OUTGOING_MESSAGES, "Queueing Ping: " + pingMsg.getDebugString() + " - " + pingMsg.getHeader().getDebugString() + " - Host: " + host.toString() ); host.queueMessageToSend( pingMsg ); }
| 1,115,919
|
public synchronized RunT getLastSuccessfulBuild() { RunT r = getLastBuild(); // temporary hack till we figure out what's causing this bug while(r!=null && r.getResult()==null && (r.isBuilding() || r.getResult().isWorseThan(Result.UNSTABLE))) r=r.getPreviousBuild(); return r; }
|
public synchronized RunT getLastSuccessfulBuild() { RunT r = getLastBuild(); // temporary hack till we figure out what's causing this bug while(r!=null && (r.isBuilding() || r.getResult()==null || r.getResult().isWorseThan(Result.UNSTABLE))) r=r.getPreviousBuild(); return r; }
| 1,115,921
|
private void saveAs() { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"xml"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "XML"); fileChooser.setFileFilter(saveFileFilter); 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.toXML()); out.close(); currentFile = file; displayRecipe(); } catch (Exception e) { showError(e); } } else { Debug.print("Save command cancelled by user.\n"); } }
|
private void saveAs() { // Show save dialog; this method does // not return until the dialog is closed String[] ext = {"xml"}; sbFileFilter saveFileFilter = new sbFileFilter(ext, "StrangeBrew XML"); fileChooser.setFileFilter(saveFileFilter); 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.toXML()); out.close(); currentFile = file; displayRecipe(); } catch (Exception e) { showError(e); } } else { Debug.print("Save command cancelled by user.\n"); } }
| 1,115,923
|
private NodeFactory() {}
|
public NodeFactory(XJep xj) {this.xj=xj;}
| 1,115,925
|
private LocalSeismogramImpl getSeismogram(URL seisurl) throws IOException, FissuresException { Object obj = urlToLSMap.get(seisurl); if (obj instanceof SoftReference) { Object ref = ((SoftReference)obj).get(); if (ref != null) { obj = ref; } else { urlToLSMap.remove(seisurl); obj = null; } } if (obj != null) { return (LocalSeismogramImpl)obj; } LocalSeismogramImpl seis; String fileName = seisurl.getFile(); if (fileName.substring(fileName.length() - 3, fileName.length()).equals("psn")){ PSNDataFile psnData = new PSNDataFile(fileName); seis = PSNToFissures.getSeismograms(psnData)[0]; } else{ SacTimeSeries sac = new SacTimeSeries(); sac.read(new DataInputStream(new BufferedInputStream(seisurl.openStream()))); seis = SacToFissures.getSeismogram(sac); } // set channel id correctly if extra info stored in Aux data Object netBegin = getAuxillaryData(NETWORK_BEGIN); if (netBegin != null && netBegin instanceof String) { seis.channel_id.network_id.begin_time.date_time = (String)netBegin; } Object chanBegin = getAuxillaryData(CHANNEL_BEGIN); if (chanBegin != null && chanBegin instanceof String) { seis.channel_id.begin_time.date_time = (String)chanBegin; } addToCache(seisurl, seis); return seis; }
|
private LocalSeismogramImpl getSeismogram(URL seisurl) throws IOException, FissuresException { Object obj = urlToLSMap.get(seisurl); if (obj instanceof SoftReference) { Object ref = ((SoftReference)obj).get(); if (ref != null) { obj = ref; } else { urlToLSMap.remove(seisurl); obj = null; } } if (obj != null) { return (LocalSeismogramImpl)obj; } LocalSeismogramImpl seis; String fileName = seisurl.getFile(); if (fileName.substring(fileName.length() - 3, fileName.length()).equals("psn")){ PSNDataFile psnData = new PSNDataFile(fileName); seis = PSNToFissures.getSeismograms(psnData)[0]; } else{ SacTimeSeries sac = new SacTimeSeries(); sac.read(new DataInputStream(new BufferedInputStream(seisurl.openStream()))); seis = SacToFissures.getSeismogram(sac); } // set channel id correctly if extra info stored in Aux data Object netBegin = getAuxillaryData(NETWORK_BEGIN); if (netBegin != null && netBegin instanceof String) { seis.channel_id.network_id.begin_time.date_time = (String)netBegin; } Object chanBegin = getAuxillaryData(CHANNEL_BEGIN); if (chanBegin != null && chanBegin instanceof String) { seis.channel_id.begin_time.date_time = (String)chanBegin; } addToCache(seisurl, seis); return seis; }
| 1,115,926
|
private LocalSeismogramImpl getSeismogram(URL seisurl) throws IOException, FissuresException { Object obj = urlToLSMap.get(seisurl); if (obj instanceof SoftReference) { Object ref = ((SoftReference)obj).get(); if (ref != null) { obj = ref; } else { urlToLSMap.remove(seisurl); obj = null; } } if (obj != null) { return (LocalSeismogramImpl)obj; } LocalSeismogramImpl seis; String fileName = seisurl.getFile(); if (fileName.substring(fileName.length() - 3, fileName.length()).equals("psn")){ PSNDataFile psnData = new PSNDataFile(fileName); seis = PSNToFissures.getSeismograms(psnData)[0]; } else{ SacTimeSeries sac = new SacTimeSeries(); sac.read(new DataInputStream(new BufferedInputStream(seisurl.openStream()))); seis = SacToFissures.getSeismogram(sac); } // set channel id correctly if extra info stored in Aux data Object netBegin = getAuxillaryData(NETWORK_BEGIN); if (netBegin != null && netBegin instanceof String) { seis.channel_id.network_id.begin_time.date_time = (String)netBegin; } Object chanBegin = getAuxillaryData(CHANNEL_BEGIN); if (chanBegin != null && chanBegin instanceof String) { seis.channel_id.begin_time.date_time = (String)chanBegin; } addToCache(seisurl, seis); return seis; }
|
private LocalSeismogramImpl getSeismogram(URL seisurl) throws IOException, FissuresException { Object obj = urlToLSMap.get(seisurl); if (obj instanceof SoftReference) { Object ref = ((SoftReference)obj).get(); if (ref != null) { obj = ref; } else { urlToLSMap.remove(seisurl); obj = null; } } if (obj != null) { return (LocalSeismogramImpl)obj; } LocalSeismogramImpl seis; String fileName = seisurl.getFile(); if (fileName.substring(fileName.length() - 3, fileName.length()).equals("psn")){ PSNDataFile psnData = new PSNDataFile(fileName); seis = PSNToFissures.getSeismograms(psnData)[0]; } else{ SacTimeSeries sac = new SacTimeSeries(); sac.read(new DataInputStream(new BufferedInputStream(seisurl.openStream()))); seis = SacToFissures.getSeismogram(sac); } // set channel id correctly if extra info stored in Aux data Object netBegin = getAuxillaryData(NETWORK_BEGIN); if (netBegin != null && netBegin instanceof String) { seis.channel_id.network_id.begin_time.date_time = (String)netBegin; } Object chanBegin = getAuxillaryData(CHANNEL_BEGIN); if (chanBegin != null && chanBegin instanceof String) { seis.channel_id.begin_time.date_time = (String)chanBegin; } addToCache(seisurl, seis); return seis; }
| 1,115,927
|
public boolean pollSCMChanges( TaskListener listener ) { if(scm==null) return false; // no SCM FilePath workspace = getWorkspace(); if(!workspace.exists()) return false; try { // TODO: do this by using the right slave return scm.pollChanges(this, new Launcher(listener), workspace, listener ); } catch (IOException e) { e.printStackTrace(listener.fatalError(e.getMessage())); return false; } }
|
public boolean pollSCMChanges( TaskListener listener ) { if(scm==null) { listener.getLogger().println("No SCM"); return false; } // no SCM FilePath workspace = getWorkspace(); if(!workspace.exists()) return false; try { // TODO: do this by using the right slave return scm.pollChanges(this, new Launcher(listener), workspace, listener ); } catch (IOException e) { e.printStackTrace(listener.fatalError(e.getMessage())); return false; } }
| 1,115,931
|
public boolean pollSCMChanges( TaskListener listener ) { if(scm==null) return false; // no SCM FilePath workspace = getWorkspace(); if(!workspace.exists()) return false; try { // TODO: do this by using the right slave return scm.pollChanges(this, new Launcher(listener), workspace, listener ); } catch (IOException e) { e.printStackTrace(listener.fatalError(e.getMessage())); return false; } }
|
public boolean pollSCMChanges( TaskListener listener ) { if(scm==null) return false; // no SCM FilePath workspace = getWorkspace(); if(!workspace.exists()) { listener.getLogger().println("No workspace is available, so can't check for updates."); listener.getLogger().println("Scheduling a new build to get a workspace."); return true; } try { // TODO: do this by using the right slave return scm.pollChanges(this, new Launcher(listener), workspace, listener ); } catch (IOException e) { e.printStackTrace(listener.fatalError(e.getMessage())); return false; } }
| 1,115,932
|
public int compareTo(Constant c) { return ((Comparable) value).compareTo((Comparable) c.value); }
|
public int compareTo(Constant c) { return ((Comparable) value).compareTo(c.value); }
| 1,115,933
|
public String getOpenFilename() { myOpenFileDialog.open(); return myOpenFileDialog.getFileName(); }
|
public String getOpenFilename() { myOpenFileDialog.open(); return myOpenFileDialog.getFilterPath().concat("/").concat( myOpenFileDialog.getFileName()); }
| 1,115,934
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.