コード例 #1
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 @Override
 public RegionContent getWholeRegion() {
   if (model == null || model.getItemCount() == 0) return null;
   final LinkedList<String> res = new LinkedList<String>();
   final int count = model.getItemCount();
   for (int i = 0; i < count; ++i) {
     final String line =
         appearance.getScreenAppearance(model.getItem(i), ListItemAppearance.FOR_CLIPBOARD);
     res.add(line != null ? line : "");
   }
   res.add("");
   return new RegionContent(res.toArray(new String[res.size()]));
 }
コード例 #2
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 public void refresh() {
   model.refresh();
   final int count = model.getItemCount();
   if (count < 1) {
     items = new Object[0];
     hotPointX = 0;
     hotPointY = 0;
     luwrain.onAreaNewContent(this);
     luwrain.onAreaNewHotPoint(this);
     return;
   }
   items = new Object[count];
   for (int i = 0; i < count; ++i) items[i] = model.getItem(i);
   if (hotPointY > items.length) hotPointY = items.length;
   hotPointX = 0;
   luwrain.onAreaNewContent(this);
   luwrain.onAreaNewHotPoint(this);
 }
コード例 #3
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 @Override
 public RegionContent getRegion(int fromX, int fromY, int toX, int toY) {
   if (model == null || model.getItemCount() == 0) return null;
   if (fromY >= model.getItemCount() || toY >= model.getItemCount()) return null;
   if (fromY == toY) {
     final String line =
         appearance.getScreenAppearance(
             model.getItem(fromY - 1), ListItemAppearance.FOR_CLIPBOARD);
     if (line.isEmpty()) return null;
     final int fromPos = fromX < line.length() ? fromX : line.length();
     final int toPos = toX < line.length() ? toX : line.length();
     if (fromPos >= toPos) return null;
     return new RegionContent(new String[] {line.substring(fromPos, toPos)});
   }
   final LinkedList<String> res = new LinkedList<String>();
   for (int i = fromY; i <= toY; ++i) {
     if (i == 0) continue;
     final String line =
         appearance.getScreenAppearance(model.getItem(i - 1), ListItemAppearance.FOR_CLIPBOARD);
     res.add(line != null ? line : "");
   }
   res.add("");
   return new RegionContent(res.toArray(new String[res.size()]));
 }
コード例 #4
0
ファイル: ListPopupBase.java プロジェクト: rPman/luwrain
 public Object selected() {
   if (items == null || hotPointY < 1 || hotPointY > items.length) return null;
   return model.getItem(hotPointY - 1);
 }