-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notes
846 lines (749 loc) · 25.1 KB
/
Notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
Code that was removed or commented out, but which may prove useful later on.
Removals:
**************
from MapPanel.java
**************
// private ImageIcon mapImage;
// 2015-05-14 Changed from Image to BufferedImage
// private HashMap<String, PlaceCategory> categories; // Instead of the current ArrayList
from MapPanel.paintComponent(Graphics g)
// g.drawImage(mapImage.getImage(), 0, 0, getWidth(), getHeight(), this);
// getX(), getY(), getWidth(), getHeight()
/*
* test
* unnecessary after setting preferred size in the constructor
*/
/* @Override
// public Dimension getPreferredSize() {
// Dimension d = new Dimension(super.getPreferredSize());
// if (imageMap != null) {
// d.setSize(imageMap.getIconWidth(), imageMap.getIconHeight());
// }
// return d;
// }
*/
Line 150:
/**
* Unused
* @param cats The categories to add to this <code>MapPanel<code>
*/
public void setCategories(Collection<PlaceCategory> cats) {
Iterator<PlaceCategory> iter = cats.iterator();
while (iter.hasNext()) {
placesByCategory.putIfAbsent(iter.next(), new ArrayList<Place>());
}
}
Line 235:
/**
* @return the placesByPosition Map
*/
// public Map<PlacePosition, Place> getAllPlacesByPos() {
// return placesByPosition;
// }
/**
* @return the placesByName Map
*/
// public Map<String, List<Place>> getAllPlacesByName() {
// return placesByName;
// }
Line 312:
// TODO Unused
public void removePlace(Place pl) {
// TODO
String name = pl.getName();
PlacePosition pos = pl.getPosition();
List<Place> li = placesByName.get(name);
Place first = placesByPosition.remove(pos);
boolean second = li.remove(pl);
String liststate = "non-empty ";
if (li.isEmpty()) {
placesByName.remove(name);
liststate = "empty ";
}
boolean third = selectedPlaces.remove(pl);
this.remove(pl);
modified = true;
System.out.println("placesByPosition.remove(pos): " + first + " " + second + " " + liststate + third);
}
// TODO Unused
public Place removePlace(PlacePosition pos) {
// TODO
Place ret = placesByPosition.remove(pos);
if (ret != null) {
modified = true;
}
return ret;
}
Line 369:
// TODO Unused
public void removeSelected() {
System.out.println("removeSlected()...");
Iterator<Place> iter = selectedPlaces.iterator();
while (iter.hasNext()) {
Place p = iter.next();
String name = p.getName();
PlacePosition pos = p.getPosition();
List<Place> li = placesByName.get(name);
Place first = placesByPosition.remove(pos);
boolean second = li.remove(p);
String liststate = "non-empty;";
if (li.isEmpty()) {
placesByName.remove(name);
liststate = "empty;";
}
this.remove(p);
modified = true;
System.out.println(first + " " + second + " " + liststate);
}
selectedPlaces.clear();
revalidate();
}
// public Place addPlace(PlacePosition pos, Place place) {
// Place ret = positionedPlaces.putIfAbsent(pos, place);
// if (ret == null) {
// modified = true;
// }
// return ret;
// }
//
// public void addPlace(Place place) {
// placesByPosition.put(place.getPosition(), place);
// if (namedPlaces.containsKey(place.getName())) {
// namedPlaces.get(place.getName()).add(place);
// } else {
// List<Place> l = new ArrayList<Place>();
// l.add(place);
// namedPlaces.put(place.getName(), l);
// }
// addPlace(place.getPosition(), place);
// modified = true;
// }
public void removePlaces(Collection<Place> places) {
// TODO
boolean first = selectedPlaces.removeAll(places);
Iterator<Place> iter = places.iterator();
while (iter.hasNext()) {
PlacePosition pos = iter.next().getPosition();
placesByPosition.remove(pos);
}
System.out.println(first);
}
public void removePlaces(Collection<Place> places) {
if (places != null) {
Iterator<Place> iter = places.iterator();
// System.out.println("Places at start: " + places);
// System.out.println("PlacesByPosition at start: " + placesByPosition);
// System.out.println("PlacesByName at start: " + placesByName);
// System.out.println("SelectedPlaces at start: " + selectedPlaces);
// int i = 0;
while (iter.hasNext()) {
// System.out.println("Iteration " + i + ": ");
Place p = iter.next();
// System.out.println("Place " + i + ": " + p);
this.removePlace(p);
// if (p.isSelected()) {
//// selectedPlaces.remove(p);
// setSelectedPlace(p, false);
// }
// String name = p.getName();
// placesByName.get(name).remove(p);
// if (placesByName.get(name).isEmpty()) {
// placesByName.remove(name);
// }
// placesByPosition.remove(p.getPosition());
// this.remove(p);
// System.out.println();
// i += 1;
}
modified = true;
}
validate();
}
// public PlaceCategory addCategory(String name, PlaceCategory category) {
// PlaceCategory ret = categories.putIfAbsent(name, category);
// if (ret == null) {
// modified = true;
// }
// return ret;
// }
// public PlaceCategory addCategory(PlaceCategory category) {
// return addCategory(category.getName(), category);
// }
// public PlaceCategory removeCategory(String name) {
// return categories.remove(name);
// }
/**
* @param positionedPlaces the positionedPlaces to set
*/
// public void setPlaces(HashMap<PlacePosition, Place> positionedPlaces) {
// this.places = positionedPlaces;
// }
/**
* @param selectedPlaces the selectedPlaces to set
*/
// public void setSelectedPlaces(HashSet<Place> selectedPlaces) {
// this.selectedPlaces = selectedPlaces;
// }
from MapPanel.saveData(String filePath):
// oos.writeObject(mapImage);
// Save categories
// oos.writeObject(categories);
from MapPanel.saveData(File docfile):
// oos.writeObject(mapImage);
// Save categories
// oos.writeObject(categories);
setPreferredSize(new Dimension(mapImage.getWidth(this), mapImage.getHeight(this)));
from MapPanel.loadData(String filePath):
// mapImage = (Image)ois.readObject();
// Load categories
// this.categories = (ArrayList<PlaceCategory>)ois.readObject();
from MapPanel.loadData(File docfile)
// mapImage = (Image)ois.readObject();
// Load categories
// this.categories = (ArrayList<PlaceCategory>)ois.readObject();
// At the end of the method
// Proved unnecessary
// Iterator<Place> iter = selectedPlaces.iterator();
// while (iter.hasNext()) {
// iter.next().setSelected(true);
// }
**************
from MappedPlaces.java
**************
Line 31:
// public class TestListener implements ActionListener {
//
// @Override
// public void actionPerformed(ActionEvent e) {
// System.out.println(pnlMainPane.toString());
// System.out.println("Categories: " + pnlMainPane.getCategories() + "\nPlaces: " + pnlMainPane.getPlaces());
// System.out.println("ListModel: " + lstmod.toString());
// System.out.println("JList: " + lstCategories.toString());
// HashMap<PlacePosition, Place> pl = pnlMainPane.getPlaces();
// for (Place p : pl.values()) {
// pnlMainPane.add(p);
// }
// validate();
// repaint();
// }
// }
Line 50:
// Test 2015-07-12
// Add JScrollPane around the map
// private JScrollPane spCentralArea;
Line 246:
/**
* @param title
* @param gc
*/
/*
public MappedPlaces(String title, GraphicsConfiguration gc) {
super(title, gc);
// TODO Auto-generated constructor stub
}
*/
from MappedPlaces.MappedPlaces(String title)
// JComponent.setDefaultLocale(currentLocale);
Line 115:
// Test 2015-07-12
// spCentralArea = new JScrollPane(pnlMainPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
// JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// add(spCentralArea, BorderLayout.CENTER);
Line 143:
// pnlTopPane.add(btnTest);
Line 184:
// btnTest.addActionListener(new TestListener());
Line 196:
// Dimension t = pnlTopPane.getPreferredSize();
// Dimension e = pnlEastPane.getPreferredSize();
// Dimension c = pnlMainPane.getPreferredSize();
// setMaximumSize(new Dimension(c.width + e.width, t.height + c.height));
from MappedPlaces.NewMapListener.actionPerformed(ActionEvent aev)
Line 243:
// String filename = imgfile.getName();
// String filename = imgfile.getAbsolutePath();
// bgImage = new ImageIcon(filename);
Line 251:
// centralArea = new JLabel(bgImage);
// centralArea.setIcon(bgImage);
// pnlCenter.add(centralArea);
// MapPanel oldCenter = pnlCenter;
Line 252:
// Test 2015-07-12
// spCentralArea.remove(pnlMainPane);
// remove(spCentralArea);
// pnlMainPane = new MapPanel(bgImage);
// spCentralArea = new JScrollPane(pnlMainPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
// JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// add(spCentralArea, BorderLayout.CENTER);
Line 267:
// lblStatus.setText("Loaded map \"" + imgfile.getName() + "\" from " + imgfile.getPath());
Line 268:
// add(pnlCenter, BorderLayout.CENTER);
// pnlCenter.repaint();
// pnlCenter.validate();
// revalidate();
from MappedPlaces.OpenListener.actionPerformed(ActionEvent aev)
Line 311:
// Test 2015-07-12
// spCentralArea.remove(pnlMainPane);
Line 314:
// spCentralArea.add(pnlMainPane);
Line 315:
// pnlMainPane.loadData(file);
Line 328:
// For testing: test loading of a kart-file
System.out.println("Categories: " + pnlMainPane.getCategories() +
"\nPosPlaces: " + pnlMainPane.getAllPlacesByPos() +
"\nNamedPlaces: " + pnlMainPane.getAllPlacesByName());
Line 329:
// ArrayList<PlaceCategory> categories = pnlMainPane.getCategories();
// lstCategories.setListData(categories.toArray(new PlaceCategory[categories.size()]));
Line 331:
// HashMap<PlacePosition, Place> pl = pnlMainPane.getPositionedPlaces();
// for (Place p : pl.values()) {
// pnlMainPane.add(p);
// }
Line 338:
// lblStatus.setText("Loaded file \"" + file.getName() + "\"");
from MappedPlaces.SaveListener.actionPerformed(ActionEvent aev)
Line 369:
// String filename = "";
Line 383:
// filename = file.getName();
from MappedPlaces$CreatePlaceListener
// public void mouseClicked(MouseEvent mev) {
// // determine click position and create new Position object
// int x = mev.getX();
// int y = mev.getY();
// PlacePosition newPos = new PlacePosition(x, y);
//
// // Determine chosen placeType: read the combobox choice
// String placeType = (String)cbxPlaceTypes.getSelectedItem();
//
// // Determine if a category is selected and which one it is
// PlaceCategory currentCat = null;
// if (lstCategories.getSelectedIndex() != -1) {
// currentCat = lstCategories.getSelectedValue();
// }
//
// // create place of chosen type and category
// Place newPlace;
// if (placeType.equalsIgnoreCase(msgStrings.getString("cbxNamedPlaces"))) { //$NON-NLS-1$
// NamedPlaceAddForm inputFrm = new NamedPlaceAddForm();
// int dlgResult = JOptionPane.showConfirmDialog(MappedPlaces.this, inputFrm,
// msgStrings.getString("strNewNamedPlace"), //$NON-NLS-1$
// JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
// if (dlgResult == JOptionPane.OK_OPTION) {
// String newPlaceName = inputFrm.getName();
// if (newPlaceName == "") { //$NON-NLS-1$
// JOptionPane.showMessageDialog(MappedPlaces.this, msgStrings.getString("msgNewPlaceErr"), //$NON-NLS-1$
// msgStrings.getString("dlgPlaceErrTitle"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
// return;
// }
// // if a category is selected
// if (currentCat != null) {
// // Create Named Place of selected category
// newPlace = new NamedPlace(newPlaceName, newPos, currentCat);
// } else {
// // otherwise create Named Place without category
// newPlace = new NamedPlace(newPlaceName, newPos);
// }
// pnlMainPane.addPlace(newPos, newPlaceName, newPlace);
// lblStatus.setText(msgStrings.getString("msgStatusCreated1") //$NON-NLS-1$
// + newPlace.getName() + msgStrings.getString("msgStatusCreated2")); //$NON-NLS-1$
// newPlace.addMouseListener(placeListener);
// }
// } else if (placeType.equalsIgnoreCase(msgStrings.getString("cbxDescribedPlaces"))) { //$NON-NLS-1$
// DescribedPlaceAddForm inputFrm = new DescribedPlaceAddForm();
// int dlgResult = JOptionPane.showConfirmDialog(MappedPlaces.this, inputFrm,
// msgStrings.getString("strNewDescribedPlace"), //$NON-NLS-1$
// JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
// if (dlgResult == JOptionPane.OK_OPTION) {
// String newPlaceName = inputFrm.getName();
// String newPlaceDescription = inputFrm.getDescription();
// if (newPlaceName == "") { //$NON-NLS-1$
// JOptionPane.showMessageDialog(MappedPlaces.this, msgStrings.getString("msgNewPlaceErr"), //$NON-NLS-1$
// msgStrings.getString("dlgPlaceErrTitle"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
// return;
// }
// if (newPlaceDescription == "") { //$NON-NLS-1$
// JOptionPane.showMessageDialog(MappedPlaces.this,
// msgStrings.getString("msgNewMissingDescription"), //$NON-NLS-1$
// msgStrings.getString("dlgPlaceErrTitle"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
// return;
// }
// // if a category is selected
// if (currentCat != null) {
// // Create Described Place of selected category
// newPlace = new DescribedPlace(newPlaceName, newPos, currentCat, newPlaceDescription);
// } else {
// // otherwise create Described Place without category
// newPlace = new DescribedPlace(newPlaceName, newPos, newPlaceDescription);
// }
// pnlMainPane.addPlace(newPos, newPlaceName, newPlace);
// lblStatus.setText(msgStrings.getString("msgStatusCreated1") //$NON-NLS-1$
// + newPlaceName + msgStrings.getString("msgStatusCreated2")); //$NON-NLS-1$
// newPlace.addMouseListener(placeListener);
// }
// } else {
// JOptionPane.showMessageDialog(MappedPlaces.this,
// msgStrings.getString("msgNoPlaceType"), //$NON-NLS-1$
// msgStrings.getString("msgError"), JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
// }
// if (!(miSave.isEnabled() && miSaveAs.isEnabled())) {
// miSave.setEnabled(true);
// miSaveAs.setEnabled(true);
// }
//
// pnlMainPane.removeMouseListener(placeCreator);
// pnlMainPane.setCursor(Cursor.getDefaultCursor());
// cbxPlaceTypes.addActionListener(chooseType);
// cbxPlaceTypes.setEnabled(true);
// pnlMainPane.revalidate();
// pnlMainPane.repaint();
// }
from MappedPlaces.SearchListener.actionPerformed(ActionEvent aev)
Line 594:
System.out.println("Searching: " + name);
Line 604:
// if (pnlMainPane.getPlacesByName(name) != null) {
// ArrayList<Place> list = new ArrayList<Place>(pnlMainPane.getPlacesByName(name));
// System.out.println(list);
// for (Place p : list) {
// p.setSelected(true);
// pnlMainPane.setSelectedPlace(p, true);
// }
// pnlMainPane.setSelectedPlaces(list);
// } else {
// lblStatus.setText(name + ": " + msgStrings.getString("msgStatusNoSuchPlaces"));
// }
Line 606:
System.out.println(list);
**************
from Place.java
**************
Line 35:
// protected static final float thickness = 2;
from Place.Place(String name, PlacePosition pos, PlaceCategory cat)
Line 69:
// this.folded = true;
Line 71:
// Test 2015-08-01
from Place.paintComponent(Graphics g)
Line 131:
// Color colOut;
// Color colIn;
Line 140:
if (this.category != null)
if (this.category.isHidden())
return;
**************
from Place.java
Latest changes
**************
// Size difference between inner and outer triangle
protected static final int INNER_DISTANCE = 1;
protected int[] xPoints, yPoints, xiPoints, yiPoints, xi2Points, yi2Points;
from the constructor
Line 103:
xiPoints = new int[3];
yiPoints = new int[3];
xiPoints[0] = xPoints[0];
yiPoints[0] = yPoints[0] - INNER_DISTANCE;
xiPoints[1] = xPoints[1] + INNER_DISTANCE;
yiPoints[1] = yPoints[1] + INNER_DISTANCE;
xiPoints[2] = xPoints[2] - INNER_DISTANCE;
yiPoints[2] = yPoints[2] + INNER_DISTANCE;
xi2Points = new int[3];
yi2Points = new int[3];
xi2Points[0] = xPoints[0];
yi2Points[0] = yPoints[0] - INNER_DISTANCE*2;
xi2Points[1] = xPoints[1] + INNER_DISTANCE*2;
yi2Points[1] = yPoints[1] + INNER_DISTANCE*2;
xi2Points[2] = xPoints[2] - INNER_DISTANCE*2;
yi2Points[2] = yPoints[2] + INNER_DISTANCE*2;
from Place.paintComponent(Graphics g)
Line 153:
// g.drawPolygon(xi2Points, yi2Points, 3);
Line 132:
// The points of the triangle are defined in the following order:
// 1 - the lower point, 2 - the upper left corner, 3 - the upper right corner
// int[] xPoints = {triWidth/2, 0, triWidth};
// int[] yPoints = {triHeight, 0, 0};
// int[] xiPoints = {xPoints[0], xPoints[1] + b, xPoints[2] - b};
// int[] yiPoints = {yPoints[0] - b, yPoints[1] + b, yPoints[2] + b};
// int[] xi2Points = {xPoints[0], xPoints[1] + b*2, xPoints[2] - b*2};
// int[] yi2Points = {yPoints[0] - b*2, yPoints[1] + b*2, yPoints[2] + b*2};
// if (category != null) {
// colOut = category.getColor();
// } else {
// colOut = Color.DARK_GRAY;
// }
// int newAlpha = (int) (colOut.getAlpha()*alphaRel);
// colIn = new Color(colOut.getRed(), colOut.getGreen(), colOut.getBlue(), newAlpha);
from Place.toString():
Line 296:
ret += folded ? " folded" : " unfolded";
ret += selected ? " selected" : "";
ret += isVisible() ? " visible" : "";
Alternative (older) paintComponent definition on line 146:
// protected void paintComponent(Graphics g) {
// System.out.print("a1 ");
// if (this.category != null)
// if (category.isHidden())
// return;
// if (!this.isVisible()) {
// return;
// }
// super.paintComponent(g);
// this.setFoldedSize();
// System.out.print("a2 ");
// Color colOut;
// Color colIn;
// // The points of the triangle are defined in the following order:
// // 1 - the lower point, 2 - the upper left corner, 3 - the upper right corner
// int[] xPoints = {triWidth/2, 0, triWidth};
// int[] yPoints = {triHight, 0, 0};
// int[] xiPoints = {xPoints[0], xPoints[1] + d, xPoints[2] - d};
// int[] yiPoints = {yPoints[0] - d, yPoints[1] + d, yPoints[2] + d};
// int[] xi2Points = {xPoints[0], xPoints[1] + d*2, xPoints[2] - d*2};
// int[] yi2Points = {yPoints[0] - d*2, yPoints[1] + d*2, yPoints[2] + d*2};
// if (category != null) {
// colOut = category.getColor();
// } else {
// colOut = Color.DARK_GRAY;
// }
// int newAlpha = (int) (colOut.getAlpha()*alphaRel);
// colIn = new Color(colOut.getRed(), colOut.getGreen(), colOut.getBlue(), newAlpha);
//// colIn = Color.WHITE;
//
// g.setColor(colIn);
// g.fillPolygon(xPoints, yPoints, 3);
// g.setColor(colOut);
// g.drawPolygon(xiPoints, yiPoints, 3);
// g.drawPolygon(xi2Points, yi2Points, 3);
// g.setColor(Color.BLACK);
// g.drawPolygon(xPoints, yPoints, 3);
//
// System.out.print("a3 ");
//
// // Paint a border if this place is selected
// Border selectedBorder = BorderFactory.createLineBorder(Color.GRAY, 1);
// Border unselectedBorder = BorderFactory.createEmptyBorder();
// if (this.selected) {
// System.out.print("a4a ");
// this.setBorder(selectedBorder);
// } else {
// System.out.print("a4b ");
// this.setBorder(unselectedBorder);
// }
// }
Alternative (older) definitions of equals on line 253:
// /* (non-Javadoc)
// * @see java.lang.Object#equals(java.lang.Object)
// */
// @Override
// public boolean equals(Object obj) {
// if (this == obj) {
// return true;
// }
// if (obj == null) {
// return false;
// }
// if (!(obj instanceof Place)) {
// return false;
// }
// Place other = (Place) obj;
// if (category == null) {
// if (other.category != null) {
// return false;
// }
// } else if (!category.equals(other.category)) {
// return false;
// }
// if (name == null) {
// if (other.name != null) {
// return false;
// }
// } else if (!name.equals(other.name)) {
// return false;
// }
// if (position == null) {
// if (other.position != null) {
// return false;
// }
// } else if (!position.equals(other.position)) {
// return false;
// }
// return true;
// }
**************
from Position.java
**************
/*
*
* Move a position to new coordinates:
* newX = x
* newY = y
*/
/*
public void move(int x, int y) {
// TODO
}
*/
/*
*
* Move a position to new coordinates:
* newX = oldX + dx
* newY = oldY + dy
*/
/*
public void translate(int dx, int dy) {
// TODO
}
*/
**************
from Category.java
**************
/**
* @return the hidden
*/
public boolean isHidden() {
return hidden;
}
/**
* @param hidden the hidden to set
*/
public void setHidden(boolean hidden) {
this.hidden = hidden;
}
**************
from NamedPlace.java
**************
from NamedPlace.paintComponent(Graphics g)
Line 77:
// Color col;
// if (category != null) {
// col = category.getColor();
// } else {
// col = Color.DARK_GRAY;
// }
Line 80:
// g.setColor(Color.BLACK);
Line 81:
// Border selectedBorder = BorderFactory.createLineBorder(Color.GRAY, 1);
// Border unselectedBorder = BorderFactory.createEmptyBorder();
Older paintComponent definition on line 89:
// protected void paintComponent(Graphics g) {
// System.out.print("b1 ");
// if (this.folded) {
// System.out.print("b1a ");
// super.paintComponent(g);
// } else {
// System.out.print("b1b ");
// this.setUnfoldedSize();
// Color colOut;
// if (category != null) {
// colOut = category.getColor();
// } else {
// colOut = Color.DARK_GRAY;
// }
// int x0 = this.getX();
// int y0 = this.getY();
// int wi = this.getWidth();
// int hi = this.getHeight();
// g.setColor(colOut);
// g.drawRect(x0+2, y0+2, wi-4, hi-4);
// g.drawString(getName(), x0 + 8, (hi-4)/2);
// System.out.print("b2 ");
// // Paint a border if this place is selected
// Border selectedBorder = BorderFactory.createLineBorder(Color.GRAY, 1);
// Border unselectedBorder = BorderFactory.createEmptyBorder();
// if (this.selected) {
// System.out.print("b3a ");
// this.setBorder(selectedBorder);
// } else {
// System.out.print("b3b ");
// this.setBorder(unselectedBorder);
// }
// }
// }
**************
from DescribedPlace.java
**************
Line 28:
// Test 2015-07-26
// private JTextArea ta;
Line 37:
// private static final Color UNFOLDED_BACKGROUND = Color.YELLOW;
Line 93:
// Test 2015-07-26
// protected void setFoldedSize() {
// this.remove(ta);
// super.setFoldedSize();
// }
from DescribedPlaces.unfold()
Line 98:
// int height = BASIC_HEIGHT * UNFOLDED_HMULT + BORDER_THICKNESS*2;
Line 101:
// if (descriptionSplit == null || descriptionSplit.isEmpty()) {
// descriptionSplit = new ArrayList<String>(StringUtils.wrap(description, fm, width+12));
// }
from DescribedPlaces.paintComponent(Graphics g)
Line 121:
// Test 2015-07-27
// FontMetrics fm = g.getFontMetrics();
// int fontHeight = fm.getHeight();
Line 122:
// g.drawString(getName(), 0 + 8, 0+16);
Line 123:
// g.drawString(description, 0 + 2, 0+32);
from DescribedPlaces.toString()
Line 193:
// String ret = super.toString();
// ret += "\n" + description + "\n";
// return ret;
Older definition of equals on line 201:
// @Override
// public boolean equals(Object other) {
// if (other == null)
// return false;
// if (!(other instanceof DescribedPlace)) {
// return false;
// } else {
// DescribedPlace otherplace = (DescribedPlace) other;
// boolean ret1 = name.equalsIgnoreCase(otherplace.getName())
// && position.equals(otherplace.getPosition())
// && description.equalsIgnoreCase(otherplace.getDescription());
// boolean ret2;
// if (this.category == null && otherplace.getCategory() == null) {
// ret2 = true;
// } else if ((this.category == null && otherplace.getCategory() != null) ||
// (this.category != null && otherplace.getCategory() == null)) {
// ret2 = false;
// } else {
// ret2 = this.category.equals(otherplace.getCategory());
// }
// return ret1 && ret2;
// }
// }
**************
from CategoryListRenderer.java
**************
from CategoryListRenderer.getListCellRendererComponent(JList<? extends Object> list, Object value, int index, boolean isSelected, boolean cellHasFocus):
Line 120:
if (cat.isHidden()) {
setForeground(Color.GRAY);
}
Line 125:
// System.out.println("" + this.getHeight() + " " + d + " " + h);
Line 127:
// setHorizontalAlignment(JLabel.RIGHT);
// setHorizontalTextPosition(JLabel.LEFT);
**************
from DescribedPlaceAddForm.java
**************
from DescribedPlaceAddForm.DescribedPlaceAddForm()
Line 19:
// pnlMiddle.setLayout(new BoxLayout(pnlMiddle, BoxLayout.Y_AXIS));