@Override public String getPath( final String parent , final String name ) { return TextTools.endsWith( parent , '/' ) ? parent + name : parent + '/' + name; }
/** * Test if the specified CREATE line is a column definition. * * @param createLine CREATE line. * * @return {@code true} if the CREATE line is a column definition; {@code * false} otherwise. */ private static boolean isColumnDefinition( final CharSequence createLine ) { return TextTools.startsWith( createLine, '`' ); }
/** * Construct new monitor. * * @param locale Locale to use for internationalization. * @param owner Parent component to use for dialogs. * @param client {@link Client} to monitor. */ private ClientConnectionMonitor( final Locale locale, final Component owner, final Client client ) { _res = ResourceBundleTools.getBundle( ClientConnectionMonitor.class, locale ); _client = client; _owner = owner; }
/** * Set default icon for action. */ protected void setDefaultIcon() { final ResourceBundle bundle = _bundle; final String key = getActionCommand(); final String iconPath = ResourceBundleTools.getString( bundle, key + "Icon", null ); if ( iconPath != null ) { final int iconSize = ResourceBundleTools.getInt( bundle, key + "IconSize", -1 ); final int iconWidth = ResourceBundleTools.getInt( bundle, key + "IconWidth", iconSize ); final int iconHeight = ResourceBundleTools.getInt( bundle, key + "IconHeight", iconSize ); setSmallIcon( iconPath, iconWidth, iconHeight ); } }
@Override public boolean add( final T t ) { final int oldSize = size(); super.add( t ); fireIntervalAdded( oldSize, oldSize ); return true; }
@Override public void clear() { final int oldSize = size(); super.clear(); if ( oldSize > 0 ) { fireIntervalRemoved( 0, oldSize - 1 ); } }
/** * Sets the display name of the content. * * @param displayName Display name to be set. */ public void setDisplayName( @NotNull final LocalizedString displayName ) { _displayName.set( displayName ); }
@Override public void removeRange( final int fromIndex, final int toIndex ) { super.removeRange( fromIndex, toIndex ); fireIntervalRemoved( fromIndex, toIndex); }
@Override public T set( final int index, final T element ) { final T result = super.set( index, element ); fireContentsChanged( index, index ); return result; }
@Override public T remove( final int index ) { final T result = super.remove( index ); fireIntervalRemoved( index, index ); return result; }
/** * Set short description of action. Used for tooltip text. If {@code null} * is specified, any existing value is lost (removed). * * @param description Short description. * * @see #SHORT_DESCRIPTION */ public void setShortDescription( final String description ) { putValue( SHORT_DESCRIPTION, TextTools.plainTextToHTML( description ) ); }
@Override public void add( final int index, final T element ) { super.add( index, element ); fireIntervalAdded( index, index ); }
/** * Constructs an empty content object. */ public MemoryContent() { _value = null; _type = null; _displayName = new LocalizedString(); _description = new LocalizedString(); _thumbnails = new ArrayList<BufferedImage>(); }
@Override public String getDisplayName( @NotNull final Locale locale ) { return _displayName.get( locale ); }
@Override public Object getLabel( final Object value ) { final int index = ArrayTools.indexOf( value , _values ); if ( index < 0 ) { throw new IllegalArgumentException( "value: " + value ); } return _labels[ index ]; }
/** * Create database record object. * * @return Database record object. */ @NotNull public T createObject() { return BeanTools.newInstance( _dbClass ); }
/** * Prints the hexadecimal representation of the given byte to the standard * output. * * @param b Byte to dump. */ private void hexDump( final int b ) { System.out.print( TextTools.toHexString( b, 2, false ) ); if ( ++_hexDumpBytesWritten % _hexDumpWidth == 0 ) { System.out.println(); } else { System.out.print( ' ' ); } }
/** * Sets the description of the content. * * @param description Description to be set. */ public void setDescription( @NotNull final LocalizedString description ) { _description.set( description ); }
@Override public String getDescription( @NotNull final Locale locale ) { return _description.get( locale ); }