Project

General

Profile

17.06.2021-tree-body-rendering-refactored-and-fixed-missed-files-added.diff

Vladimir Tsichevski, 06/18/2021 03:33 PM

Download (288 KB)

View differences:

src/com/goldencode/p2j/persist/orm/UnclosablePreparedStatement.java 2021-06-10 11:58:36 +0000
369 369
      this.target.setBlob(parameterIndex, inputStream); }
370 370
   public void setNClob(int parameterIndex, Reader reader) throws SQLException { 
371 371
      this.target.setNClob(parameterIndex, reader); }
372

  
373
   @Override
374
   public String toString()
375
   {
376
      return target.toString();
377
   }
372 378
   
373 379
}
src/com/goldencode/p2j/ui/BrowseColumnWidget.java 2021-06-10 11:58:36 +0000
2659 2659
   /**
2660 2660
    * Sets the BGCOLOR writable attribute.  Private internal version.
2661 2661
    *
2662
    * @param    fgColor
2663
    *           The new value for the FGCOLOR attribute.
2662
    * @param    bgColor
2663
    *           The new value for the BGCOLOR attribute.
2664 2664
    */
2665 2665
   private void setBgColorInt(NumberType bgColor)
2666 2666
   {
src/com/goldencode/p2j/ui/TreeConfig.java 2021-06-17 18:07:04 +0000
95 95
 * @param <N> 
96 96
 *        node type
97 97
 */
98
public abstract class TreeConfig<N extends TreeNodeEntry>
98
public abstract class TreeConfig
99 99
extends WidgetConfigExt
100 100
{
101 101
   /** Node id of the currently selected node */
......
123 123
   public boolean sorted;
124 124

  
125 125
   /** The flat list of tree nodes */
126
   public ArrayList<N> nodes = new ArrayList<>();
126
   public List<TreeNodeEntry> nodes = new ArrayList<>();
127 127

  
128 128
   /** Indentation pixel size */
129 129
   public int indentation;
......
140 140
   /** Flag to toggle expand on ENTER */
141 141
   public boolean expandOnEnter;
142 142

  
143
   /** The current top node */
144
   public int topNode;
143
   /** The current top node ID or -1 if tree is empty */
144
   public int topNode = -1;
145 145

  
146 146
   /** Flag to toggle expand node icons visibility */
147 147
   public boolean showExpandIcon = true;
......
205 205

  
206 206
   /**
207 207
    * Create node entry instance.
208
    * 
208 209
    * @return node entry instance
209 210
    */
210
   protected abstract Supplier<N> createNodeEntry();
211
   protected abstract Supplier<TreeNodeEntry> createNodeEntry();
212
   
211 213
   /**
212 214
    * Create a new config and associate it with the given widget.
213 215
    *
......
309 311
   {
310 312
      super.applyConfig(config);
311 313

  
312
      TreeConfig<N> cfg = (TreeConfig<N>) config;
314
      TreeConfig cfg = (TreeConfig) config;
313 315
      selectedNodeId = cfg.selectedNodeId;
314 316
      textEdit = cfg.textEdit;
315 317
      dragDrop = cfg.dragDrop;
......
369 371
      showExpandIcon       = (booleanAttrs & ATTR_MASK_SHOW_EXPAND_ICON) == ATTR_MASK_SHOW_EXPAND_ICON;
370 372
      removeNodeOnCollapse = (booleanAttrs & ATTR_MASK_REM_NODE_COLLAPSE) == ATTR_MASK_REM_NODE_COLLAPSE;
371 373
      
372
      nodes = new ArrayList<N>((List<N>)readList(in, createNodeEntry()));
374
      nodes = new ArrayList<TreeNodeEntry>(readList(in, createNodeEntry()));
373 375
      scrollNodeCount = in.readInt();
374 376
      draggedNode = in.readInt();
375 377
      draggedOverNode = in.readInt();
src/com/goldencode/p2j/ui/TreeListConfig.java 2021-06-17 18:05:43 +0000
93 93
 * TreeList widget configuration.
94 94
 * @param <N> node entry type
95 95
 */
96
public class TreeListConfig<N extends TreeListNodeEntry>
97
extends TreeConfig<N>
96
public class TreeListConfig
97
extends TreeConfig
98 98
{
99 99
   /** List of column configurations, index 0 is the column showing the tree portion of the widget */
100 100
   public List<Column> columns = new ArrayList<>();
......
189 189
   {
190 190
      super.applyConfig(config);
191 191

  
192
      TreeListConfig<N> cfg = (TreeListConfig<N>) config;
192
      TreeListConfig cfg = (TreeListConfig) config;
193 193
      columns = cfg.columns;
194 194
      fixedColumn = cfg.fixedColumn;
195 195
      showHeader = cfg.showHeader;
......
212 212
   {
213 213
      super.applyConfig(config);
214 214

  
215
      final TreeListConfig<N> cfg = (TreeListConfig<N>) config;
215
      final TreeListConfig cfg = (TreeListConfig) config;
216 216
      fixedColumn = cfg.fixedColumn;
217 217
      showHeader = cfg.showHeader;
218 218
      triggerColumn = cfg.triggerColumn;
......
309 309
    * @return node entry instance
310 310
    */
311 311
   @Override
312
   protected Supplier<N> createNodeEntry()
312
   protected Supplier<TreeNodeEntry> createNodeEntry()
313 313
   {
314
      return () -> (N)new TreeListNodeEntry();
314
      return () -> new TreeListNodeEntry();
315 315
   }
316 316

  
317 317
   /**
src/com/goldencode/p2j/ui/TreeListNodeEntry.java 2021-06-16 22:20:48 +0000
95 95
    */
96 96
   public TreeListNodeEntry()
97 97
   {
98
      // no-op
98 99
   }
99 100

  
100 101
   /**
......
117 118
    * @param   cellIndex
118 119
    *          Cell index.
119 120
    *
120
    * @return  cell value.
121
    *
122
    * @throws  IndexOutOfBoundsException
123
    *          if the index is out of range
121
    * @return  cell value or {@code null} if the index is out of range of valid indexes
124 122
    */
125 123
   @Override
126
   public Object getValue(int cellIndex)
124
   public Object getValue(final int cellIndex)
127 125
   {
128 126
      return cellIndex >= 0 && cellIndex < cellValues.size() ? cellValues.get(cellIndex) : null;
129 127
   }
src/com/goldencode/p2j/ui/TreeListNodeResource.java 2021-06-17 17:48:09 +0000
79 79
 * @param <N> 
80 80
 *        node type
81 81
 */
82
public class TreeListNodeResource<N extends TreeListNodeEntry>
83
extends TreeNodeResource<N>
82
public class TreeListNodeResource
83
extends TreeNodeResource
84 84
implements TreeListNode
85 85
{
86 86
   /**
......
114 114
    * @param   parent
115 115
    *          Node parent.
116 116
    */
117
   public TreeListNodeResource(TreeListWidget<N> treeList,
118
                               int nodeId,
119
                               String key,
120
                               TreeListNodeResource<N> parent)
117
   public TreeListNodeResource(final TreeWidgetBase treeList,
118
                               final int nodeId,
119
                               final String key,
120
                               final TreeNodeFace parent)
121 121
   {
122 122
      super(treeList, nodeId, key, parent);
123 123
      cellValues.add("");
......
137 137
    * @param   parent
138 138
    *          Node parent.
139 139
    */
140
   public TreeListNodeResource(final TreeListWidget<N> treeList,
140
   public TreeListNodeResource(final TreeWidgetBase treeList,
141 141
                               final int nodeId,
142 142
                               final String key,
143 143
                               final String text,
144
                               final TreeListNodeResource<N> parent)
144
                               final TreeNodeFace parent)
145 145
   {
146 146
      super(treeList, nodeId, key, parent);
147 147
      cellStrings.add(text);
......
155 155
   @Override
156 156
   public character getNodeText()
157 157
   {
158
      return new character((String) cellStrings.get(0));
158
      return new character(cellStrings.get(0));
159 159
   }
160 160

  
161 161
   /**
......
179 179
    * @return  new instance of {@link TreeListNodeEntry}.
180 180
    */
181 181
   @Override
182
   protected N saveToEntry()
182
   protected TreeNodeEntry saveToEntry()
183 183
   {
184
      int parentId = parent != null ? parent.nodeId : Integer.MIN_VALUE;
185
      N entry = (N)new TreeListNodeEntry(nodeId, parentId);
184
      int parentId = parent != null ? ((TreeNodeResource)parent).nodeId : Integer.MIN_VALUE;
185
      TreeListNodeEntry entry = new TreeListNodeEntry(nodeId, parentId);
186 186
      super.saveToEntry(entry);
187 187
      entry.cellValues.addAll(cellValues);
188 188
      entry.cellFGColors.addAll(cellFGColors);
......
203 203
    * @return the cell value
204 204
    */
205 205
   public final <T> T getCellValue(final int colIndex,
206
                                   final Function<TreeListNodeResource<N>, List<T>> getValues)
206
                                   final Function<TreeNodeFace, List<T>> getValues)
207 207
   {
208 208
      final List<T> values = getValues.apply(this);
209 209
      return (colIndex >= values.size()) ? null : values.get(colIndex);
......
215 215
      {
216 216
         case STRING:
217 217
         case ICON:
218
            return getCellValue(colIndex, n -> n.cellStrings);
218
            return getCellValue(colIndex, n -> ((TreeListNodeResource)n).cellStrings);
219 219

  
220 220
         default:
221 221
            TreeWidgetBase.LOG.severe("Node comparing: dataType not supported: " + dataType);
src/com/goldencode/p2j/ui/TreeListWidget.java 2021-06-17 18:05:42 +0000
109 109
 * @param <N> 
110 110
 *        node type
111 111
 */
112
public class TreeListWidget<N extends TreeListNodeEntry>
113
extends TreeWidgetBase<N, TreeListConfig<N>, TreeListNodeResource<N>>
112
public class TreeListWidget
113
extends TreeWidgetBase
114 114
implements TreeList
115 115
{
116 116
   /** Flag marking columns or column position changes are pending */
......
143 143
    */
144 144
   public TreeListWidget(boolean dynamic)
145 145
   {
146
      this(dynamic, new TreeListConfig<N>());
146
      this(dynamic, new TreeListConfig());
147 147

  
148 148
      clearAll();
149 149

  
......
160 160
    * @param   config
161 161
    *          The config to use to create widget.
162 162
    */
163
   public TreeListWidget(boolean dynamic, TreeListConfig<N> config)
163
   public TreeListWidget(boolean dynamic, TreeListConfig config)
164 164
   {
165 165
      super(dynamic, config);
166 166
   }
......
176 176
   @Override
177 177
   public integer getSortedColumns()
178 178
   {
179
      final List<Column> ccolumns = getAttr("columns", () -> config.columns);
179
      final List<Column> ccolumns = getAttr("columns", () -> ((TreeListConfig)config).columns);
180 180
      for (int i = ccolumns.size() - 1; i >= 0; i--)
181 181
      {
182 182
         if(ccolumns.get(i).sort != Sorting.NONE)
......
194 194
   @Override
195 195
   public integer getTriggerColumn()
196 196
   {
197
      return new integer(getAttr("triggerColumn", () -> config.triggerColumn));
197
      return new integer(getAttr("triggerColumn", () -> ((TreeListConfig)config).triggerColumn));
198 198
   }
199 199

  
200 200
   /**
......
210 210
   {
211 211
      // assert colIndex == null && !colIndex.isUnknown();
212 212
      final int sortedColumn = colIndex.intValue();
213
      final List<Column> ccolumns = getAttr("columns", () -> config.columns);
213
      final List<Column> ccolumns = getAttr("columns", () -> ((TreeListConfig)config).columns);
214 214

  
215 215
      for (int i = ccolumns.size() - 1; i >= 0; i--)
216 216
      {
......
236 236
   @Override
237 237
   public integer getSortedColumnCount()
238 238
   {
239
      return new integer(getAttr("columns", () -> config.columns).stream()
239
      return new integer(getAttr("columns", () -> ((TreeListConfig)config).columns).stream()
240 240
               .filter(c -> c.sort != Sorting.NONE).count());
241 241
   }
242 242

  
......
257 257
    *          Column index. Set negative value or unknown to unfix all columns.
258 258
    */
259 259
   @Override
260
   public void fixColumnsLeft(NumberType colIndex)
260
   public void fixColumnsLeft(final NumberType colIndex)
261 261
   {
262 262
      short newValue = -1;
263 263
      if (colIndex != null && !colIndex.isUnknown())
......
266 266
         newValue = (short) (index < 0 ? -1 : index);
267 267
      }
268 268

  
269
      if (newValue != getAttr("fixedColumn", () -> config.fixedColumn))
269
      if (newValue != getAttr("fixedColumn", () -> ((TreeListConfig)config).fixedColumn))
270 270
      {
271
         pushWidgetAttr("fixedColumn", config.fixedColumn);
271
         pushWidgetAttr("fixedColumn", ((TreeListConfig)config).fixedColumn);
272 272
      }
273 273
   }
274 274

  
......
302 302
    * @return  the column index.
303 303
    */
304 304
   @Override
305
   public integer createColumn(character caption, NumberType dataType, NumberType width,
306
            NumberType align, NumberType bgColor, NumberType fgColor)
305
   public integer createColumn(final character caption,
306
                               final NumberType dataType,
307
                               final NumberType width,
308
                               final NumberType align,
309
                               final NumberType bgColor,
310
                               final NumberType fgColor)
307 311
   {
308 312
      if (!assertKnown(caption, dataType))
309 313
      {
......
351 355
      {
352 356
         if (pendingPushColumns)
353 357
         {
354
            setAttr("columns", config.columns, columns, v -> config.columns = new ArrayList(v));
358
            setAttr("columns", ((TreeListConfig)config).columns, columns, v -> ((TreeListConfig)config).columns = new ArrayList(v));
355 359
            pendingPushColumns = false;
356 360
        }
357 361
      }
......
368 372
   @Override
369 373
   public void setColumnCaption(final NumberType index, final character caption)
370 374
   {
371
      final TreeListConfig.Column col = config.getColumn(index);
375
      final TreeListConfig.Column col = ((TreeListConfig)config).getColumn(index);
372 376
      if (col == null)
373 377
      {
374 378
         LOG.warning("Invalid column index: " + index);
......
398 402
   public integer getColumnWidth(NumberType index)
399 403
   {
400 404
      flushWidgetAttrs();
401
      TreeListConfig.Column col = config.getColumn(index);
405
      TreeListConfig.Column col = ((TreeListConfig)config).getColumn(index);
402 406
      if (col != null)
403 407
      {
404 408
         return new integer(col.width);
......
425 429
         return;
426 430
      }
427 431

  
428
      final TreeListConfig.Column col = config.getColumn(index);
432
      final TreeListConfig.Column col = ((TreeListConfig)config).getColumn(index);
429 433
      if (col == null)
430 434
      {
431 435
         LOG.warning("Invalid column index: " + index);
......
494 498
   @Override
495 499
   public logical isShowHeader()
496 500
   {
497
      return new logical(getAttr("showHeader", () -> config.showHeader));
501
      return new logical(getAttr("showHeader", () -> ((TreeListConfig)config).showHeader));
498 502
   }
499 503

  
500 504
   /**
......
512 516
         return;
513 517
      }
514 518

  
515
      setAttr("showHeader", config.showHeader, value.booleanValue(), (vv) -> config.showHeader = vv);
519
      setAttr("showHeader", ((TreeListConfig)config).showHeader, value.booleanValue(), (vv) -> ((TreeListConfig)config).showHeader = vv);
516 520
   }
517 521

  
518 522
   /**
......
523 527
   @Override
524 528
   public character getThousandSeparator()
525 529
   {
526
      return new character(getAttr("thousandSeparator", () -> config.thousandSeparator));
530
      return new character(getAttr("thousandSeparator", () -> ((TreeListConfig)config).thousandSeparator));
527 531
   }
528 532

  
529 533
   /**
......
540 544
         return;
541 545
      }
542 546

  
543
      setAttr("thousandSeparator", config.thousandSeparator, value.toStringMessage(), (vv) -> config.thousandSeparator = vv);
547
      setAttr("thousandSeparator", ((TreeListConfig)config).thousandSeparator, value.toStringMessage(), (vv) -> ((TreeListConfig)config).thousandSeparator = vv);
544 548
   }
545 549

  
546 550
   /**
......
551 555
   @Override
552 556
   public character getDecimalSeparator()
553 557
   {
554
      return new character(getAttr("decimalSeparator", () -> config.decimalSeparator));
558
      return new character(getAttr("decimalSeparator", () -> ((TreeListConfig)config).decimalSeparator));
555 559
   }
556 560

  
557 561
   /**
......
568 572
         return;
569 573
      }
570 574

  
571
      setAttr("decimalSeparator", config.decimalSeparator, value.toStringMessage(),
572
               (vv) -> config.decimalSeparator = vv);
575
      setAttr("decimalSeparator", ((TreeListConfig)config).decimalSeparator, value.toStringMessage(),
576
               (vv) -> ((TreeListConfig)config).decimalSeparator = vv);
573 577
   }
574 578

  
575 579
   /**
......
580 584
   @Override
581 585
   public character getDateSeparator()
582 586
   {
583
      return new character(getAttr("dateSeparator", () -> config.dateSeparator));
587
      return new character(getAttr("dateSeparator", () -> ((TreeListConfig)config).dateSeparator));
584 588
   }
585 589

  
586 590
   /**
......
597 601
         return;
598 602
      }
599 603

  
600
      setAttr("dateSeparator", config.dateSeparator, value.toStringMessage(), (vv) -> config.dateSeparator = vv);
604
      setAttr("dateSeparator", ((TreeListConfig)config).dateSeparator, value.toStringMessage(), (vv) -> ((TreeListConfig)config).dateSeparator = vv);
601 605
   }
602 606

  
603 607
   /**
......
608 612
   @Override
609 613
   public character getShortDateFormat()
610 614
   {
611
      return new character(getAttr("shortDateFormat", () -> config.shortDateFormat));
615
      return new character(getAttr("shortDateFormat", () -> ((TreeListConfig)config).shortDateFormat));
612 616
   }
613 617

  
614 618
   /**
......
625 629
         return;
626 630
      }
627 631

  
628
      setAttr("shortDateFormat", config.shortDateFormat, value.toStringMessage(), 
629
            (vv) -> config.shortDateFormat = vv);
632
      setAttr("shortDateFormat", ((TreeListConfig)config).shortDateFormat, value.toStringMessage(), 
633
            (vv) -> ((TreeListConfig)config).shortDateFormat = vv);
630 634
   }
631 635

  
632 636
   /**
......
641 645
   public logical isColumnVisible(NumberType index)
642 646
   {
643 647
      flushWidgetAttrs();
644
      TreeListConfig.Column col = config.getColumn(index);
648
      TreeListConfig.Column col = ((TreeListConfig)config).getColumn(index);
645 649
      if (col != null)
646 650
      {
647 651
         return new logical(col.visible);
......
665 669
         return;
666 670
      }
667 671

  
668
      final TreeListConfig.Column col = config.getColumn(colIndex);
672
      final TreeListConfig.Column col = ((TreeListConfig)config).getColumn(colIndex);
669 673
      if (col == null)
670 674
      {
671 675
         return;
......
695 699
   @Override
696 700
   public void setCellIcon(NumberType nodeId, NumberType colIndex, NumberType imgId)
697 701
   {
698
      setCellValue(nodeId, colIndex, n -> n.cellValues, imgId);
702
      setCellValue(nodeId, colIndex, n -> ((TreeListNodeResource)n).cellValues, imgId);
699 703
   }
700 704

  
701 705
   /**
......
736 740
         return;
737 741
      }
738 742

  
739
      final Object cellValue = getCellValue(nodeId, colIndex, n -> n.cellValues);
743
      final Object cellValue = getCellValue(nodeId, colIndex, n -> ((TreeListNodeResource)n).cellValues);
740 744
      
741 745
      if(cellValue == null)
742 746
      {
......
761 765
   @Override
762 766
   public void setCellString(final NumberType nodeId, final NumberType colIndex, final character value)
763 767
   {
764
      setCellValue(nodeId, colIndex, n -> n.cellValues, value.toStringMessage());
768
      setCellValue(nodeId, colIndex, n -> ((TreeListNodeResource)n).cellValues, value.toStringMessage());
765 769
   }
766 770

  
767 771
   /**
......
830 834
   @Override
831 835
   public integer getCellFgColor(NumberType nodeId, NumberType colIndex)
832 836
   {
833
      final ColorRgb cellValue = getCellValue(nodeId, colIndex, n -> n.cellFGColors);
837
      final ColorRgb cellValue = getCellValue(nodeId, colIndex, n -> ((TreeListNodeResource)n).cellFGColors);
834 838
      return cellValue != null ? new integer(cellValue.getGuiRgb()) : new integer();
835 839
   }
836 840

  
......
849 853
   @Override
850 854
   public integer getCellBgColor(NumberType nodeId, NumberType colIndex)
851 855
   {
852
      final ColorRgb cellValue = getCellValue(nodeId, colIndex, n -> n.cellBGColors);
856
      final ColorRgb cellValue = getCellValue(nodeId, colIndex,
857
               n -> ((TreeListNodeResource) n).cellBGColors);
853 858
      return cellValue != null ? new integer(cellValue.getGuiRgb()) : new integer();
854 859
   }
855 860

  
......
880 885
    *          the owner's config was modified.
881 886
    */
882 887
   @Override
883
   public void afterConfigUpdate(TreeListConfig beforeUpdate)
888
   public void afterConfigUpdate(TreeConfig beforeUpdate)
884 889
   {
885 890
      super.afterConfigUpdate(beforeUpdate);
886 891
      
......
894 899
       * to compare columns, since no proper equals() method is defined for columns. 
895 900
       */
896 901
      columns.clear();
897
      columns.addAll(config.columns);
902
      columns.addAll(((TreeListConfig)config).columns);
898 903
   }
899 904

  
900 905
   /**
......
921 926
         return new integer();
922 927
      }
923 928

  
924
      final List<Integer> cellImageList = config.cellImageList;
929
      final List<Integer> cellImageList = ((TreeListConfig)config).cellImageList;
925 930
      final int imageIndex = cellImageList.size();
926
      final ArrayList<Integer> newList = new ArrayList<>(cellImageList);
931
      final List<Integer> newList = new ArrayList<>(cellImageList);
927 932
      newList.add(globalImageId);
928
      setAttr("cellImageList", cellImageList, newList, dummy -> config.cellImageList = newList);
933
      setAttr("cellImageList", cellImageList, newList, dummy -> ((TreeListConfig)config).cellImageList = newList);
929 934

  
930 935
      return new integer(imageIndex);
931 936
   }
......
943 948
   @Override
944 949
   public void setCellFgColor(final NumberType nodeId, final NumberType colIndex, final NumberType color)
945 950
   {
946
      setCellValue(nodeId, colIndex, n -> n.cellFGColors, new ColorRgb(color.intValue()));
951
      setCellValue(nodeId, colIndex, n -> ((TreeListNodeResource) n).cellFGColors,
952
               new ColorRgb(color.intValue()));
947 953
   }
948 954

  
949 955
   /**
......
959 965
   @Override
960 966
   public void setCellBgColor(final NumberType nodeId, final NumberType colIndex, final NumberType color)
961 967
   {
962
      setCellValue(nodeId, colIndex, n -> n.cellBGColors, new ColorRgb(color.intValue()));
968
      setCellValue(nodeId, colIndex, n -> ((TreeListNodeResource) n).cellBGColors,
969
               new ColorRgb(color.intValue()));
963 970
   }
964 971

  
965 972
   /**
......
975 982
      
976 983
      if (buildingTree <= 0)
977 984
      {
978
         setAttr("columns", config.columns, columns, v -> config.columns = new ArrayList(columns));
985
         setAttr("columns", ((TreeListConfig) config).columns, columns,
986
                  v -> ((TreeListConfig) config).columns = new ArrayList(columns));
979 987
         pendingPushColumns = false;
980 988
      }
981 989
      else
......
997 1005
    * @return  new node instance.
998 1006
    */
999 1007
   @Override
1000
   protected TreeListNodeResource<N> createNode(final String key,
1001
                                                final String text, 
1002
                                                final TreeListNodeResource<N> parent)
1008
   protected TreeListNodeResource createNode(final String key,
1009
                                             final String text, 
1010
                                             final TreeNodeFace parent)
1003 1011
   {
1004 1012
      final int nodeId = getNextNodeId();
1005
      return new TreeListNodeResource<N>(this, nodeId, key, text, parent);
1013
      return new TreeListNodeResource(this, nodeId, key, text, parent);
1006 1014
   }
1007 1015

  
1008 1016
   /**
......
1019 1027

  
1020 1028
      if (buildingTree <= 0)
1021 1029
      {
1022
         setAttr("columns", config.columns, columns, v -> config.columns = new ArrayList(v));
1030
         setAttr("columns", ((TreeListConfig) config).columns, columns,
1031
                  v -> ((TreeListConfig) config).columns = new ArrayList(v));
1023 1032
         pendingPushColumns = false;
1024 1033
      }
1025 1034
      else
......
1074 1083
    * @return  Reference to node entry object or {@code null} if not found.
1075 1084
    */
1076 1085
   @SuppressWarnings("unused")
1077
   private TreeListNodeEntry findListNodeEntry(NumberType nodeId)
1086
   private TreeNodeEntry findListNodeEntry(NumberType nodeId)
1078 1087
   {
1079
      for (TreeListNodeEntry n : getAttr("nodes", () -> config.nodes))
1088
      for (TreeNodeEntry n : getAttr("nodes", () -> ((TreeListConfig)config).nodes))
1080 1089
      {
1081 1090
         if (n.nodeId == nodeId.intValue())
1082 1091
         {
......
1103 1112
    */
1104 1113
   private final <T> void setCellValue(final NumberType nodeId,
1105 1114
                                       final NumberType colIndex,
1106
                                       final Function<TreeListNodeResource<N>, List<T>> getValues,
1115
                                       final Function<TreeNodeFace, List<T>> getValues,
1107 1116
                                       final T newValue)
1108 1117
   {
1109 1118
      if (!assertKnown(nodeId, colIndex))
......
1111 1120
         return;
1112 1121
      }
1113 1122

  
1114
      final TreeListNodeResource<N> n = findNode(nodeId.intValue());
1123
      final TreeNodeFace n = findNode(nodeId.intValue());
1115 1124
      if (n == null)
1116 1125
      {
1117 1126
         return;
......
1161 1170
    */
1162 1171
   private final <T> T getCellValue(final NumberType nodeId,
1163 1172
                                    final NumberType colIndex,
1164
                                    final Function<TreeListNodeResource<N>, List<T>> getValues)
1173
                                    final Function<TreeNodeFace, List<T>> getValues)
1165 1174
   {
1166 1175
      if (!assertKnown(nodeId, colIndex))
1167 1176
      {
1168 1177
         return null;
1169 1178
      }
1170 1179

  
1171
      final TreeListNodeResource<N> n = findNode(nodeId.intValue());
1180
      final TreeNodeFace n = findNode(nodeId.intValue());
1172 1181
      if (n == null)
1173 1182
      {
1174 1183
         return null;
1175 1184
      }
1176 1185

  
1177
      return n.getCellValue(colIndex.intValue(), getValues);
1186
      return ((TreeListNodeResource)n).getCellValue(colIndex.intValue(), getValues);
1178 1187
   }
1179 1188

  
1180 1189
   /**
src/com/goldencode/p2j/ui/TreeNodeCollection.java 2021-06-17 16:27:23 +0000
77 77
 *        tree node face type
78 78
 */
79 79
@LegacyResource(resource = LegacyResource.TREE_NODE_COLLECTION)
80
public interface TreeNodeCollection<T extends TreeNodeFace>
80
public interface TreeNodeCollection
81 81
extends WrappedResource,
82
        Iterable<T>,
82
        Iterable<TreeNodeFace>,
83 83
        RemoveNode
84 84
{
85 85
   /**
src/com/goldencode/p2j/ui/TreeNodeCollectionResource.java 2021-06-17 17:07:28 +0000
91 91
 *        node type
92 92
 * @param <C> 
93 93
 *        config type
94
 * @param <R> 
94
 * @param  <TreeNodeResource>  
95 95
 *        resource type
96 96
*/
97
public class TreeNodeCollectionResource<N extends TreeNodeEntry,
98
                                        C extends TreeConfig<N>,
99
                                        R extends TreeNodeResource<N>>
97
public class TreeNodeCollectionResource
100 98
extends HandleResource
101
implements TreeNodeCollection<R>,
99
implements TreeNodeCollection,
102 100
           DynamicResource
103 101
{
104 102
   /** Represents the default key and text values for a new created tree node. */
......
112 110
   private final static int CHILD_NODE_RELATIONSHIP    = 4;
113 111

  
114 112
   /** The nodes collection implementation. */
115
   private LinkedList<R> nodes = new LinkedList<>();
113
   private LinkedList<TreeNodeFace> nodes = new LinkedList<>();
116 114

  
117 115
   /** The owning tree. */
118
   private TreeWidgetBase<N, C, R> tree;
116
   private TreeWidgetBase tree;
119 117

  
120 118
   /** The owning tree node. */
121
   private R owner;
119
   private TreeNodeResource owner;
122 120

  
123 121
   /**
124 122
    * Constructor.
......
128 126
    * @param   owner
129 127
    *          The owning node.
130 128
    */
131
   public TreeNodeCollectionResource(TreeWidgetBase<N,C,R> tree, R owner)
129
   public TreeNodeCollectionResource(final TreeWidgetBase tree, TreeNodeResource owner)
132 130
   {
133 131
      super(tree._dynamic());
134 132
      this.tree = tree;
......
141 139
    * @return  an Iterator.
142 140
    */
143 141
   @Override
144
   public ListIterator<R> iterator()
142
   public ListIterator<TreeNodeFace>  iterator()
145 143
   {
146 144
      return nodes == null ? Collections.emptyListIterator() : nodes.listIterator();
147 145
   }
......
155 153
    *
156 154
    * @return  an Iterator.
157 155
    */
158
   public Iterator<R> recursiveIterator(boolean visibleOnly)
156
   public Iterator <TreeNodeFace>  recursiveIterator(boolean visibleOnly)
159 157
   {
160
      return nodes == null ? Collections.emptyIterator() : new NodesIterator<>(nodes.listIterator(),
158
      return nodes == null ? Collections.emptyIterator() : new NodesIterator(nodes.listIterator(),
161 159
                                                                             visibleOnly);
162 160
   }
163 161

  
......
208 206
   @Override
209 207
   public handle addNextNode(handle relativeNode, character key, character text)
210 208
   {
211
      return _addNodeImpl((R) relativeNode.getResource(), Location.NEXT, key, text, true);
209
      return _addNodeImpl((TreeNodeFace)relativeNode.getResource(), Location.NEXT, key, text, true);
212 210
   }
213 211

  
214 212
   /**
......
226 224
   @Override
227 225
   public handle addChildNode(handle relativeNode, character key, character text)
228 226
   {
229
      return _addNodeImpl((R) relativeNode.getResource(), Location.CHILD, key, text, true);
227
      return _addNodeImpl((TreeNodeFace) relativeNode.getResource(), Location.CHILD, key, text, true);
230 228
   }
231 229

  
232 230
   /**
......
255 253
         return;
256 254
      }
257 255

  
258
      R node = tree.findNode(key.toStringMessage());
256
      TreeNodeFace node = tree.findNode(key.toStringMessage());
259 257
      _removeNode(node, null);
260 258
      tree.pushNodes();
261 259
   }
......
271 269
         return;
272 270
      }
273 271

  
274
      ListIterator<R> it = nodes.listIterator();
272
      final ListIterator <TreeNodeFace>  it = nodes.listIterator();
275 273
      while (it.hasNext())
276 274
      {
277 275
         _removeNode(it.next(), it);
......
358 356
      
359 357
      int index = nodeIndex.intValue();
360 358
   // the internal root node has a zero index, indices of none root nodes are 1-based
361
      R node = tree.getTreeNodeByIndex(index);
359
      TreeNodeFace node = tree.getTreeNodeByIndex(index);
362 360
      
363 361
      if (node == null)
364 362
      {
......
392 390
      
393 391
      int index = nodeIndex.intValue();
394 392
      // the internal root node has a zero index, indices of none root nodes are 1-based
395
      R node = tree.getTreeNodeByIndex(index);
393
      TreeNodeFace node = tree.getTreeNodeByIndex(index);
396 394
      
397 395
      if (node == null)
398 396
      {
......
482 480
                     character key,
483 481
                     character text)
484 482
   {
485
      R relative;
486
      TreeNodeCollectionResource<N, C, R> nodesCollection;
483
      TreeNodeFace relative;
484
      TreeNodeCollectionResource nodesCollection;
487 485
      if (anchorIndex == null || anchorIndex.isUnknown())
488 486
      {
489 487
         relative = null;
......
504 502
            return new handle();
505 503
         }
506 504
         
507
         nodesCollection = relative.parent._getNodes();
505
         nodesCollection = ((TreeNodeResource)((TreeNodeResource)relative).parent)._getNodes();
508 506
      }
509 507
      
510 508
      Location location = Location.valueOf(relationType.intValue());
......
516 514
         return new handle();
517 515
      }
518 516
      
519
      R treeNode = tree.findNode(key.getValue());
517
      TreeNodeFace treeNode = tree.findNode(key.getValue());
520 518
      
521 519
      if (treeNode != null)
522 520
      {
......
596 594
      
597 595
      super.delete();
598 596
      
599
      TreeWidgetBase<N,C,R> tree = this.tree;
597
      TreeWidgetBase tree = this.tree;
600 598
      this.tree = null;
601 599

  
602 600
      if (nodes != null)
603 601
      {
604
         ListIterator<R> nodeIt = nodes.listIterator();
602
         ListIterator<TreeNodeFace>  nodeIt = nodes.listIterator();
605 603
         while (nodeIt.hasNext())
606 604
         {
607 605
            _removeNode(nodeIt.next(), nodeIt);
......
619 617
   @Override
620 618
   public integer getCount()
621 619
   {
622
      ListIterator<R> iter = iterator();
620
      ListIterator<TreeNodeFace>  iter = iterator();
623 621
      
624 622
      int collect = 0;
625 623
      
626
      R rootNode = tree.getTreeNodeByIndex(0);
624
      TreeNodeFace rootNode = tree.getTreeNodeByIndex(0);
627 625
      
628 626
      while(iter.hasNext())
629 627
      {
630
         R node = iter.next();
628
         TreeNodeFace node = iter.next();
631 629
         
632
         if (node._getHasChildren())
630
         if (((TreeNodeResource)node)._getHasChildren())
633 631
         {
634
            collect += node._getNodes().getCount().intValue();
632
            collect += ((TreeNodeResource)node)._getNodes().getCount().intValue();
635 633
         }
636 634
         
637 635
         // don't take into account the internal root node
......
670 668
    * @param   it
671 669
    *          Optional iterator. When set, use it to remove the item from its list.
672 670
    */
673
   void _removeNode(R node, ListIterator<R> it)
671
   void _removeNode(final TreeNodeFace node, ListIterator <TreeNodeFace> it)
674 672
   {
675 673
      if (node == null || nodes == null)
676 674
      {
......
686 684
         return;
687 685
      }
688 686

  
689
      node._removeCollection();
687
      ((TreeNodeResource)node)._removeCollection();
690 688

  
691 689
      // resource cleanup
692
      node.delete();
690
      ((TreeNodeResource)node).delete();
693 691
   }
694 692

  
695 693
   /**
......
711 709
    *
712 710
    * @return  see above.
713 711
    */
714
   int _indexOf(R node)
712
   int _indexOf(final TreeNodeFace node)
715 713
   {
716 714
      return nodes == null ? -1 : nodes.indexOf(node);
717 715
   }
......
726 724
    * @throws  IndexOutOfBoundsException
727 725
    *          if the index is out of range (<tt>index &lt; 0 || index &gt;= size()</tt>)
728 726
    */
729
   R _getNode(int index)
727
   TreeNodeFace _getNode(int index)
730 728
   {
731 729
      if (nodes == null)
732 730
      {
......
753 751
    *
754 752
    * @return  handle with wrapped {@link TreeNodeResource} instance, or unknown if the operation fails.
755 753
    */
756
   handle _addNodeImpl(R relative,
754
   handle _addNodeImpl(TreeNodeFace relative,
757 755
                       Location location,
758 756
                       character key,
759 757
                       character text,
......
769 767
         text = key;
770 768
      }
771 769

  
772
      R parent = owner;
770
      TreeNodeFace parent = owner;
773 771

  
774 772
      if (location == Location.CHILD)
775 773
      {
......
786 784
         nodes = new LinkedList<>();
787 785
      }
788 786
      
789
      R node = createNode(key.toStringMessage(), text.toStringMessage(), parent);
787
      TreeNodeFace node = createNode(key.toStringMessage(), text.toStringMessage(), parent);
790 788

  
791 789
      switch (location)
792 790
      {
......
835 833
            }
836 834
            break;
837 835
         case CHILD:
838
            parent._getNodes().nodes.addLast(node);
836
            ((TreeNodeResource)parent)._getNodes().nodes.addLast(node);
839 837
            break;
840 838
      }
841 839

  
842
      parent._setHasChildren(true);
840
      ((TreeNodeResource)parent)._setHasChildren(true);
843 841
      tree.addNode(node, pushNodes);
844 842
      return new handle(node);
845 843
   }
......
861 859
    * @throws  RuntimeException
862 860
    *          when the supplied key is not unique
863 861
    */
864
   private R createNode(String key, String text, R parent)
862
   private TreeNodeFace createNode(String key, String text, final TreeNodeFace parent)
865 863
   {
866 864
      if (key == null || text == null || parent == null)
867 865
      {
......
874 872
   /**
875 873
    * Recursive nodes iterator.
876 874
    */
877
   private static class NodesIterator<N extends TreeNodeEntry,T extends TreeNodeResource<N>>
878
   implements Iterator<T>
875
   private static class NodesIterator
876
   implements Iterator<TreeNodeFace>
879 877
   {
880 878
      /** Stack of iterators to handle recursion. */
881
      private Stack<ListIterator<T>> stack = new Stack<>();
879
      private Stack<ListIterator<TreeNodeFace>> stack = new Stack<>();
882 880

  
883 881
      /** All or only expanded nodes to be iterated */
884 882
      private boolean visibleOnly;
......
888 886
       *
889 887
       * @param   node
890 888
       *          The parent node to iterate.
891
       */
892
      public NodesIterator(T node)
893
      {
894
         this(node, true);
895
      }
896

  
897
      /**
898
       * Constructor.
899
       *
900
       * @param   node
901
       *          The parent node to iterate.
902 889
       * @param   visibleOnly
903 890
       *          All or only expanded nodes to be iterated.
904 891
       */
905
      public NodesIterator(T node, boolean visibleOnly)
892
      public NodesIterator(final TreeNodeFace node, boolean visibleOnly)
906 893
      {
907 894
         if (node != null && node.isNodeExpanded().booleanValue())
908 895
         {
909
            LinkedList<T> nodes = (LinkedList<T>)node._getNodes().nodes;
896
            LinkedList<TreeNodeFace> nodes = (LinkedList<TreeNodeFace>)((TreeNodeResource)node)._getNodes().nodes;
910 897
            stack.push(nodes == null ? Collections.emptyListIterator() : nodes.listIterator());
911 898
         }
912 899

  
......
921 908
       * @param   visibleOnly
922 909
       *          All or only expanded nodes to be iterated.
923 910
       */
924
      public NodesIterator(ListIterator<T> nodes, boolean visibleOnly)
911
      public NodesIterator(ListIterator<TreeNodeFace> nodes, boolean visibleOnly)
925 912
      {
926 913
         stack.push(nodes);
927 914
         this.visibleOnly = visibleOnly;
......
937 924
      @Override
938 925
      public boolean hasNext()
939 926
      {
940
         for (Iterator<T> it : stack)
927
         for (ListIterator<TreeNodeFace> it : stack)
941 928
         {
942 929
            if (it.hasNext())
943 930
            {
......
955 942
       * @throws NoSuchElementException if the iteration has no more elements
956 943
       */
957 944
      @Override
958
      public T next()
945
      public TreeNodeFace next()
959 946
      {
960 947
         if (stack.isEmpty())
961 948
         {
......
967 954
            stack.pop();
968 955
         }
969 956

  
970
         Iterator<T> it = stack.isEmpty() ? null : stack.peek();
957
         Iterator<TreeNodeFace> it = stack.isEmpty() ? null : stack.peek();
971 958

  
972 959
         if (it == null || !it.hasNext())
973 960
         {
974 961
            throw new NoSuchElementException();
975 962
         }
976 963

  
977
         TreeNodeResource<N> node = it.next();
964
         TreeNodeFace node = it.next();
978 965
         if (!visibleOnly || node.isNodeExpanded().booleanValue())
979 966
         {
980
            TreeNodeCollectionResource<N, ?, ?> coll = node._getNodes(false);
967
            TreeNodeCollectionResource coll = ((TreeNodeResource)node)._getNodes(false);
981 968
            if (coll != null)
982 969
            {
983 970
               if (coll.nodes != null && !coll.nodes.isEmpty())
984 971
               {
985
                  stack.push((ListIterator<T>)coll.nodes.listIterator());
972
                  stack.push((ListIterator<TreeNodeFace>)coll.nodes.listIterator());
986 973
               }
987 974
            }
988 975
         }
989 976

  
990
         return (T) node;
977
         return node;
991 978
      }
992 979
   }
993 980

  
src/com/goldencode/p2j/ui/TreeNodeEntry.java 2021-06-17 17:51:29 +0000
74 74
import java.io.*;
75 75
import java.util.*;
76 76

  
77
import com.goldencode.util.*;
78
import com.google.common.base.MoreObjects.*;
79

  
77 80
/**
78 81
 * Treeview node configuration.
79 82
 */
80 83
public abstract class TreeNodeEntry
84
extends AbstractPrintable
81 85
implements Externalizable
82 86
{
83
   /** Cell tvalue types */
87
   /** Cell tvalue types used for cell value serialization */
84 88
   private static final byte NULL = 0;
85 89
   private static final byte TEXT = 1;
86 90
   private static final byte NUMBER = 2;
......
124 128
    */
125 129
   public TreeNodeEntry()
126 130
   {
131
      // no-op
127 132
   }
128 133

  
129 134
   /**
......
134 139
    * @param   parentId
135 140
    *          Parent node id. Use unknown when the node has no parent.
136 141
    */
137
   public TreeNodeEntry(int nodeId, int parentId)
142
   public TreeNodeEntry(final int nodeId, final int parentId)
138 143
   {
139 144
      this.nodeId = nodeId;
140 145
      this.parentId = parentId;
......
147 152
    * @param   cellIndex
148 153
    *          Cell index.
149 154
    *
155
    * @return  cell value or {@code null} if the index is out of range of valid indexes
156
    */
157
   public Object getValue()
158
   {
159
      return getValue(0);
160
   }
161

  
162
   /**
163
    * Returns the cell value at the specified index. The index is the index to the data model, not the
164
    * actual (column) position.
165
    *
166
    * @param   cellIndex
167
    *          Cell index.
168
    *
150 169
    * @return  cell value.
151 170
    *
152 171
    * @throws  IndexOutOfBoundsException
......
283 302
   }
284 303

  
285 304
   /**
286
    * Write cell value
305
    * Write cell value.
306
    * 
287 307
    * @param out
288 308
    *        output stream
289 309
    * @param value
290 310
    *        value to be written
291 311
    * @throws IOException
292 312
    */
293
   protected void writeCell(ObjectOutput out, Object value) throws IOException
313
   protected static void writeCell(ObjectOutput out, Object value) throws IOException
294 314
   {
295 315
      if (value == null)
296 316
      {
......
322 342
    * @throws IOException
323 343
    * @throws ClassNotFoundException 
324 344
    */
325
   protected Object readCell(ObjectInput in) throws IOException, ClassNotFoundException
345
   protected static Object readCell(ObjectInput in) throws IOException, ClassNotFoundException
326 346
   {
327 347
      byte type = in.readByte();
328 348
      switch(type)
......
352 372
      /** */
353 373
      INACTIVE
354 374
   }
375

  
376
   /**
377
   * Add class-specific fields to the helper.
378
   *  
379
   * @param stringHelper the string helper to update
380
   */
381
   @Override
382
   public void updateStringHelper(ToStringHelper stringHelper)
383
   {
384
      stringHelper.add("id", nodeId);
385

  
386
      if (parentId >= 0)
387
      {
388
         stringHelper.add("parentId", parentId);
389
      }
390

  
391
      if (hasChildren)
392
      {
393
         stringHelper.addValue("may have children");
394
      }
395

  
396
      if (expanded)
397
      {
398
         stringHelper.addValue("expanded");
399
      }
400

  
401
      if (tooltip != null)
402
      {
403
         stringHelper.add("tooltip", tooltip);
404
      }
405
   }
355 406
}
src/com/goldencode/p2j/ui/TreeNodeResource.java 2021-06-17 17:24:53 +0000
101 101
 * @param <N> 
102 102
 *        node type
103 103
 */
104
public abstract class TreeNodeResource<N extends TreeNodeEntry>
104
public abstract class TreeNodeResource
105 105
extends HandleResource
106 106
implements TreeNodeFace,
107 107
           DynamicResource
......
140 140
   protected String key;
141 141

  
142 142
   /** The owning tree view. */
143
   protected TreeWidgetBase<N, TreeConfig<N>, TreeNodeResource<N>> tree;
143
   protected TreeWidgetBase tree;
144 144

  
145 145
   /** Node parent */
146
   protected TreeNodeResource<N> parent;
146
   protected TreeNodeFace parent;
147 147

  
148 148
   /** Child nodes */
149
   protected TreeNodeCollectionResource<N, TreeConfig<N>, TreeNodeResource<N>> nodes;
149
   protected TreeNodeCollectionResource nodes;
150 150

  
151 151
   /** Node tooltip */
152 152
   private String tooltip;
......
173 173
    * @param   parent
174 174
    *          Node parent.
175 175
    */
176
   public <R extends TreeNodeResource<N>,
177
           C extends TreeConfig<N>,
178
           W extends TreeWidgetBase<N, C, R>> 
179
          TreeNodeResource(W tree,
176
   public TreeNodeResource(TreeWidgetBase tree,
180 177
                           int nodeId,
181 178
                           String key,
182
                           R parent)
179
                           TreeNodeFace parent)
183 180
   {
184 181
      super(tree._dynamic());
185
      this.tree = (TreeWidgetBase<N, TreeConfig<N>, TreeNodeResource<N>>) tree;
182
      this.tree = (TreeWidgetBase) tree;
186 183
      this.nodeId = nodeId;
187 184
      this.key = key;
188 185
      this.parent = parent;
......
239 236
         return;
240 237
      }
241 238
      
242
      TreeNodeResource<N> treeNode = tree.findNode(newKeyValue);
239
      TreeNodeFace treeNode = tree.findNode(newKeyValue);
243 240
      
244 241
      if (treeNode != null)
245 242
      {
......
399 396
         return new integer();
400 397
      }
401 398

  
402
      int i = parent.nodes._indexOf(this);
399
      int i = ((TreeNodeResource)parent).nodes._indexOf(this);
403 400
      return i < 0 ? new integer() : new integer(i);
404 401
   }
405 402

  
......
673 670
   {
674 671
      LinkedList<String> stack = new LinkedList<>();
675 672
      
676
      TreeNodeResource<N> current = this;
673
      TreeNodeFace current = this;
677 674
      
678 675
      while (current != null)
679 676
      {
......
692 689
         
693 690
         stack.add(label);
694 691
         
695
         current = current.parent;
692
         current = ((TreeNodeResource)current).parent;
696 693
      }
697 694
      
698 695
      StringBuilder pathCollector = new StringBuilder();
......
828 825
   @Override
829 826
   public handle getPreviousNode()
830 827
   {
831
      TreeNodeCollectionResource<N, TreeConfig<N>, TreeNodeResource<N>> siblings = parent.nodes;
828
      TreeNodeCollectionResource siblings = ((TreeNodeResource)parent).nodes;
832 829
      int index = siblings._indexOf(this);
833 830
      
834 831
      if (index > 0)
......
847 844
   @Override
848 845
   public handle getNextNode()
849 846
   {
850
      TreeNodeCollectionResource<N, TreeConfig<N>, TreeNodeResource<N>> siblings = parent.nodes;
851
      int index = siblings._indexOf(this);
852
      int limit = siblings._getCount() - 1;
847
      final TreeNodeCollectionResource siblings = ((TreeNodeResource)parent).nodes;
848
      final int index = siblings._indexOf(this);
849
      final int limit = siblings._getCount() - 1;
853 850
      
854 851
      if (index >= 0 && index < limit)
855 852
      {
......
867 864
   @Override
868 865
   public handle getFirstSiblingNode()
869 866
   {
870
      TreeNodeCollectionResource<N, TreeConfig<N>, TreeNodeResource<N>> siblings = parent.nodes;
867
      final TreeNodeCollectionResource siblings = ((TreeNodeResource)parent).nodes;
871 868
      
872 869
      if (siblings != null)
873 870
      {
......
885 882
   @Override
886 883
   public handle getLastSiblingNode()
887 884
   {
888
      TreeNodeCollectionResource<N, TreeConfig<N>, TreeNodeResource<N>> siblings = parent.nodes;
885
      final TreeNodeCollectionResource siblings = ((TreeNodeResource)parent).nodes;
889 886
      
890 887
      if (siblings != null)
891 888
      {
......
914 911

  
915 912
      super.delete();
916 913
      
917
      TreeWidgetBase<N, TreeConfig<N>, TreeNodeResource<N>> tree = this.tree;
914
      TreeWidgetBase tree = this.tree;
918 915
      this.tree = null;
919 916

  
920 917
      if (nodeId == 0)
......
923 920
      }
924 921
      else
925 922
      {
926
         parent._getNodes()._removeNode(this, null);
923
         ((TreeNodeResource)parent)._getNodes()._removeNode(this, null);
927 924
      }
928 925

  
929 926
      tree.removeNode(this, true);
......
960 957
    *
961 958
    * @return  new instance of {@link TreeNodeEntry}.
962 959
    */
963
   protected abstract N saveToEntry();
960
   protected abstract TreeNodeEntry saveToEntry();
964 961

  
965 962
   /**
966 963
    * The method serializes the node state into the supplied entry instance.
......
987 984
    * @param   entry
988 985
    *          A valid {@link TreeNodeEntry} instance.
989 986
    */
990
   protected void loadFromEntry(N entry)
987
   protected void loadFromEntry(final TreeNodeEntry entry)
991 988
   {
992 989
      expanded = entry.expanded;
993 990
      
......
999 996
    *
1000 997
    * @return  see above.
1001 998
    */
1002
   <C extends TreeConfig<N>, R extends TreeNodeResource<N>>   
1003
   TreeNodeCollectionResource<N, C, R> _getNodes()
999
   TreeNodeCollectionResource _getNodes()
1004 1000
   {
1005 1001
      return _getNodes(true);
1006 1002
   }
......
1013 1009
    *
1014 1010
    * @return  see above.
1015 1011
    */
1016
   <C extends TreeConfig<N>, R extends TreeNodeResource<N>>   
1017
   TreeNodeCollectionResource<N, C, R> _getNodes(boolean allocate)
1012
   TreeNodeCollectionResource _getNodes(boolean allocate)
1018 1013
   {
1019 1014
      if (nodes == null && allocate)
1020 1015
      {
1021
         nodes = new TreeNodeCollectionResource<N, TreeConfig<N>, TreeNodeResource<N>>(tree, this);
1016
         nodes = new TreeNodeCollectionResource(tree, this);
1022 1017
      }
1023 1018

  
1024
      return (TreeNodeCollectionResource<N, C, R>)nodes;
1019
      return (TreeNodeCollectionResource)nodes;
1025 1020
   }
1026 1021

  
1027 1022
   /**
......
1055 1050
   int _getNodeLevel()
1056 1051
   {
1057 1052
      int level = -1;
1058
      TreeNodeResource<N> p = this;
1059
      while ((p = p.parent) != null)
1053
      TreeNodeFace p = this;
1054
      while ((p = ((TreeNodeResource)p).parent) != null)
1060 1055
      {
1061 1056
         level++;
1062 1057
      }
......
1069 1064
    *
1070 1065
    * @return  parent node.
1071 1066
    */
1072
   TreeNodeResource<N> _getParent()
1067
   TreeNodeFace _getParent()
1073 1068
   {
1074 1069
      return parent;
1075 1070
   }
......
1173 1168
   {
1174 1169
      if (expanded)
1175 1170
      {
1176
         TreeNodeResource<N> pNode = parent;
1177
         while (pNode != null && !pNode.expanded)
1171
         TreeNodeFace pNode = parent;
1172
         while (pNode != null && !((TreeNodeResource)pNode).expanded)
1178 1173
         {
1179
            pNode.expanded = true;
1180
            pNode = pNode.parent;
1174
            ((TreeNodeResource)pNode).expanded = true;
1175
            pNode = ((TreeNodeResource)pNode).parent;
1181 1176
         }
1182 1177
      }
1183 1178

  
src/com/goldencode/p2j/ui/TreeView.java 2021-06-17 17:52:14 +0000
81 81
extends WrappedResource,
82 82
        TreeFace
83 83
{
84
   // empty
84 85
}
src/com/goldencode/p2j/ui/TreeViewConfig.java 2021-06-17 18:05:43 +0000
74 74
 * TreeView widget configuration.
75 75
 */
76 76
public class TreeViewConfig
77
extends TreeConfig<TreeViewNodeEntry>
77
extends TreeConfig
78 78
{
79 79
   /**
80 80
    * Default constructor.
......
111 111
    * @return node entry instance
112 112
    */
113 113
   @Override
114
   protected  Supplier<TreeViewNodeEntry> createNodeEntry()
114
   protected  Supplier<TreeNodeEntry> createNodeEntry()
115 115
   {
116 116
      return TreeViewNodeEntry::new;
117 117
   }
src/com/goldencode/p2j/ui/TreeViewNode.java 2021-06-17 17:51:55 +0000
77 77
public interface TreeViewNode
78 78
extends TreeNodeFace
79 79
{
80
   // empty
80 81
}
src/com/goldencode/p2j/ui/TreeViewNodeEntry.java 2021-06-16 19:56:27 +0000
78 78
extends TreeNodeEntry
79 79
{
80 80
   /** Node text. */
81
   public String text = null;
81
   /* private */ public String text = null;
82 82

  
83 83
   /**
... This diff was truncated because it exceeds the maximum size that can be displayed.