/** * Update the text in response to pressing TAB key. Searches through all * items of this result looking for longest common prefix and then calls * the substitution method on selected item providing it with the length * of common part. * * @return whether the text was successfully updated */ public boolean substituteCommonText(int dataIndex) { List data = getData(); if (data.size() == 0) return false; Iterator i = data.iterator(); char[] commonPrefix = ((CompletionQuery.ResultItem) i.next()).getItemText().toCharArray(); int commonLength = commonPrefix.length; for (; i.hasNext();) { String second = ((CompletionQuery.ResultItem) i.next()).getItemText(); commonLength = getCommonPrefixLength(commonPrefix, commonLength, second); } CompletionQuery.ResultItem actData = (CompletionQuery.ResultItem) data.get(dataIndex); return actData.substituteCommonText(component, offset, len, commonLength); }
/** Update the text in response to pressing ENTER. * @return whether the text was successfully updated */ public boolean substituteText(int dataIndex, boolean shift ) { Object actData = getData().get( dataIndex ); return ((CompletionQuery.ResultItem)actData).substituteText( component, offset, len, shift ); } }
/** Update the text in response to pressing TAB key. Searches through * all items of this result looking for longest common prefix and then * calls the substitution method on selected item providing it with * the length of common part. * @return whether the text was successfully updated */ public boolean substituteCommonText( int dataIndex ) { List data = getData(); if( data.size() == 0 ) return false; Iterator i = data.iterator(); char[] commonPrefix = ((CompletionQuery.ResultItem)i.next()).getItemText().toCharArray(); int commonLength = commonPrefix.length; for( ; i.hasNext(); ) { String second = ((CompletionQuery.ResultItem)i.next()).getItemText(); commonLength = getCommonPrefixLength( commonPrefix, commonLength, second ); } CompletionQuery.ResultItem actData = (CompletionQuery.ResultItem)data.get(dataIndex); return actData.substituteCommonText( component, offset, len, commonLength ); }
/** Update the text in response to pressing TAB key. Searches through * all items of this result looking for longest common prefix and then * calls the substitution method on selected item providing it with * the length of common part. * @return whether the text was successfully updated */ public boolean substituteCommonText( int dataIndex ) { List data = getData(); if( data.size() == 0 ) return false; Iterator i = data.iterator(); char[] commonPrefix = ((CompletionQuery.ResultItem)i.next()).getItemText().toCharArray(); int commonLength = commonPrefix.length; for( ; i.hasNext(); ) { String second = ((CompletionQuery.ResultItem)i.next()).getItemText(); commonLength = getCommonPrefixLength( commonPrefix, commonLength, second ); } CompletionQuery.ResultItem actData = (CompletionQuery.ResultItem)data.get(dataIndex); return actData.substituteCommonText( component, offset, len, commonLength ); }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if( value instanceof CompletionQuery.ResultItem ) { return ((CompletionQuery.ResultItem)value).getPaintComponent( list, isSelected, cellHasFocus ); } else { return defaultRenderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); } } }
/** Update the text in response to pressing ENTER. * @return whether the text was successfully updated */ public boolean substituteText(int dataIndex, boolean shift ) { Object actData = getData().get( dataIndex ); return ((CompletionQuery.ResultItem)actData).substituteText( component, offset, len, shift ); } }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if( value instanceof CompletionQuery.ResultItem ) { return ((CompletionQuery.ResultItem)value).getPaintComponent( list, isSelected, cellHasFocus ); } else { return defaultRenderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); } }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof CompletionQuery.ResultItem) { return ((CompletionQuery.ResultItem) value).getPaintComponent(list, isSelected, cellHasFocus); } else { return defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); } } }
/** * Update the text in response to pressing ENTER. * * @return whether the text was successfully updated */ public boolean substituteText(int dataIndex, boolean shift) { Object actData = getData().get(dataIndex); return ((CompletionQuery.ResultItem) actData).substituteText(component, offset, len, shift); } }