All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alee.laf.table.renderers.WebTableDateCellRenderer Maven / Gradle / Ivy

The newest version!
/*
 * This file is part of WebLookAndFeel library.
 *
 * WebLookAndFeel library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * WebLookAndFeel library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with WebLookAndFeel library.  If not, see .
 */

package com.alee.laf.table.renderers;

import com.alee.laf.table.TableCellParameters;
import com.alee.managers.style.StyleId;

import javax.swing.*;
import java.text.DateFormat;
import java.util.Date;

/**
 * Default {@link javax.swing.table.TableCellRenderer} implementation for {@link Date} values.
 *
 * @param  {@link Date} type
 * @param  {@link JTable} type
 * @param 

{@link TableCellParameters} type * @author Mikle Garin */ public class WebTableDateCellRenderer> extends WebTableCellRenderer { /** * {@link DateFormat}. */ protected DateFormat dateFormat; @Override protected void updateStyleId ( final P parameters ) { setStyleId ( StyleId.tableCellRendererDate.at ( parameters.table () ) ); } @Override protected String textForValue ( final P parameters ) { return parameters.value () != null ? getDateFormat ().format ( parameters.value () ) : ""; } /** * Returns {@link DateFormat}. * * @return {@link DateFormat} */ protected DateFormat getDateFormat () { if ( dateFormat == null ) { dateFormat = DateFormat.getDateInstance (); } return dateFormat; } /** * A subclass of {@link WebTableDateCellRenderer} that implements {@link javax.swing.plaf.UIResource}. * It is used to determine cell renderer provided by the UI class to properly uninstall it on UI uninstall. * * @param {@link Date} type * @param {@link JTable} type * @param

{@link TableCellParameters} type */ public static final class UIResource> extends WebTableDateCellRenderer implements javax.swing.plaf.UIResource { /** * Implementation is used completely from {@link WebTableDateCellRenderer}. */ } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy