Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
297,400
void (String representation) { this.str = representation; }
setRepresentation
297,401
String () { return str; }
toString
297,402
IParser (Format fmt, Comparator cmp, Comparator stringCmp, boolean ignoreCase, int modelIndex) { return new Parser(fmt, cmp, stringCmp, ignoreCase, modelIndex); }
createParser
297,403
Comparator<String> (boolean ignoreCase) { if (ignoreCase) { if (icStrComparator == null) { icStrComparator = String.CASE_INSENSITIVE_ORDER; } return icStrComparator; } if (strComparator == null) { strComparator = Comparator.naturalOrder(); } return strComparator; }
stringComparator
297,404
Format (Class<?> cl) { // for Strings, we just use null. Format fmt = basicFormats.get(cl); if (fmt == null) { if (cl == String.class) { fmt = new StringTypeFormat(); } else if (cl == Boolean.class) { fmt = new BooleanTypeFormat(); } else if (cl == Integer.class) { fmt = new IntegerTypeFormat(); } else if (cl == Long.class) { fmt = new LongTypeFormat(); } else if (cl == Short.class) { fmt = new ShortTypeFormat(); } else if (cl == Float.class) { fmt = new FloatTypeFormat(); } else if (cl == Double.class) { fmt = new DoubleTypeFormat(); } else if (cl == Byte.class) { fmt = new ByteTypeFormat(); } else if (cl == Character.class) { fmt = new CharacterTypeFormat(); } else if (cl == Date.class) { fmt = getDefaultDateFormat(); } if (fmt != null) { basicFormats.put(cl, fmt); } } return fmt; }
getBasicFormat
297,405
DateFormat () { String definition = FilterSettings.dateFormat; if (definition != null) { try { return new SimpleDateFormat(definition); } catch (Exception ex) { // return the basic format } } return DateFormat.getDateInstance(DateFormat.SHORT); }
getDefaultDateFormat
297,406
void (boolean set) { if (set) { JTable table = handler.getTable(); if (table != null) { if (listenedModel != null) { if (listenedModel == table.getModel()) { return; } setEnableTableModelEvents(false); } listenedModel = table.getModel(); listenedModel.addTableModelListener(this); } } else if (listenedModel != null) { listenedModel.removeTableModelListener(this); listenedModel = null; } }
setEnableTableModelEvents
297,407
int () { return model.getRowCount(); }
getModelRowCount
297,408
Format[] () { return formatters; }
getFormatters
297,409
IParserModel () { try { return parserModelClass.newInstance(); } catch (Exception ex) { throw new RuntimeException("Error creating parser model of type " + parserModelClass, ex); } }
newParserModel
297,410
String (String name, String defaultValue) { String ret = getString(name); return (ret == null) ? defaultValue : ret; }
getString
297,411
String (String name) { try { return System.getProperty(PROPERTIES_PREFIX + name); } catch (Exception ex) { return null; } }
getString
297,412
int (String name, int defaultValue) { String ret = getString(name); if (ret != null) { try { return Integer.parseInt(ret); } catch (Exception ex) { // return defaultValue } } return defaultValue; }
getInteger
297,413
Color (String name, Color defaultValue) { String prop = getString(name); if (prop != null) { try { return Color.decode(prop); } catch (Exception ex) { // return defaultValue } } return defaultValue; }
getColor
297,414
void (@Nullable RowFilter<?, ?> filter) { currentFilter = filter; RowSorter<?> sorter = getSorter(); if (sorter != null) { ((DefaultRowSorter)sorter).setRowFilter(filter); } }
setCurrentFilter
297,415
ChoicesHandler () { return choicesHandler; }
getChoicesHandler
297,416
boolean () { return filterOnUpdates; }
isFilterOnUpdates
297,417
void (boolean enable) { filterOnUpdates = enable; if (getSorter() != null) { ((DefaultRowSorter<?, ?>)getSorter()).setSortsOnUpdates(enable); } }
setFilterOnUpdates
297,418
boolean () { return choicesHandler instanceof AdaptiveChoicesHandler; }
isAdaptiveChoices
297,419
void (boolean enableAdaptiveChoices) { boolean reenable = false; if (choicesHandler != null) { if (enableAdaptiveChoices == isAdaptiveChoices()) { return; } enableNotifications(false); if (choicesHandler != null) { choicesHandler.setInterrupted(true); } reenable = true; } if (enableAdaptiveChoices) { choicesHandler = new AdaptiveChoicesHandler(this); } else { choicesHandler = new NonAdaptiveChoicesHandler(this); } if (reenable) { enableNotifications(true); } }
setAdaptiveChoices
297,420
void (FilterEditor editor) { AutoChoices autoChoices = editor.getAutoChoices(); if (autoChoices == AutoChoices.DISABLED) { editor.setChoices(editor.getCustomChoices()); } else { TableModel model = handler.getTable().getModel(); Class<?> c = model.getColumnClass(editor.getModelIndex()); boolean asEnum = c.equals(Boolean.class) || c.isEnum(); if (asEnum && (autoChoices != AutoChoices.ENUMS)) { editor.setAutoChoices(AutoChoices.ENUMS); } else if (!asEnum && (autoChoices == AutoChoices.ENUMS)) { editor.setAutoChoices(AutoChoices.DISABLED); } else if (asEnum) { Set choices = editor.getCustomChoices(); if (c.equals(Boolean.class)) { choices.add(true); choices.add(false); } else { Collections.addAll(choices, c.getEnumConstants()); } editor.setChoices(choices); } else { setChoicesFromModel(editor, model); } } }
initEditorChoices
297,421
void (FilterEditor editor, TableModel model) { editor.setChoices(modelExtract(editor, model, 0, model.getRowCount() - 1, editor.getCustomChoices())); }
setChoicesFromModel
297,422
Set (FilterEditor editor, TableModel model, int firstRow, int lastRow, Set fill) { return fill; }
modelExtract
297,423
void () { // recreate the filtersMap filtersMap.clear(); if (handler.getTable() != null) { for (FilterEditor fe : handler.getEditors()) { filtersMap.put(fe.getFilter(), fe); } // and the RowEntry Collection<FilterEditor> eds = handler.getEditors(); rowEntry = new RowEntry(handler.getTable().getModel(), eds.toArray(new FilterEditor[eds.size()])); } }
initialiseFiltersInfo
297,424
IFilterEditor (int modelColumn) { return (getColumnsController() == null) ? null : ((FilterColumnsControllerPanel)getColumnsController()).getFilterEditor(getTable().convertColumnIndexToView(modelColumn)); }
getFilterEditor
297,425
JTable () { return filtersHandler == null ? null : filtersHandler.getTable(); }
getTable
297,426
void (@Nullable JTable table) { filtersHandler.setTable(table); }
setTable
297,427
void (@Nullable JTable table) { filtersHandler.enableNotifications(false); super.installTable(table); filtersHandler.enableNotifications(true); }
installTable
297,428
void (boolean enable) { filtersHandler.setAdaptiveChoices(enable); }
setAdaptiveChoices
297,429
void () { getColumnsController().detach(); }
detachController
297,430
ColumnsControllerPanel () { JTable currentTable = Objects.requireNonNull(getTable()); return new TableFilterHeader.FilterColumnsControllerPanel(currentTable, getFont(), getForeground()); }
createColumnsController
297,431
FilterColumnPanel (int columnView) { boolean enabled = filtersHandler.isEnabled(); int columnModel = getTable().convertColumnIndexToModel(columnView); FilterEditor editor = createEditor(columnModel, enabled); FilterColumnPanel column = new FilterColumnPanel(getTableColumnModel().getColumn(columnView), editor); column.updateHeight(); getColumns().add(column); add(column); return column; }
createColumn
297,432
FilterEditor (int modelColumn, boolean enableIt) { FilterEditor ret = new FilterEditor(filtersHandler, modelColumn, getTable().getModel().getColumnClass(modelColumn)); ret.setMaxHistory(maxHistory); ret.setInstantFiltering(instantFilteringEnabled); ret.setAutoCompletion(autoCompletionEnabled); ret.getFilter().setEnabled(enableIt); filtersHandler.addFilterEditor(ret); return ret; }
createEditor
297,433
FilterEditor (int viewColumn) { return (getColumns().size() > viewColumn) ? ((FilterColumnPanel)getColumns().get(viewColumn)).editor : null; }
getFilterEditor
297,434
void () { // see the comment on columnAdded if ((--autoRun == 0)) { getTable(); handlerEnabled = null; updateHeight(); } filtersHandler.enableNotifications(true); }
updateColumns
297,435
void () { int h = 0; for (AdditionalPanel c : getColumns()) { h = Math.max(h, c.getMyHeight()); } myPreferredSize.height = h + filterRowHeightDelta; placeComponents(); repaint(); }
updateHeight
297,436
Dimension () { int count = getTableColumnModel().getColumnCount(); return new Dimension(0, (count == 0) ? 0 : (getColumns().get(0).getMyHeight() + filterRowHeightDelta)); }
computeMyPreferredSize
297,437
void () { if (editor != null) { filtersHandler.removeFilterEditor(editor); remove(editor); editor.getFilter().removeFilterObserver(this); for (IFilterHeaderObserver observer : observers) { observer.tableFilterEditorExcluded( TableFilterHeader.this, editor, getTableColumn()); } } getTableColumn().removePropertyChangeListener(this); }
detach
297,438
void () { setMyHeight(getPreferredSize().height); revalidate(); }
updateHeight
297,439
void (boolean set) { this.focusOnList = set; }
setFocusOnList
297,440
boolean () { return focusOnList; }
isFocusOnList
297,441
void (ChoiceRenderer cellRenderer) { renderer = cellRenderer; }
setUserRenderer
297,442
ChoiceRenderer () { return renderer; }
getUserRenderer
297,443
Component (Object value, int finalWidth, boolean focused) { setupRenderer(referenceList, value, -1, focused, false); width = finalWidth; showArrow = false; xDeltaBase = 0; return this; }
getCellRendererComponent
297,444
void (JList list, Object value, int index, boolean selected, boolean cellHasFocus) { inner = null; if (renderer != null) { try { inner = renderer.getRendererComponent(editor, value, selected); } catch (Exception ex) { // inner still null } } if (inner == null) { inner = defaultRenderer.getListCellRendererComponent(list, value, index, selected, cellHasFocus); } }
setupRenderer
297,445
boolean (Comparator choicesComparator, Comparator<String> stringComparator) { if (updateComparators(choicesComparator, stringComparator) || !renderedContent) { renderedContent = true; this.strComparator = stringComparator; clearContent(); return true; } return false; }
setRenderedContent
297,446
boolean (Format format, Comparator choicesComparator, Comparator<String> stringComparator) { if (stringComparator.equals(choicesComparator)) { choicesComparator = null; } boolean change = updateComparators(choicesComparator, stringComparator) || renderedContent; if (!change && (format != this.format)) { change = (this.format == null) || (format == null) || !this.format.equals(format); } if (change) { this.format = format; this.strComparator = stringComparator; renderedContent = false; clearContent(); } return change; }
setStringContent
297,447
void () { int currentSize = size; content.clear(); content.add(new Choice(CustomChoice.MATCH_ALL, null)); fireIntervalRemoved(this, size = 1, currentSize); }
clearContent
297,448
boolean (Collection addedContent, IChoicesParser parser) { boolean changed = false; for (Object o : addedContent) { String s = null; if (o == null) { o = CustomChoice.MATCH_EMPTY; } else if (!renderedContent && !(o instanceof CustomChoice)) { // if null, content is rendered, no need to handle strings s = (format == null) ? o.toString() : format.format(o); if (s.length() == 0) { o = CustomChoice.MATCH_EMPTY; } else { s = parser.escapeChoice(s); } } changed = content.add(new Choice(o, s)) || changed; } if (changed) { flatContent = null; alphaSortedContent = null; fireContentsChanged(this, 0, size = content.size()); } return changed; }
addContent
297,449
ChoiceMatch (Object hint) { String str = null; if (!renderedContent && (hint instanceof String)) { // is a string (what the user enters), but if there is a format, it // can correspond to an existing element. For example, the right // format being for a date "07/05/12", but the user enters // "7/5/12". In this case, we should automatically return the // updated string. For the time being, this conversion is not yet // made (requires changes on the EditorComponent, and side effects // must be checked...) str = (String) hint; hint = null; // for the time being, we } Choice choice = new Choice(hint, str); ChoiceMatch ret = new ChoiceMatch(); Choice match = (hint == null) ? null : content.floor(choice); if ((match != null) && match.equals(choice)) { flatContent(); // ensure that the positions are calculated ret.content = match.get(renderedContent); ret.index = match.idx; ret.exact = true; } else if (!renderedContent) { TreeSet<Choice> alphaContent = getAlphabeticallySortedContent(); Choice top = alphaContent.ceiling(choice); Choice low = alphaContent.floor(choice); int len = choice.str.length(); int clen = (top == null) ? -1 : ChoiceMatch.getMatchingLength(top.str, choice.str, strComparator); int flen = (low == null) ? -1 : ChoiceMatch.getMatchingLength(low.str, choice.str, strComparator); match = (clen > flen) ? top : low; ret.index = match.idx; ret.content = match.get(renderedContent); ret.len = Math.max(clen, flen); ret.exact = (match.str.length() == ret.len) && (len == 0 || ret.len > 0); } return ret; }
getBestMatch
297,450
String (String base, List<?> unsortedList) { int minLen = base.length(); int maxLen = Integer.MAX_VALUE; String ret = null; Iterator<Choice> it = getAlphabeticallySortedContent().tailSet( new Choice(base, base), true) .iterator(); Iterator<?> its = unsortedList.iterator(); while ((maxLen > minLen) && (it.hasNext() || its.hasNext())) { String s = it.hasNext() ? it.next().str : its.next().toString(); int match = ChoiceMatch.getMatchingLength(base, s, strComparator); if (match == minLen) { if (ret == null) { ret = s; maxLen = s.length(); } else { maxLen = Math.min(maxLen, ChoiceMatch.getMatchingLength(ret, s, strComparator)); } } } return (ret == null) ? "" : ret.substring(minLen, maxLen); }
getCompletion
297,451
TreeSet<Choice> () { if (alphaSortedContent == null) { flatContent(); // ensure we have the positions on the Choices alphaSortedContent = new TreeSet<>(new ChoiceTextComparator(strComparator)); alphaSortedContent.addAll(content); } return alphaSortedContent; }
getAlphabeticallySortedContent
297,452
Object[] () { if (flatContent == null) { int i = size; flatContent = new Object[size]; Iterator<Choice> it = content.descendingIterator(); while (i-- > 0) { flatContent[i] = it.next().index(i).get(renderedContent); } } return flatContent; }
flatContent
297,453
boolean (Comparator choicesComparator, Comparator<String> stringComparator) { boolean same = this.strComparator.equals(stringComparator); if (same){ if (choicesComparator==null){ same = this.contentComparator==null; } else { same = choicesComparator.equals(this.contentComparator); } } this.contentComparator = choicesComparator; this.strComparator = stringComparator; return !same; }
updateComparators
297,454
Comparator<String> () { return strComparator; }
getStringComparator
297,455
Choice (int position) { this.idx = position; return this; }
index
297,456
Object (boolean rendered) { return (rendered || (o instanceof CustomChoice)) ? o : str; }
get
297,457
void (List<Object> history) { this.lastAdded = null; this.shownHistory = history; this.history.clear(); if (!history.isEmpty()){ this.history.addAll(history.subList (0, Math.min(maxHistory, history.size()))); } }
initialize
297,458
List<Object> () { return new ArrayList<>(shownHistory); }
getShownHistory
297,459
void (Comparator<String> stringComparator) { if (this.stringComparator != stringComparator) { this.stringComparator = stringComparator; clear(); } }
setStringContent
297,460
int () { shownHistory = history; return shownHistory.size(); }
clearRestrictions
297,461
boolean (Object exclude) { int index = shownHistory.indexOf(exclude); if (index != -1) { if (shownHistory == history) { shownHistory = new ArrayList<>(history); } shownHistory.remove(index); fireIntervalAdded(this, index, index); return true; } return false; }
restrict
297,462
boolean (Object st) { // never add the passed element (which is now selected on the // editor). We will add it when the next element is passed boolean ret = false; boolean removed = history.remove(st); if ((maxHistory > 0) && (lastAdded != null) && (lastAdded.toString().length() > 0) && !lastAdded.equals(st)) { history.add(0, lastAdded); int size = history.size(); if (size > maxHistory) { history.remove(--size); removed = true; } else { ret = true; if (!removed) { fireIntervalAdded(this, 0, 0); } } } if (removed) { fireContentsChanged(this, 0, history.size()); ret = true; } lastAdded = st; shownHistory = history; return ret; }
add
297,463
boolean () { return shownHistory.isEmpty(); }
isEmpty
297,464
void () { int size = history.size(); if (size > 0) { history.clear(); shownHistory = history; fireIntervalRemoved(this, 0, size); } lastAdded = null; }
clear
297,465
void (int size) { maxHistory = size; int current = history.size(); if (current > size) { history.subList(size, current).clear(); shownHistory = history; fireContentsChanged(this, maxHistory, current); } }
setMaxHistory
297,466
int () { return maxHistory; }
getMaxHistory
297,467
List () { return history; }
getList
297,468
ChoiceMatch (Object hint) { ChoiceMatch ret = new ChoiceMatch(); if ((stringComparator != null) && (hint instanceof String strStart)) { int strLen = strStart.length(); int historyLen = shownHistory.size(); while (historyLen-- > 0) { Object content = shownHistory.get(historyLen); String str = content.toString(); int len = ChoiceMatch.getMatchingLength(strStart, str, stringComparator); if (((len > 0) && (len >= ret.len)) || (ret.len == 0)) { ret.content = content; ret.index = historyLen; ret.len = len; if ((len == strLen) && (str.length() == strLen)) { ret.exact = true; return ret; } } } } else { ret.index = shownHistory.indexOf(hint); if (ret.index != -1) { ret.exact = true; ret.content = hint; } } return ret; }
getClosestMatch
297,469
int (String a, String b, Comparator stringComparator) { int max = Math.min(a.length(), b.length()); for (int i = 0; i < max; i++) { char f = a.charAt(i); char s = b.charAt(i); if ((f != s) && (stringComparator.compare(String.valueOf(f), String.valueOf(s)) != 0)) { return i; } } return max; }
getMatchingLength
297,470
void (Object selection) { popupSelection(selection); }
choiceSelected
297,471
int () { return modelIndex; }
getModelIndex
297,472
IFilter () { return filter; }
getFilter
297,473
void () { popup.clearHistory(); setEditorContent(CustomChoice.MATCH_ALL); requestChoices(); }
resetFilter
297,474
void (Object content) { setEditorContent((content == null || "".equals(content)) ? CustomChoice.MATCH_ALL : content); }
setContent
297,475
Object () { return editor.getContent(); }
getContent
297,476
void (AutoChoices autoChoices) { if ((autoChoices != null) && (autoChoices != this.autoChoices)) { this.autoChoices = autoChoices; Object[] enums = modelClass.getEnumConstants(); if ((Boolean.class == modelClass) || ((enums != null) && (enums.length <= 8))) { setEditable(editor.isAutoCompletion() || (autoChoices == AutoChoices.DISABLED)); // the call to setEditable already invokes requestChoices setMaxHistory(0); } else { requestChoices(); } } }
setAutoChoices
297,477
AutoChoices () { return autoChoices; }
getAutoChoices
297,478
void (Set<CustomChoice> choices) { if ((choices == null) || choices.isEmpty()) { this.customChoices = null; } else { this.customChoices = new HashSet<>(choices); } requestChoices(); }
setCustomChoices
297,479
Set<CustomChoice> () { return (customChoices == null) ? new HashSet<>() : new HashSet<>(customChoices); }
getCustomChoices
297,480
void (boolean enable) { enabledUI = enable; setFilterEnabled(filter.isEnabled()); }
setUserInteractionEnabled
297,481
boolean () { return enabledUI; }
isUserInteractionEnabled
297,482
void (boolean editable) { if (getRenderer() == null) { editor.setTextMode(editable); requestChoices(); // escaping works now differently } }
setEditable
297,483
boolean () { return editor.isEditableContent(); }
isEditable
297,484
void (boolean set) { if (ignoreCase != set) { ignoreCase = set; formatOrComparatorUpdated(); } }
setIgnoreCase
297,485
boolean () { return ignoreCase; }
isIgnoreCase
297,486
void (Format format) { if (this.format != format) { this.format = format; // as bonus, override default Comparator for dates // if the instance is not a DateComparator, the user has set // its own comparator (perhaps has done it as well and it is // a DateComparator, but seems unlikely) if ((format != null) && (comparator instanceof DateComparator) && Date.class.isAssignableFrom(modelClass)) { setComparator(DateComparator.getDateComparator(format)); } else { formatOrComparatorUpdated(); } } }
setFormat
297,487
Format () { return format; }
getFormat
297,488
void (Comparator comparator) { // the comparator is used for sorting rendered choices, and for // comparison operations on the text parser if ((comparator != this.comparator) && (comparator != null)) { this.comparator = comparator; formatOrComparatorUpdated(); } }
setComparator
297,489
Comparator () { return comparator; }
getComparator
297,490
void (Comparator comparator) { this.choicesComparator = comparator; formatOrComparatorUpdated(); }
setChoicesComparator
297,491
Comparator () { return choicesComparator; }
getChoicesComparator
297,492
void (boolean enable) { editor.setAutoCompletion(enable); }
setAutoCompletion
297,493
boolean () { return editor.isAutoCompletion(); }
isAutoCompletion
297,494
void (boolean enable) { editor.setInstantFiltering(enable); }
setInstantFiltering
297,495
boolean () { return editor.isAllowedInstantVanishing(); }
isAllowedInstantVanishing
297,496
void (boolean enable) { editor.setAllowedInstantVanishing(enable); }
setAllowedInstantVanishing
297,497
boolean () { return editor.isInstantFiltering(); }
isInstantFiltering
297,498
void (int size) { popup.setMaxHistory(size); }
setMaxHistory
297,499
int () { return popup.getMaxHistory(); }
getMaxHistory