bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
final private boolean jj_3R_33() { if (jj_scan_token(LSQ)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_33() { if (jj_scan_token(LSQ)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,618
final private boolean jj_3R_34() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_34() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,619
final private boolean jj_3R_35() { if (jj_scan_token(STRING_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_35() { if (jj_scan_token(STRING_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,620
final private boolean jj_3R_36() { if (jj_3R_38()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_36() { if (jj_3R_38()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,621
final private boolean jj_3R_37() { if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_37() { if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,622
final private boolean jj_3R_38() { Token xsp; xsp = jj_scanpos; if (jj_3R_40()) { jj_scanpos = xsp; if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_38() { Token xsp; xsp = jj_scanpos; if (jj_3R_40()) { jj_scanpos = xsp; if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,623
final private boolean jj_3R_39() { Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3_6()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_39() { Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3_6()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,624
final private boolean jj_3R_40() { if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_40() { if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,625
final private boolean jj_3R_9() { Token xsp; xsp = jj_scanpos; if (jj_3_2()) { jj_scanpos = xsp; if (jj_3_3()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3R_9() { Token xsp; xsp = jj_scanpos; if (jj_3_2()) { jj_scanpos = xsp; if (jj_3_3()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,626
final private boolean jj_3_1() { if (jj_3R_9()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_1() { if (jj_3R_9()) return true; return false; }
1,116,627
final private boolean jj_3_2() { if (jj_3R_10()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_2() { if (jj_3R_10()) return true; return false; }
1,116,628
final private boolean jj_3_3() { if (jj_3R_11()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_3() { if (jj_3R_11()) return true; return false; }
1,116,629
final private boolean jj_3_4() { Token xsp; xsp = jj_scanpos; if (jj_3_5()) { jj_scanpos = xsp; if (jj_3R_12()) { jj_scanpos = xsp; if (jj_3R_13()) { jj_scanpos = xsp; if (jj_3R_14()) { jj_scanpos = xsp; if (jj_3R_15()) { jj_scanpos = xsp; if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_4() { Token xsp; xsp = jj_scanpos; if (jj_3_5()) { jj_scanpos = xsp; if (jj_3R_12()) { jj_scanpos = xsp; if (jj_3R_13()) { jj_scanpos = xsp; if (jj_3R_14()) { jj_scanpos = xsp; if (jj_3R_15()) { jj_scanpos = xsp; if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,630
final private boolean jj_3_5() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_5() { if (jj_3R_17()) return true; return false; }
1,116,631
final private boolean jj_3_6() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_6() { if (jj_3R_17()) return true; return false; }
1,116,632
final private boolean jj_3_7() { Token xsp; xsp = jj_scanpos; lookingAhead = true; jj_semLA = (getToken(1).kind == INDENTIFIER1 || getToken(1).kind == INDENTIFIER2) && jep.funTab.containsKey(getToken(1).image); lookingAhead = false; if (!jj_semLA || jj_3R_18()) { jj_scanpos = xsp; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_7() { Token xsp; xsp = jj_scanpos; lookingAhead = true; jj_semLA = (getToken(1).kind == INDENTIFIER1 || getToken(1).kind == INDENTIFIER2) && jep.funTab.containsKey(getToken(1).image); lookingAhead = false; if (!jj_semLA || jj_3R_18()) { jj_scanpos = xsp; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
1,116,633
final private boolean jj_3_8() { if (jj_3R_9()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
final private boolean jj_3_8() { if (jj_3R_9()) return true; return false; }
1,116,634
public DefaultEntity createDefaultEntity(String alias) { Home home = homeCreator.homeFactory(alias); Entity entity = entityCreator.entityFactory(home, alias); DefaultEntity defaultEntity = entityCreator.defaultEntityFactory(entity); return defaultEntity; }
public DefaultEntity createDefaultEntity(String alias) { Home home = homeCreator.homeFactory(alias); Entity entity = entityCreator.entityFactory(home, alias); DefaultEntity defaultEntity = entityCreator.defaultEntityFactory(entity); return defaultEntity; }
1,116,635
public Recipe readRecipe(File input) { myRecipe = new Recipe(); // File f = new File(path); FileInputStream in = null; try { in = new FileInputStream(input); } catch (FileNotFoundException e) { e.printStackTrace(); } String s = ""; long l, l2; float fl; int x; try { // read in the name - 82 bytes s = readString(in, 82); Debug.print("Recipe name: " + s); myRecipe.setName(s); // get the various sizes long hopCount = readLong(in); Debug.print("Hop count: " + hopCount); long maltCount = readLong(in); Debug.print("Malt count: " + maltCount); long extraCount = readLong(in); Debug.print("Extra count: " + extraCount); fl = readFloat(in); in.skip(3); Debug.print("Batch size: " + fl); fl = readFloat(in); Debug.print("Wort size: " + fl); myRecipe.setVolUnits("gal"); myRecipe.setPostBoil(fl); in.skip(8); fl = readFloat(in); Debug.print("%effic: " + fl*100); myRecipe.setEfficiency(fl*100); x = readInt(in); Debug.print("Boil time: " + x); myRecipe.setBoilMinutes(x); in.skip(8); // Style s = readString(in, 55); s = readString(in, 55); Debug.print("Style: " + s ); myRecipe.setStyle(s.trim()); // let's skip to start of hops in.skip(921); // lets try to read the hops : 635 bytes for (int i = 0; i < hopCount; i++) { Hop h = new Hop(); s = readString(in, 55); Debug.print(""); Debug.print("Hop name: " + s); h.setName(s); fl = readFloat(in); Debug.print("Alpha: " + fl); h.setAlpha(fl); in.skip(22); x = readInt(in); Debug.print("Form: " + x); in.skip(4); String descr = ""; s = readString(in, 155); Debug.print("Descr: " + s); descr = "Description: " + s.trim() + "\n"; s = readString(in, 55); Debug.print("Origin: " + s); descr += "Origin: " + s.trim() + "\n"; s = readString(in, 155); Debug.print("Use: " + s); descr += "Use: " + s.trim() + "\n"; s = readString(in, 165); Debug.print("Substitutes: " + s); descr += "Substitutes: " + s.trim() + "\n"; h.setDescription(descr); in.skip(9); fl = readFloat(in); Debug.print("Amount: " + fl); h.setAmount(fl); h.setUnits("oz"); x = readInt(in); Debug.print("Min:" + x); h.setMinutes(x); myRecipe.addHop(h); in.skip(5); } // lets try to read the malts for (int i = 0; i < maltCount; i++) { Fermentable m = new Fermentable(); s = readString(in, 55); Debug.print(""); Debug.print("Malt name: " + s); m.setName(s.trim()); s = readString(in, 55); Debug.print("Mfg: " + s); s = readString(in, 55); Debug.print("Origin: " + s); x = readInt(in); String type = ""; switch (x) { case 1 : type = "grain"; break; case 2 : type = "extract"; m.setMashed(false); break; case 3 : type = "sugar"; m.setMashed(false); break; case 4 : type = "other"; } Debug.print("Type: " + type); String type2 = ""; x = readInt(in); switch (x) { case 0 : { if (type.equals("extract")) type2 = "LME"; else if (type.equals("grain") || type.equals("sugar")) type2 = "Mustmash = no"; m.setMashed(false); break; } case 1 : { if (type.equals("extract")) type2 = "DME"; else if (type.equals("grain") || type.equals("sugar")) type2 = "Mustmash = yes"; m.setMashed(true); break; } } Debug.print("Type2: " + type2); fl = readFloat(in); Debug.print("pppg: " + fl); m.setPppg(fl); fl = readFloat(in); Debug.print("srm: " + fl); m.setLov(fl); in.skip(20); String descr = ""; s = readString(in, 155); Debug.print("uses: " + s); descr = "Uses: " + s + "\n"; s = readString(in, 159); Debug.print("comments: " + s); descr += "Comments: " + s + "\n"; m.setDescription(descr); in.skip(12); fl = readFloat(in); Debug.print("amount: " + fl); m.setAmount(fl); m.setUnits("lb"); myRecipe.addMalt(m); in.skip(4); } for (int i = 0; i < extraCount; i++) { Misc m = new Misc(); s = readString(in, 55); Debug.print("Extra: " + s); m.setName(s); String type = ""; x = readInt(in); switch (x) { case 0 : type = "spice"; break; case 1 : type = "fruit"; break; case 2 : type = "coffee"; break; case 3 : type = "other"; break; case 4 : type = "fining"; break; case 5 : type = "herb"; break; } Debug.print("Type: " + type); m.setType(type); l = readLong(in); Debug.print("Time: " + l); String use = ""; x = readInt(in); switch (x) { case 0 : use = "Boil"; break; case 1 : use = "Primary"; break; case 2 : use = "Mash"; break; } Debug.print("Use: " + use); m.setStage(use); in.skip(1); String units = ""; x = readInt(in); switch (x) { case 0 : units = "oz"; break; case 1 : units = "g"; break; case 2 : units = "lb"; break; case 3 : units = "tsp"; break; case 4 : units = "Tbs"; break; case 5 : units = "cups"; break; case 6 : units = "Single"; break; } Debug.print("Units: " + units); m.setUnits(units); fl = readFloat(in); Debug.print("Amount: " + fl); m.setAmount(fl); s = readString(in, 222); Debug.print("Usage: " + s); m.setDescription(s); s = readString(in, 155); Debug.print("Comments: " + s); m.setComments(s); myRecipe.addMisc(m); in.skip(145); } // yeast: 473 Yeast y = new Yeast(); String descr = ""; s = readString(in, 55); Debug.print("Yeast: " + s); descr = s.trim(); s = readString(in, 55); Debug.print("Mfg: " + s); descr = s.trim() + " " + descr; String s2 = readString(in, 25); Debug.print("Num: " + s2); descr = s.trim() + " " + s2.trim() + " " + descr; y.setName(descr); in.skip(2); descr = ""; s = readString(in, 155); Debug.print("Flavour: " + s); descr = "Flavour: " + s.trim() + "\n"; s = readString(in, 159); Debug.print("Comment: " + s); descr += "Comments: " + s.trim() + "\n"; y.setDescription(descr); myRecipe.setYeast(y); in.skip(22); // skip water in.skip(106); // skip ? in.skip(113); // regular mash in.skip(9); for (int j=0; j<5; j++){ l = readLong(in); Debug.print(j + " rest Temp: " + l); l2 = readLong(in); Debug.print(j + "rest Min: " + l2); String stepType="alpha"; switch (j){ case 0 : stepType = "acid"; break; case 1: stepType = "protein"; break; case 2: stepType = "beta"; break; case 3: stepType = "alpha"; break; case 4: stepType = "mashout"; break; } if (l > 0){ myRecipe.mash.addStep(stepType, new Double(l).doubleValue(), new Double(l).doubleValue(), "f", "infusion", new Double(l2).intValue(), 0); } } l = readLong(in); Debug.print("Sparge rest Temp: " + l); l2 = readLong(in); Debug.print("Sparge rest Min: " + l2); // TODO: set sparge time & temp in.skip(5); // notes: s = readString(in, 4028); Debug.print("Notes: " + s); s = readString(in, 4283); Debug.print("Awards: " + s); // skip other stuff in.skip(175); // Custom Mash // in.skip(62); long mashCount = readLong(in); Debug.print("Mash steps: " + mashCount); in.skip(11); for (int i = 0; i < mashCount; i++) { s = readString(in, 253); Debug.print("step: " + s); l = readLong(in); Debug.print("start: " + l); l = readLong(in); Debug.print("end: " + l); l = readLong(in); Debug.print("infuse temp: " + l); l = readLong(in); Debug.print("min: " + l); l = readLong(in); Debug.print("stop time: " + l); in.skip(19); } } catch (Exception e){ e.printStackTrace(); } try { in.close(); } catch (IOException e) { e.printStackTrace(); } return myRecipe; }
public Recipe readRecipe(File input) { myRecipe = new Recipe(); // File f = new File(path); FileInputStream in = null; try { in = new FileInputStream(input); } catch (FileNotFoundException e) { e.printStackTrace(); } String s = ""; long l, l2; float fl; int x; try { // read in the name - 82 bytes s = readString(in, 82); Debug.print("Recipe name: " + s); myRecipe.setName(s); // get the various sizes long hopCount = readLong(in); Debug.print("Hop count: " + hopCount); long maltCount = readLong(in); Debug.print("Malt count: " + maltCount); long extraCount = readLong(in); Debug.print("Extra count: " + extraCount); fl = readFloat(in); in.skip(3); Debug.print("Batch size: " + fl); fl = readFloat(in); Debug.print("Wort size: " + fl); myRecipe.setVolUnits("gal"); myRecipe.setPostBoil(fl); in.skip(8); fl = readFloat(in); Debug.print("%effic: " + fl*100); myRecipe.setEfficiency(fl*100); x = readInt(in); Debug.print("Boil time: " + x); myRecipe.setBoilMinutes(x); in.skip(8); // Style s = readString(in, 55); s = readString(in, 55); Debug.print("Style: " + s ); myRecipe.setStyle(s.trim()); // let's skip to start of hops in.skip(921); // lets try to read the hops : 635 bytes for (int i = 0; i < hopCount; i++) { Hop h = new Hop(); s = readString(in, 55); Debug.print(""); Debug.print("Hop name: " + s); h.setName(s); fl = readFloat(in); Debug.print("Alpha: " + fl); h.setAlpha(fl); in.skip(22); x = readInt(in); Debug.print("Form: " + x); in.skip(4); String descr = ""; s = readString(in, 155); Debug.print("Descr: " + s); descr = "Description: " + s.trim() + "\n"; s = readString(in, 55); Debug.print("Origin: " + s); descr += "Origin: " + s.trim() + "\n"; s = readString(in, 155); Debug.print("Use: " + s); descr += "Use: " + s.trim() + "\n"; s = readString(in, 165); Debug.print("Substitutes: " + s); descr += "Substitutes: " + s.trim() + "\n"; h.setDescription(descr); in.skip(9); fl = readFloat(in); Debug.print("Amount: " + fl); h.setAmount(fl); h.setUnits("oz"); x = readInt(in); Debug.print("Min:" + x); h.setMinutes(x); myRecipe.addHop(h); in.skip(5); } // lets try to read the malts for (int i = 0; i < maltCount; i++) { Fermentable m = new Fermentable(); s = readString(in, 55); Debug.print(""); Debug.print("Malt name: " + s); m.setName(s.trim()); s = readString(in, 55); Debug.print("Mfg: " + s); s = readString(in, 55); Debug.print("Origin: " + s); x = readInt(in); String type = ""; switch (x) { case 1 : type = "grain"; break; case 2 : type = "extract"; m.setMashed(false); break; case 3 : type = "sugar"; m.setMashed(false); break; case 4 : type = "other"; } Debug.print("Type: " + type); String type2 = ""; x = readInt(in); switch (x) { case 0 : { if (type.equals("extract")) type2 = "LME"; else if (type.equals("grain") || type.equals("sugar")) type2 = "Mustmash = no"; m.setMashed(false); break; } case 1 : { if (type.equals("extract")) type2 = "DME"; else if (type.equals("grain") || type.equals("sugar")) type2 = "Mustmash = yes"; m.setMashed(true); break; } } Debug.print("Type2: " + type2); fl = readFloat(in); Debug.print("pppg: " + fl); m.setPppg(fl); fl = readFloat(in); Debug.print("srm: " + fl); m.setLov(fl); in.skip(20); String descr = ""; s = readString(in, 155); Debug.print("uses: " + s); descr = "Uses: " + s + "\n"; s = readString(in, 159); Debug.print("comments: " + s); descr += "Comments: " + s + "\n"; m.setDescription(descr); in.skip(12); fl = readFloat(in); Debug.print("amount: " + fl); m.setAmount(fl); m.setUnits("lb"); myRecipe.addMalt(m); in.skip(4); } for (int i = 0; i < extraCount; i++) { Misc m = new Misc(); s = readString(in, 55); Debug.print("Extra: " + s); m.setName(s); String type = ""; x = readInt(in); switch (x) { case 0 : type = "spice"; break; case 1 : type = "fruit"; break; case 2 : type = "coffee"; break; case 3 : type = "other"; break; case 4 : type = "fining"; break; case 5 : type = "herb"; break; } Debug.print("Type: " + type); m.setType(type); l = readLong(in); Debug.print("Time: " + l); String use = ""; x = readInt(in); switch (x) { case 0 : use = "Boil"; break; case 1 : use = "Primary"; break; case 2 : use = "Mash"; break; } Debug.print("Use: " + use); m.setStage(use); in.skip(1); String units = ""; x = readInt(in); switch (x) { case 0 : units = "oz"; break; case 1 : units = "g"; break; case 2 : units = "lb"; break; case 3 : units = "tsp"; break; case 4 : units = "Tbs"; break; case 5 : units = "cups"; break; case 6 : units = "Single"; break; } Debug.print("Units: " + units); m.setUnits(units); fl = readFloat(in); Debug.print("Amount: " + fl); m.setAmount(fl); s = readString(in, 222); Debug.print("Usage: " + s); m.setDescription(s); s = readString(in, 155); Debug.print("Comments: " + s); m.setComments(s); myRecipe.addMisc(m); in.skip(145); } // yeast: 473 Yeast y = new Yeast(); String descr = ""; s = readString(in, 55); Debug.print("Yeast: " + s); descr = s.trim(); s = readString(in, 55); Debug.print("Mfg: " + s); descr = s.trim() + " " + descr; String s2 = readString(in, 25); Debug.print("Num: " + s2); descr = s.trim() + " " + s2.trim() + " " + descr; y.setName(descr); in.skip(2); descr = ""; s = readString(in, 155); Debug.print("Flavour: " + s); descr = "Flavour: " + s.trim() + "\n"; s = readString(in, 159); Debug.print("Comment: " + s); descr += "Comments: " + s.trim() + "\n"; y.setDescription(descr); myRecipe.setYeast(y); in.skip(22); // skip water in.skip(106); // skip ? in.skip(113); // regular mash in.skip(9); for (int j=0; j<5; j++){ l = readLong(in); Debug.print(j + " rest Temp: " + l); l2 = readLong(in); Debug.print(j + "rest Min: " + l2); String stepType="alpha"; switch (j){ case 0 : stepType = "acid"; break; case 1: stepType = "protein"; break; case 2: stepType = "beta"; break; case 3: stepType = "alpha"; break; case 4: stepType = "mashout"; break; } if (l > 0){ myRecipe.mash.addStep(stepType, new Double(l).doubleValue(), new Double(l).doubleValue(), "infusion", new Double(l2).intValue(), 0); } } l = readLong(in); Debug.print("Sparge rest Temp: " + l); l2 = readLong(in); Debug.print("Sparge rest Min: " + l2); // TODO: set sparge time & temp in.skip(5); // notes: s = readString(in, 4028); Debug.print("Notes: " + s); s = readString(in, 4283); Debug.print("Awards: " + s); // skip other stuff in.skip(175); // Custom Mash // in.skip(62); long mashCount = readLong(in); Debug.print("Mash steps: " + mashCount); in.skip(11); for (int i = 0; i < mashCount; i++) { s = readString(in, 253); Debug.print("step: " + s); l = readLong(in); Debug.print("start: " + l); l = readLong(in); Debug.print("end: " + l); l = readLong(in); Debug.print("infuse temp: " + l); l = readLong(in); Debug.print("min: " + l); l = readLong(in); Debug.print("stop time: " + l); in.skip(19); } } catch (Exception e){ e.printStackTrace(); } try { in.close(); } catch (IOException e) { e.printStackTrace(); } return myRecipe; }
1,116,637
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
private void reload() { try { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
1,116,638
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
1,116,639
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
1,116,640
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); ); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); catch (IOException e1) { e1.printStackTrace(); // but ignore synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000;
1,116,641
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } }
1,116,642
public Division installWithDefaults(String alias) { try { DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); } Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; } catch (Exception e) { throw new RuntimeException("Installation with defaults failed ", e); } }
public Division installWithDefaults(String alias) { try { DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); } Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; } catch (Exception e) { throw new RuntimeException("Installation with defaults failed ", e); } }
1,116,644
public Division installWithDefaults(String alias) { try { DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); } Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; } catch (Exception e) { throw new RuntimeException("Installation with defaults failed ", e); } }
public Division installWithDefaults(String alias) { try { DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); } Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; } catch (Exception e) { throw new RuntimeException("Installation with defaults failed ", e); } }
1,116,645
public boolean test(ASTFunNode node, Node[] children) { if(node.getOperator()==opSet.getMultiply()) { // x * x -> true if(tu.isVariable(children[0]) && tu.isVariable(children[1])) { if(tu.getName(children[0]).equals(tu.getName(children[1]))) return true; else return false; } // x^n * x if(tu.getOperator(children[0]) == opSet.getPower() && tu.isVariable(children[0].jjtGetChild(0)) && tu.isVariable(children[1])) { if(tu.getName(children[0].jjtGetChild(0)).equals(tu.getName(children[1]))) return true; else return false; } if(tu.isVariable(children[0]) && tu.getOperator(children[1]) == opSet.getPower() && tu.isVariable(children[1].jjtGetChild(0))) { if(tu.getName(children[0]).equals(tu.getName(children[1].jjtGetChild(0)))) return true; else return false; } } return false; }
public boolean test(ASTFunNode node, Node[] children) { if(node.getOperator()==opSet.getMultiply()) { // x * x -> true if(tu.isVariable(children[0]) && tu.isVariable(children[1])) { if(tu.getName(children[0]).equals(tu.getName(children[1]))) return true; return false; } // x^n * x if(tu.getOperator(children[0]) == opSet.getPower() && tu.isVariable(children[0].jjtGetChild(0)) && tu.isVariable(children[1])) { if(tu.getName(children[0].jjtGetChild(0)).equals(tu.getName(children[1]))) return true; return false; } if(tu.isVariable(children[0]) && tu.getOperator(children[1]) == opSet.getPower() && tu.isVariable(children[1].jjtGetChild(0))) { if(tu.getName(children[0]).equals(tu.getName(children[1].jjtGetChild(0)))) return true; return false; } } return false; }
1,116,646
public Collection find(String query, Object values) { if (logger.isDebugEnabled()) { logger.debug("\n Finding object with query "+query); } return queryAssembler( query, values).list(); }
public Collection find(String query, Object values) { if (logger.isDebugEnabled()) { logger.debug("\n Finding object with query "+query); } if (values instanceof Object[]) { return queryAssembler(query, values).list(); } return this.getHibernateTemplate().find(query, values); }
1,116,647
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(30, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,649
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(30, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,650
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(30, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,651
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,652
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,653
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(30, 20)); collectTxt.setSize(30, 20); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,654
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(30, 20)); postBoilTxt.setSize(30, 20); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,655
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
private void initGUI() { try { 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}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { 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:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 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"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { 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"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { 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"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { 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"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(30, 20)); finalVolTxt.setSize(30, 20); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } }
1,116,656
public MatrixOperatorSet() { super(); OP_ADD.setPFMC(new MAdd()); OP_SUBTRACT.setPFMC(new MSubtract()); // TODO fix commutatitivity for matrix mult. How? OP_MULTIPLY.setPFMC(new MMultiply()); OP_POWER.setPFMC(new MPower()); OP_UMINUS.setPFMC(new MUMinus()); OP_DOT.setPFMC(new MDot()); OP_CROSS.setPFMC(new ExteriorProduct()); OP_ASSIGN.setPFMC(new MAssign()); }
public MatrixOperatorSet() { super(); OP_ADD.setPFMC(new MAdd()); OP_SUBTRACT.setPFMC(new MSubtract()); // TODO fix commutatitivity for matrix mult. How? OP_MULTIPLY.setPFMC(new MMultiply()); OP_POWER.setPFMC(new MPower()); OP_UMINUS.setPFMC(new MUMinus()); OP_DOT.setPFMC(new MDot()); OP_CROSS= new XOperator("^^","^",new ExteriorProduct(),XOperator.BINARY+XOperator.RIGHT,((XOperator) OP_CROSS).getPrecedence()); OP_ASSIGN.setPFMC(new MAssign()); }
1,116,657
public void endElement(String namespaceURI, String sName, // simple name String qName // qualified name ) throws SAXException { if (importType == "STRANGEBREW") { if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("FERMENTABLES")) { m.setDescription(descrBuf); descrBuf = ""; r.addMalt(m); m = null; } else if (qName.equalsIgnoreCase("MALT")) { m.setName(descrBuf); descrBuf = ""; } else if (qName.equalsIgnoreCase("HOP")) { h.setName(descrBuf); descrBuf = ""; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("HOPS")) { h.setDescription(descrBuf); descrBuf = ""; r.addHop(h); h = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("MISC")) { misc.setDescription(descrBuf); descrBuf = ""; r.addMisc(misc); misc = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("NOTES")) { r.addNote(note); note = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("MASH")) { r.mash.addStep(type, startTemp, endTemp, "F", method, minutes, rampMin); } // there's a problem with having two elements named "NOTES" : else if (qName.equalsIgnoreCase("FERMENTABLS") || qName.equalsIgnoreCase("HOPS") || qName.equalsIgnoreCase("DETAILS") || qName.equalsIgnoreCase("MISC") || (qName.equalsIgnoreCase("NOTES") && !currentList.equalsIgnoreCase("DETAILS")) ) { currentList = ""; } else if (qName.equalsIgnoreCase("NAME") && currentList.equalsIgnoreCase("DETAILS")) { r.setName(buffer); buffer=""; } } else if (importType == "QBREW"){ if (qName.equalsIgnoreCase("GRAIN")){ r.addMalt(m); m = null; } else if (qName.equalsIgnoreCase("HOP")){ r.addHop(h); h = null; } else if (qName.equalsIgnoreCase("title")){ r.setName(buffer); buffer = ""; } } }
public void endElement(String namespaceURI, String sName, // simple name String qName // qualified name ) throws SAXException { if (importType == "STRANGEBREW") { if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("FERMENTABLES")) { m.setDescription(descrBuf); descrBuf = ""; r.addMalt(m); m = null; } else if (qName.equalsIgnoreCase("MALT")) { m.setName(descrBuf); descrBuf = ""; } else if (qName.equalsIgnoreCase("HOP")) { h.setName(descrBuf); descrBuf = ""; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("HOPS")) { h.setDescription(descrBuf); descrBuf = ""; r.addHop(h); h = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("MISC")) { misc.setDescription(descrBuf); descrBuf = ""; r.addMisc(misc); misc = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("NOTES")) { r.addNote(note); note = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("MASH")) { r.mash.addStep(type, startTemp, endTemp, method, minutes, rampMin); } // there's a problem with having two elements named "NOTES" : else if (qName.equalsIgnoreCase("FERMENTABLS") || qName.equalsIgnoreCase("HOPS") || qName.equalsIgnoreCase("DETAILS") || qName.equalsIgnoreCase("MISC") || (qName.equalsIgnoreCase("NOTES") && !currentList.equalsIgnoreCase("DETAILS")) ) { currentList = ""; } else if (qName.equalsIgnoreCase("NAME") && currentList.equalsIgnoreCase("DETAILS")) { r.setName(buffer); buffer=""; } } else if (importType == "QBREW"){ if (qName.equalsIgnoreCase("GRAIN")){ r.addMalt(m); m = null; } else if (qName.equalsIgnoreCase("HOP")){ r.addHop(h); h = null; } else if (qName.equalsIgnoreCase("title")){ r.setName(buffer); buffer = ""; } } }
1,116,658
public MatrixValueI calcValue(MatrixValueI res, MatrixValueI inputs[]) throws ParseException { Object out; if(inputs.length == 2) { Object lastObj = inputs[1]; Object firstObj = inputs[0]; double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double diff = last-first; int steps = 1+(int) diff; out=genRange(first,1.0,steps); } else if(inputs.length == 3) { Object incObj = inputs[2]; Object lastObj = inputs[1]; Object firstObj = inputs[0]; double inc = ((Number) incObj).doubleValue(); double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double diff = (last-first)/inc; int steps = 1+(int) diff; out=genRange(first,inc,steps); } else if(inputs.length == 4) { Object stepsObj = inputs[4]; Object incObj = inputs[3]; Object lastObj = inputs[2]; Object firstObj = inputs[0]; int steps = ((Number) stepsObj).intValue(); double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double inc = (last-first)/(steps-1); out=genRange(first,inc,steps); } else throw new ParseException("Range:only a maximum of four arguments can be specified"); throw new ParseException("VRange: calcValue not implemented"); }
public MatrixValueI calcValue(MatrixValueI res, MatrixValueI inputs[]) throws ParseException { Object out; if(inputs.length == 2) { Object lastObj = inputs[1]; Object firstObj = inputs[0]; double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double diff = last-first; int steps = 1+(int) diff; out=genRange(first,1.0,steps); } else if(inputs.length == 3) { Object incObj = inputs[2]; Object lastObj = inputs[1]; Object firstObj = inputs[0]; double inc = ((Number) incObj).doubleValue(); double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double diff = (last-first)/inc; int steps = 1+(int) diff; out=genRange(first,inc,steps); } else if(inputs.length == 4) { Object stepsObj = inputs[4]; Object lastObj = inputs[2]; Object firstObj = inputs[0]; int steps = ((Number) stepsObj).intValue(); double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double inc = (last-first)/(steps-1); out=genRange(first,inc,steps); } else throw new ParseException("Range:only a maximum of four arguments can be specified"); throw new ParseException("VRange: calcValue not implemented"); }
1,116,659
public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; }
public Dimensions calcDim(Dimensions l,Dimensions r) throws ParseException { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; }
1,116,660
public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; }
public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); break; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); break; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); break; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; }
1,116,661
public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; }
public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else throw new ParseException("Dimensions for multiply do not match: "+l+" "+r); default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else throw new ParseException("Dimensions for multiply do not match: "+l+" "+r); case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else throw new ParseException("Dimensions for multiply do not match: "+l+" "+r); default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } throw new ParseException("Dimensions for multiply do not match: "+l+" "+r); }
1,116,663
private String findBranch(String revision) { if(revision==null) return null; // defensive check for (Entry<String,String> e : branches.entrySet()) { if(revision.startsWith(e.getKey())) return e.getValue(); } return null; }
private String findBranch(String revision) { if(revision==null) return null; // defensive check for (Entry<String,String> e : branches.entrySet()) { if(revision.startsWith(e.getKey()) && revision.substring(e.getKey().length()).indexOf('.')==-1) return e.getValue(); } return null; }
1,116,664
public synchronized Job doCreateJob( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return null; String name = req.getParameter("name").trim(); String className = req.getParameter("type"); String mode = req.getParameter("mode"); try { checkGoodName(name); } catch (ParseException e) { sendError(e,req,rsp); return null; } if(getJob(name)!=null) { sendError("A job already exists with the name '"+name+"'",req,rsp); return null; } if(mode==null) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } Job result; if(mode.equals("newJob")) { if(className==null) { // request forged? rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } try { Class type = Class.forName(className); // redirect to the project config screen result = createProject(type, name); } catch (ClassNotFoundException e) { e.printStackTrace(); rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } } else { Job src = getJob(req.getParameter("from")); if(src==null) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } result = createProject(src.getClass(),name); // copy config Copy cp = new Copy(); cp.setProject(new org.apache.tools.ant.Project()); cp.setTofile(result.getConfigFile()); cp.setFile(src.getConfigFile()); cp.setOverwrite(true); cp.execute(); // reload from the new config result = Job.load(this,result.root); result.nextBuildNumber = 1; // reset the next build number jobs.put(name,result); } rsp.sendRedirect(req.getContextPath()+'/'+result.getUrl()+"configure"); return result; }
public synchronized Job doCreateJob( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return null; String name = req.getParameter("name").trim(); String className = req.getParameter("type"); String mode = req.getParameter("mode"); try { checkGoodName(name); } catch (ParseException e) { sendError(e,req,rsp); return null; } if(getJob(name)!=null) { sendError("A job already exists with the name '"+name+"'",req,rsp); return null; } if(mode==null) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } Job result; if(mode.equals("newJob")) { if(className==null) { // request forged? rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } try { Class type = Class.forName(className); // redirect to the project config screen result = createProject(type, name); } catch (ClassNotFoundException e) { e.printStackTrace(); rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } } else { Job src = getJob(req.getParameter("from")); if(src==null) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } result = createProject(src.getClass(),name); // copy config Copy cp = new Copy(); cp.setProject(new org.apache.tools.ant.Project()); cp.setTofile(result.getConfigFile()); cp.setFile(src.getConfigFile()); cp.setOverwrite(true); cp.execute(); // reload from the new config result = Job.load(this,result.root); result.nextBuildNumber = 1; // reset the next build number jobs.put(name,result); } rsp.sendRedirect2(req.getContextPath()+'/'+result.getUrl()+"configure"); return result; }
1,116,665
public synchronized void doCreateView( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return; String name = req.getParameter("name"); try { checkGoodName(name); } catch (ParseException e) { sendError(e, req, rsp); return; } View v = new View(this, name); if(views==null) views = new Vector<View>(); views.add(v); save(); // redirect to the config screen rsp.sendRedirect("./"+v.getUrl()+"configure"); }
public synchronized void doCreateView( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return; String name = req.getParameter("name"); try { checkGoodName(name); } catch (ParseException e) { sendError(e, req, rsp); return; } View v = new View(this, name); if(views==null) views = new Vector<View>(); views.add(v); save(); // redirect to the config screen rsp.sendRedirect2("./"+v.getUrl()+"configure"); }
1,116,666
public synchronized void doDoFingerprintCheck( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { try { // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // Parse the request List<FileItem> items = upload.parseRequest(req); rsp.sendRedirect(req.getContextPath()+"/fingerprint/"+ getDigestOf(items.get(0).getInputStream())+'/'); // if an error occur and we fail to do this, it will still be cleaned up // when GC-ed. for (FileItem item : items) item.delete(); } catch (FileUploadException e) { throw new ServletException(e); // I'm not sure what the implication of this } }
public synchronized void doDoFingerprintCheck( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { try { // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // Parse the request List<FileItem> items = upload.parseRequest(req); rsp.sendRedirect2(req.getContextPath()+"/fingerprint/"+ getDigestOf(items.get(0).getInputStream())+'/'); // if an error occur and we fail to do this, it will still be cleaned up // when GC-ed. for (FileItem item : items) item.delete(); } catch (FileUploadException e) { throw new ServletException(e); // I'm not sure what the implication of this } }
1,116,667
public synchronized void doLoginEntry( StaplerRequest req, StaplerResponse rsp ) throws IOException { rsp.sendRedirect(req.getContextPath()+"/"); }
public synchronized void doLoginEntry( StaplerRequest req, StaplerResponse rsp ) throws IOException { rsp.sendRedirect2(req.getContextPath()+"/"); }
1,116,668
public synchronized void doLogout( StaplerRequest req, StaplerResponse rsp ) throws IOException { HttpSession session = req.getSession(false); if(session!=null) session.invalidate(); rsp.sendRedirect(req.getContextPath()+"/"); }
public synchronized void doLogout( StaplerRequest req, StaplerResponse rsp ) throws IOException { HttpSession session = req.getSession(false); if(session!=null) session.invalidate(); rsp.sendRedirect2(req.getContextPath()+"/"); }
1,116,669
public synchronized void doReload( StaplerRequest req, StaplerResponse rsp ) throws IOException { if(!Hudson.adminCheck(req,rsp)) return; load(); rsp.sendRedirect(req.getContextPath()+"/"); }
public synchronized void doReload( StaplerRequest req, StaplerResponse rsp ) throws IOException { if(!Hudson.adminCheck(req,rsp)) return; load(); rsp.sendRedirect2(req.getContextPath()+"/"); }
1,116,670
public int hashCode() { int result = 17; long xl = Double.doubleToLongBits(this.re); long yl = Double.doubleToLongBits(this.im); int xi = (int)(xl^(xl>>32)); int yi = (int)(yl^(yl>>32)); result = 37*result+xi; result = 37*result+xi; return result; }
public int hashCode() { int result = 17; long xl = Double.doubleToLongBits(this.re); long yl = Double.doubleToLongBits(this.im); int xi = (int)(xl^(xl>>32)); int yi = (int)(yl^(yl>>32)); result = 37*result+yi; result = 37*result+yi; return result; }
1,116,671
public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); }
public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getColour(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); }
1,116,672
public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); }
public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getColour(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); }
1,116,673
public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); }
public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); }
1,116,674
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
public static void main(final String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
1,116,675
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
public static void main(String[] args) { BasicConfigurator.configure(); final OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
1,116,676
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); }
1,116,677
public boolean configure(HttpServletRequest req) { boolean r = true; int i; String[] names = req.getParameterValues("ant_name"); String[] homes = req.getParameterValues("ant_home"); int len = Math.min(names.length,homes.length); AntInstallation[] insts = new AntInstallation[len]; for( i=0; i<len; i++ ) { if(names[i].length()==0) continue; insts[i] = new AntInstallation(names[i],homes[i]); } getProperties().put("installations",insts); save(); return r; }
public boolean configure(HttpServletRequest req) { boolean r = true; int i; String[] names = req.getParameterValues("ant_name"); String[] homes = req.getParameterValues("ant_home"); int len; if(names!=null && homes!=null) len = Math.min(names.length,homes.length); else len = 0; AntInstallation[] insts = new AntInstallation[len]; for( i=0; i<len; i++ ) { if(names[i].length()==0) continue; insts[i] = new AntInstallation(names[i],homes[i]); } getProperties().put("installations",insts); save(); return r; }
1,116,679
public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); }
public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); }
1,116,680
public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); }
public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } else if( param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } } else if (param1 instanceof Number) { if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } else if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } else if( param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } } else if (param1 instanceof Number) { if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } else if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); }
1,116,681
public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); }
public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); }
1,116,682
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); // 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 = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(result); }
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); // 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 = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(result); }
1,116,683
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); // 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 = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(result); }
public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); // 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 = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(result); }
1,116,684
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
1,116,688
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
1,116,689
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
1,116,690
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
1,116,691
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = records[i].getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
1,116,692
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = records[i].getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } }
1,116,693
public void createDownload( String uriStr ) throws URIException { if ( uriStr.length() == 0 ) { return; } URI uri = new URI( uriStr, true ); // dont add already downloading urns. MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) { swarmingMgr.addFileToDownload( uri ); } }
public void createDownload( String uriStr ) throws URIException { if ( uriStr.length() == 0 ) { return; } URI uri = new URI( uriStr, true ); // dont add already downloading urns. MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) { swarmingMgr.addFileToDownload( uri ); } }
1,116,694
public void createDownload( String uriStr ) throws URIException { if ( uriStr.length() == 0 ) { return; } URI uri = new URI( uriStr, true ); // dont add already downloading urns. MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) { swarmingMgr.addFileToDownload( uri ); } }
public void createDownload( String uriStr ) throws URIException { if ( uriStr.length() == 0 ) { return; } URI uri = new URI( uriStr, true ); // dont add already downloading urns. MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) { MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN(magnetData); if ( swarmingMgr.isURNDownloaded( urn ) ) { return; } if ( shareService.isURNShared( urn ) ) { return; } } }
1,116,695
public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; }
public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; }
1,116,697
public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; }
public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return SBStringUtils.format(data.getHopIBU(row), 1); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; }
1,116,698
public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; }
public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return SBStringUtils.format(data.getHopCostPerU(row), 2); } } catch (Exception e) { }; return ""; }
1,116,699
public String getIconColor() { if(result!=null) { // already built if(result==Result.SUCCESS) return "blue"; if(result== Result.UNSTABLE) return "yellow"; else return "red"; } // a new build is in progress String baseColor; if(previousBuild==null) baseColor = "grey"; else baseColor = previousBuild.getIconColor(); return baseColor +"_anime"; }
public String getIconColor() { if(!isBuilding()) { // already built if(result==Result.SUCCESS) return "blue"; if(result== Result.UNSTABLE) return "yellow"; else return "red"; } // a new build is in progress String baseColor; if(previousBuild==null) baseColor = "grey"; else baseColor = previousBuild.getIconColor(); return baseColor +"_anime"; }
1,116,700
public boolean checkout(Build build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile) throws IOException { boolean result; if(useUpdate && isUpdatable(workspace.getLocal(),listener)) { result = update(launcher,workspace,listener); if(!result) return false; } else { workspace.deleteContents(); StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { ArgumentListBuilder cmd = new ArgumentListBuilder(); cmd.add(DESCRIPTOR.getSvnExe(),"co","-q","--non-interactive"); if(username!=null) cmd.add("--username",username); if(otherOptions!=null) cmd.add(Util.tokenize(otherOptions)); cmd.add(tokens.nextToken()); result = run(launcher,cmd,listener,workspace); if(!result) return false; } } // write out the revision file PrintWriter w = new PrintWriter(new FileOutputStream(getRevisionFile(build))); try { Map<String,SvnInfo> revMap = buildRevisionMap(workspace,listener); for (Entry<String,SvnInfo> e : revMap.entrySet()) { w.println( e.getKey() +'/'+ e.getValue().revision ); } } finally { w.close(); } return calcChangeLog(build, changelogFile, launcher, listener); }
public boolean checkout(Build build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile) throws IOException { boolean result; if(useUpdate && isUpdatable(workspace,listener)) { result = update(launcher,workspace,listener); if(!result) return false; } else { workspace.deleteContents(); StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { ArgumentListBuilder cmd = new ArgumentListBuilder(); cmd.add(DESCRIPTOR.getSvnExe(),"co","-q","--non-interactive"); if(username!=null) cmd.add("--username",username); if(otherOptions!=null) cmd.add(Util.tokenize(otherOptions)); cmd.add(tokens.nextToken()); result = run(launcher,cmd,listener,workspace); if(!result) return false; } } // write out the revision file PrintWriter w = new PrintWriter(new FileOutputStream(getRevisionFile(build))); try { Map<String,SvnInfo> revMap = buildRevisionMap(workspace,listener); for (Entry<String,SvnInfo> e : revMap.entrySet()) { w.println( e.getKey() +'/'+ e.getValue().revision ); } } finally { w.close(); } return calcChangeLog(build, changelogFile, launcher, listener); }
1,116,701
private boolean isUpdatable(File dir,BuildListener listener) { StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { String url = tokens.nextToken(); File module = new File(dir,getLastPathComponent(url)); File svn = new File(module,".svn/entries"); if(!svn.exists()) { listener.getLogger().println("Checking out a fresh workspace because "+svn+" doesn't exist."); return false; } // check wc-entries/entry/@url synchronized(spf) { try { SAXParser parser = spf.newSAXParser(); Checker checker = new Checker(url); parser.parse(svn,checker); if(!checker.found()) { listener.getLogger().println("Checking out a fresh workspace because the workspace is not "+url); return false; } } catch (ParserConfigurationException e) { // impossible throw new Error(e); } catch (SAXException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } catch (IOException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } } } return true; }
private boolean isUpdatable(FilePath workspace,BuildListener listener) { StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { String url = tokens.nextToken(); File module = new File(dir,getLastPathComponent(url)); File svn = new File(module,".svn/entries"); if(!svn.exists()) { listener.getLogger().println("Checking out a fresh workspace because "+svn+" doesn't exist."); return false; } // check wc-entries/entry/@url synchronized(spf) { try { SAXParser parser = spf.newSAXParser(); Checker checker = new Checker(url); parser.parse(svn,checker); if(!checker.found()) { listener.getLogger().println("Checking out a fresh workspace because the workspace is not "+url); return false; } } catch (ParserConfigurationException e) { // impossible throw new Error(e); } catch (SAXException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } catch (IOException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } } } return true; }
1,116,702
private boolean isUpdatable(File dir,BuildListener listener) { StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { String url = tokens.nextToken(); File module = new File(dir,getLastPathComponent(url)); File svn = new File(module,".svn/entries"); if(!svn.exists()) { listener.getLogger().println("Checking out a fresh workspace because "+svn+" doesn't exist."); return false; } // check wc-entries/entry/@url synchronized(spf) { try { SAXParser parser = spf.newSAXParser(); Checker checker = new Checker(url); parser.parse(svn,checker); if(!checker.found()) { listener.getLogger().println("Checking out a fresh workspace because the workspace is not "+url); return false; } } catch (ParserConfigurationException e) { // impossible throw new Error(e); } catch (SAXException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } catch (IOException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } } } return true; }
private boolean isUpdatable(File dir,BuildListener listener) { StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { String url = tokens.nextToken(); File module = new File(dir,getLastPathComponent(url)); File svn = new File(module,".svn/entries"); if(!svn.exists()) { listener.getLogger().println("Checking out a fresh workspace because "+svn+" doesn't exist."); return false; } // check wc-entries/entry/@url synchronized(spf) { try { SAXParser parser = spf.newSAXParser(); Checker checker = new Checker(url); parser.parse(svn,checker); if(!checker.found()) { listener.getLogger().println("Checking out a fresh workspace because the workspace is not "+url); return false; } } catch (ParserConfigurationException e) { // impossible throw new Error(e); } catch (SAXException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } catch (IOException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } } } return true; }
1,116,703
private boolean isUpdatable(File dir,BuildListener listener) { StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { String url = tokens.nextToken(); File module = new File(dir,getLastPathComponent(url)); File svn = new File(module,".svn/entries"); if(!svn.exists()) { listener.getLogger().println("Checking out a fresh workspace because "+svn+" doesn't exist."); return false; } // check wc-entries/entry/@url synchronized(spf) { try { SAXParser parser = spf.newSAXParser(); Checker checker = new Checker(url); parser.parse(svn,checker); if(!checker.found()) { listener.getLogger().println("Checking out a fresh workspace because the workspace is not "+url); return false; } } catch (ParserConfigurationException e) { // impossible throw new Error(e); } catch (SAXException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } catch (IOException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } } } return true; }
private boolean isUpdatable(File dir,BuildListener listener) { StringTokenizer tokens = new StringTokenizer(modules); while(tokens.hasMoreTokens()) { String url = tokens.nextToken(); File module = new File(dir,getLastPathComponent(url)); File svn = new File(module,".svn/entries"); if(!svn.exists()) { listener.getLogger().println("Checking out a fresh workspace because "+svn+" doesn't exist."); return false; } // check wc-entries/entry/@url synchronized(spf) { try { SAXParser parser = spf.newSAXParser(); Checker checker = new Checker(url); parser.parse(svn,checker); if(!checker.found()) { listener.getLogger().println("Checking out a fresh workspace because the workspace is not "+url); return false; } } catch (ParserConfigurationException e) { // impossible throw new Error(e); } catch (SAXException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } catch (IOException e) { // corrupt file? don't use update to be safe failedToParse(listener, svn, e); return false; } } } return true; }
1,116,704
CaseResult(SuiteResult parent, Element testCase) { String cn = testCase.attributeValue("classname"); if(cn==null) // Maven seems to skip classname, and that shows up in testSuite/@name cn = parent.getName(); className = cn; testName = testCase.attributeValue("name"); errorStackTrace = getError(testCase); }
CaseResult(SuiteResult parent, Element testCase) { String cn = testCase.attributeValue("classname"); if(cn==null) // Maven seems to skip classname, and that shows up in testSuite/@name cn = parent.getName(); className = cn; testName = testCase.attributeValue("name"); errorStackTrace = getError(testCase); }
1,116,706
public String getOpenFilename() { myOpenFileDialog.open(); return myOpenFileDialog.getFilterPath().concat("/").concat( myOpenFileDialog.getFileName()); }
public String getOpenFilename() { myOpenFileDialog.open(); return myOpenFileDialog.getFilterPath().concat("/").concat( myOpenFileDialog.getFileName()); }
1,116,707
private void serveFile(StaplerRequest req, StaplerResponse rsp, File root, boolean serveDirIndex) throws IOException, ServletException { String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); File[] files = f.listFiles(); Arrays.sort(files,FILE_SORTER); req.setAttribute("files",files); req.getView(this,"workspaceDir.jsp").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); // serve the file rsp.setContentType(req.getServletContext().getMimeType(req.getServletPath())); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); in.close(); }
private void serveFile(StaplerRequest req, StaplerResponse rsp, File root, boolean serveDirIndex) throws IOException, ServletException { String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); File[] files = f.listFiles(); Arrays.sort(files,FILE_SORTER); req.setAttribute("files",files); req.getView(this,"workspaceDir.jsp").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); // serve the file rsp.setContentType(req.getServletContext().getMimeType(req.getServletPath())); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); in.close(); }
1,116,710
public void persistPersonalData(PersonalData personalData);
public void persistPersonalData(SecureUserDetails secureUserDetails);
1,116,711
public void mouseReleased(MouseEvent me) { plottableDisplay.setSelectedRectangle(prevx, prevy, me.getX(), me.getY()); }
public void mouseReleased(MouseEvent me) { }
1,116,712
public void run() { Job job = null; activeThreads ++; while(true) { synchronized( ThreadPool.this ) { long startedWaiting = System.currentTimeMillis(); // As long as no jobs are waiting, check to see if it's time to end this thread. while( jobs.isEmpty() ) { // if inactive for too long then give up long timePassed = System.currentTimeMillis() - startedWaiting; long timeLeft = suicideTime - timePassed; if( timeLeft < 0 ) { activeThreads --; return; } try { // wait for a job until we should really be dying ThreadPool.this.wait(timeLeft); } catch (InterruptedException ie) { // don't care why - lets loop till we have something to do } } if( askedToStop ) { activeThreads --; return; } job = jobs.removeFirst(); } try { job.associateThread( this ); setName( job.getJobName() ); job.getRunnable().run(); } catch (Throwable t) { NLogger.error( NLoggerNames.GLOBAL, t, t); } finally { job.releaseAssociateThread(); } setName( "ThreadPool.Worker-" + Integer.toHexString( hashCode() ) ); } }
public void run() { Job job = null; activeThreads ++; while(true) { synchronized( ThreadPool.this ) { long startedWaiting = System.currentTimeMillis(); // As long as no jobs are waiting, check to see if it's time to end this thread. while( jobs.isEmpty() ) { // if inactive for too long then give up long timePassed = System.currentTimeMillis() - startedWaiting; long timeLeft = suicideTime - timePassed; if( timeLeft < 0 ) { activeThreads --; return; } try { // wait for a job until we should really be dying ThreadPool.this.wait(timeLeft); } catch (InterruptedException ie) { // don't care why - lets loop till we have something to do } } if( askedToStop ) { activeThreads --; return; } job = jobs.removeFirst(); } try { job.associateThread( this ); setName( job.getJobName() + "-W" + Integer.toHexString( hashCode() ) ); job.getRunnable().run(); } catch (Throwable t) { NLogger.error( NLoggerNames.GLOBAL, t, t); } finally { job.releaseAssociateThread(); } setName( "ThreadPool.Worker-" + Integer.toHexString( hashCode() ) ); } }
1,116,713
public short getHasUploadedFlag() { parseBody(); return hasUploadedFlag; }
public short getHasUploadedFlag() throws InvalidMessageException { parseBody(); return hasUploadedFlag; }
1,116,714
public short getPushNeededFlag() { parseBody(); return pushNeededFlag; }
public short getPushNeededFlag() throws InvalidMessageException { parseBody(); return pushNeededFlag; }
1,116,715
public DestAddress[] getPushProxyAddresses() { parseBody(); return pushProxyAddresses; }
public DestAddress[] getPushProxyAddresses() throws InvalidMessageException { parseBody(); return pushProxyAddresses; }
1,116,716
public long getRemoteHostSpeed() { parseBody(); return remoteHostSpeed; }
public long getRemoteHostSpeed() throws InvalidMessageException { parseBody(); return remoteHostSpeed; }
1,116,717
public short getServerBusyFlag() { parseBody(); return serverBusyFlag; }
public short getServerBusyFlag() throws InvalidMessageException { parseBody(); return serverBusyFlag; }
1,116,718
public short getUniqueResultCount() { parseBody(); return uniqueResultCount; }
public short getUniqueResultCount() throws InvalidMessageException { parseBody(); return uniqueResultCount; }
1,116,719
public short getUploadSpeedFlag() { parseBody(); return uploadSpeedFlag; }
public short getUploadSpeedFlag() throws InvalidMessageException { parseBody(); return uploadSpeedFlag; }
1,116,720
public String getVendorCode() { parseBody(); return vendorCode; }
public String getVendorCode() throws InvalidMessageException { parseBody(); return vendorCode; }
1,116,721
public boolean isBrowseHostSupported() { parseBody(); return isBrowseHostSupported; }
public boolean isBrowseHostSupported() throws InvalidMessageException { parseBody(); return isBrowseHostSupported; }
1,116,722
public boolean isChatSupported() { parseBody(); return isChatSupported; }
public boolean isChatSupported() throws InvalidMessageException { parseBody(); return isChatSupported; }
1,116,723
private boolean isVendorCodeValid( String vendorCode ) { // verify length if ( vendorCode.length() != 4 ) { return false; } // verify characters for ( int i = 0; i < 4; i++ ) { if ( !XMLUtils.isXmlChar( vendorCode.charAt( i ) ) ) { return false; } } return true; }
private static boolean isVendorCodeValid( String vendorCode ) { // verify length if ( vendorCode.length() != 4 ) { return false; } // verify characters for ( int i = 0; i < 4; i++ ) { if ( !XMLUtils.isXmlChar( vendorCode.charAt( i ) ) ) { return false; } } return true; }
1,116,724
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; int highestAltLocCount = 0; for (int i = 0; i < recordCount; i++) { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; int highestAltLocCount = 0; for (int i = 0; i < recordCount; i++) { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
1,116,725
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
1,116,726
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
1,116,727
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { break; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
1,116,728
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
private void parseBody() { if ( isParsed ) { return; } // Already read the header. int offset = 0; byte n = body[offset++]; short recordCount = (short)(n < 0 ? 256 + n : n); // parsing of port and ip is done on demand in getHostAddress() and // getHostIP() offset += 2; // skip port offset += 4; // skip ip try { long speed = IOUtil.unsignedInt2Long( IOUtil.deserializeIntLE(body, offset) ); remoteHostSpeed = speed; offset += 4; uniqueResultCount = 0; Set<URN> uniqueURNs = new HashSet<URN>(); records = new QueryResponseRecord[ recordCount ]; for (int i = 0; i < recordCount; i++) { QueryResponseRecord rec = new QueryResponseRecord(); offset = rec.deserialize(body, offset); if ( NLogger.isWarnEnabled( QueryResponseMsg.class ) && rec.getAlternateLocations() != null && rec.getAlternateLocations().length > 15 ) { NLogger.warn( QueryResponseMsg.class, "QueryRespRecord with " + rec.getAlternateLocations().length + " alt locs..." ); } records[ i ] = rec; URN urn = rec.getURN(); if ( urn != null ) { uniqueURNs.add( urn ); } else { uniqueResultCount ++; } } uniqueResultCount += uniqueURNs.size(); // Handle Bearshare meta informations. The format is documented in // the GnutellaProtocol04.pdf document pushNeededFlag = QHD_UNKNOWN_FLAG; serverBusyFlag = QHD_UNKNOWN_FLAG; hasUploadedFlag = QHD_UNKNOWN_FLAG; uploadSpeedFlag = QHD_UNKNOWN_FLAG; // GGEP extensions isBrowseHostSupported = false; if ( offset <= (getHeader().getDataLength() - 16 - 4 - 2) ) { // parse meta data // Use ISO encoding for two bytes characters on some platforms. vendorCode = new String( body, offset, 4, "ISO-8859-1"); if ( !isVendorCodeValid( vendorCode ) ) { String hexVendorCode = HexConverter.toHexString( body, offset, 4 ); NLogger.warn(QueryResponseMsg.class, getHeader().getFromHost() + ": Illegal QHD vendor code found: " + vendorCode + " (" + hexVendorCode + "). Body: " + HexConverter.toHexString( body ) ); vendorCode = hexVendorCode; } offset += 4; int openDataLength = IOUtil.unsignedByte2int( body[ offset ] ); offset += 1; // parse upload speed, have uploaded, busy and push if ( openDataLength > 1) { // if we have a flag byte byte flag1 = body[ offset ]; byte flag2 = body[ offset + 1]; // check if push flag is meaningfull do it reversed from other checks if ( ( flag2 & PUSH_NEEDED_MASK ) != 0 ) { if ( ( flag1 & PUSH_NEEDED_MASK ) != 0 ) { pushNeededFlag = QHD_TRUE_FLAG; } else { pushNeededFlag = QHD_FALSE_FLAG; } } // check if server busy flag meaningfull if ((flag1 & SERVER_BUSY_MASK) != 0) { if ( (flag2 & SERVER_BUSY_MASK) != 0 ) { serverBusyFlag = QHD_TRUE_FLAG; } else { serverBusyFlag = QHD_FALSE_FLAG; } } // check if the uploaded flag is meaningfull if ((flag1 & HAS_UPLOADED_MASK) != 0) { if ( (flag2 & HAS_UPLOADED_MASK) != 0 ) { hasUploadedFlag = QHD_TRUE_FLAG; } else { hasUploadedFlag = QHD_FALSE_FLAG; } } if ((flag1 & UPLOAD_SPEED_MASK) != 0 ) { if ( (flag2 & UPLOAD_SPEED_MASK) != 0 ) { uploadSpeedFlag = QHD_TRUE_FLAG; } else { uploadSpeedFlag = QHD_FALSE_FLAG; } } if ((flag1 & GGEP_MASK) != 0 && (flag2 & GGEP_MASK) !=0 ) {// parse GGEP area should follow after open data area but // we can't be sure... int ggepMagicIndex = offset + 2; // search for real magic index while ( ggepMagicIndex < body.length ) { if ( body[ ggepMagicIndex ] == GGEPBlock.MAGIC_NUMBER ) { // found index! break; } ggepMagicIndex ++; } GGEPBlock[] ggepBlocks = null; try { // if there are GGEPs, see if Browse Host supported... ggepBlocks = GGEPBlock.parseGGEPBlocks( body, ggepMagicIndex ); isBrowseHostSupported = GGEPBlock.isExtensionHeaderInBlocks( ggepBlocks, GGEPBlock.BROWSE_HOST_HEADER_ID ); pushProxyAddresses = GGEPExtension.parsePushProxyExtensionData( ggepBlocks ); } catch ( InvalidGGEPBlockException exp ) {// ignore and continue parsing... NLogger.debug(QueryResponseMsg.class, exp, exp ); } } } // skip unknown open data length offset += openDataLength; //Parse private area of Limewire and Shareaza to read out chat //flag. If chatflag is 0x1 chat is supported, if 0x0 its not. int privateDataLength = body.length - offset - 16; if ( privateDataLength > 0 && ( vendorCode.equals("LIME") || vendorCode.equals("RAZA") || vendorCode.equals("PHEX") ) ) { byte flag = body[ offset ]; isChatSupported = ( flag & CHAT_SUPPORTED_MASK ) != 0; } //System.out.println( (mHeader.getDataLen() -16 - 4 -2) + " " + offset + " " + // /*new String( body, offset, mHeader.getDataLen() - offset) + " " +*/ // openDataLength + " " + pushNeededFlag + " " + serverBusyFlag + " " + // uploadSpeedFlag + " " + hasUploadedFlag + " " + vendorCode ); } parseRemoteClientID(); isParsed = true; } catch ( java.io.UnsupportedEncodingException exp ) { return; } }
1,116,729