Java 类javax.swing.table.TableStringConverter 实例源码

项目:ALEA    文件:EncodeTableModel.java   
public EncodeTableModel(String [] headings, List<EncodeFileRecord> records) {

        this.records = records;

        List<String> tmp = new ArrayList<String>();
        tmp.add("");  // Checkbox heading
        for(String h : headings) {
            String heading = h.trim();
            if(heading.length() > 0 && !"path".equals(heading)) {
                tmp.add(heading);
            }
        }
        //tmp.add("path");
        columnHeadings = tmp.toArray(new String[tmp.size()]);


        sorter = new TableRowSorter<EncodeTableModel>(this);

        sorter.setStringConverter(new TableStringConverter() {
            @Override
            public String toString(TableModel model, int row, int column) {
                final Object value = model.getValueAt(row, column);
                return value == null ? "" : value.toString();
            }
        });
    }
项目:Juicebox    文件:EncodeTableModel.java   
public EncodeTableModel(String[] headings, List<EncodeFileRecord> records) {

        this.records = records;

        List<String> tmp = new ArrayList<>();
        tmp.add("");  // Checkbox heading
        for (String h : headings) {
            String heading = h.trim();
            if (heading.length() > 0 && !"path".equals(heading)) {
                tmp.add(heading);
            }
        }
        //tmp.add("path");
        columnHeadings = tmp.toArray(new String[tmp.size()]);


        sorter = new TableRowSorter<>(this);

        sorter.setStringConverter(new TableStringConverter() {
            @Override
            public String toString(TableModel model, int row, int column) {
                final Object value = model.getValueAt(row, column);
                return value == null ? "" : value.toString();
            }
        });
    }
项目:breakout    文件:AnnotatingTableRowSorter.java   
@Override
public String getStringValueAt(int row, int column) {
    TableStringConverter converter = getStringConverter();
    if (converter != null) {
        // Use the converter
        String value = converter.toString(
                tableModel, row, column);
        if (value != null) {
            return value;
        }
        return "";
    }

    // No converter, use getValueAt followed by toString
    Object o = getValueAt(row, column);
    if (o == null) {
        return "";
    }
    String string = o.toString();
    if (string == null) {
        return "";
    }
    return string;
}
项目:incubator-netbeans    文件:ProfilerTable.java   
protected TableRowSorter createRowSorter() {
    ProfilerRowSorter s = new ProfilerRowSorter(getModel());
    s.setStringConverter(new TableStringConverter() {
        public String toString(TableModel model, int row, int column) {
            return getModelStringValue(row, column);
        }
    });
    s.setDefaultSortOrder(SortOrder.DESCENDING);
    s.setSortColumn(0);
    return s;
}
项目:PasswordSafe    文件:ZTableRowSorter.java   
public String getStringValueAt(int row, int column)
{
    TableStringConverter converter = getStringConverter();
    if(converter != null)
    {
        // Use the converter
        String value = converter.toString(model, row, column);
        if(value != null)
        {
            return value;
        }
        return "";
    }

    // No converter, use getValueAt followed by toString
    Object o = getValueAt(row, column);
    if(o == null)
    {
        return "";
    }
    String string = o.toString();
    if(string == null)
    {
        return "";
    }
    return string;
}
项目:BurpSuiteLoggerPlusPlus    文件:LogTable.java   
public String getStringValueAt(int row, int column) {
    TableStringConverter converter = LogTableRowSorter.this.getStringConverter();
    if(converter != null) {
        String value = converter.toString(LogTableRowSorter.this.tableModel, row, column);
        return value != null?value:"";
    } else {
        Object o = this.getValueAt(row, column);
        if(o == null) {
            return "";
        } else {
            String string = o.toString();
            return string == null?"":string;
        }
    }
}
项目:breakout    文件:AnnotatingTableRowSorter.java   
/**
 * Returns the object responsible for converting values from the model to
 * strings.
 *
 * @return object responsible for converting values to strings.
 */
public TableStringConverter getStringConverter() {
    return stringConverter;
}
项目:breakout    文件:AnnotatingTableRowSorter.java   
/**
 * Sets the object responsible for converting values from the model to
 * strings. If non-<code>null</code> this is used to convert any object
 * values, that do not have a registered <code>Comparator</code>, to
 * strings.
 *
 * @param stringConverter
 *            the object responsible for converting values from the model to
 *            strings
 */
public void setStringConverter(TableStringConverter stringConverter) {
    this.stringConverter = stringConverter;
}