⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tableproperties.java

📁 dispalytag的源码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    /**     * Returns the configured list of media.     * @return the value of <code>PROPERTY_EXPORTTYPES</code>     */    public String[] getExportTypes()    {        String list = getProperty(PROPERTY_EXPORTTYPES);        if (list == null)        {            return new String[0];        }        return StringUtils.split(list);    }    /**     * Returns the class responsible for the given export.     * @param exportName export name     * @return String classname     */    public String getExportClass(String exportName)    {        return getProperty(PROPERTY_EXPORT_PREFIX + SEP + exportName + SEP + EXPORTPROPERTY_STRING_CLASS);    }    /**     * Returns an instance of configured requestHelperFactory.     * @return RequestHelperFactory instance.     * @throws FactoryInstantiationException if unable to load or instantiate the configurated class.     */    public RequestHelperFactory getRequestHelperFactoryInstance() throws FactoryInstantiationException    {        Object loadedObject = getClassPropertyInstance(PROPERTY_CLASS_REQUESTHELPERFACTORY);        // should not be null, but avoid errors just in case... see DISPL-148        if (loadedObject == null)        {            return new DefaultRequestHelperFactory();        }        try        {            return (RequestHelperFactory) loadedObject;        }        catch (ClassCastException e)        {            throw new FactoryInstantiationException(getClass(), PROPERTY_CLASS_REQUESTHELPERFACTORY, loadedObject                .getClass()                .getName(), e);        }    }    /**     * Returns an instance of configured DecoratorFactory.     * @return DecoratorFactory instance.     * @throws FactoryInstantiationException if unable to load or instantiate the configurated class.     */    public DecoratorFactory getDecoratorFactoryInstance() throws FactoryInstantiationException    {        Object loadedObject = getClassPropertyInstance(PROPERTY_CLASS_DECORATORFACTORY);        if (loadedObject == null)        {            return new DefaultDecoratorFactory();        }        try        {            return (DecoratorFactory) loadedObject;        }        catch (ClassCastException e)        {            throw new FactoryInstantiationException(getClass(), PROPERTY_CLASS_DECORATORFACTORY, loadedObject                .getClass()                .getName(), e);        }    }    public String getPaginationSortParam()    {        String result = getProperty(PROPERTY_STRING_PAGINATION_SORT_PARAM);        if (result == null)        {            result = "sort";        }        return result;    }    public String getPaginationPageNumberParam()    {        String result = getProperty(PROPERTY_STRING_PAGINATION_PAGE_NUMBER_PARAM);        if (result == null)        {            result = "page";        }        return result;    }    public String getPaginationSortDirectionParam()    {        String result = getProperty(PROPERTY_STRING_PAGINATION_SORT_DIRECTION_PARAM);        if (result == null)        {            result = "dir";        }        return result;    }    public String getPaginationSearchIdParam()    {        String result = getProperty(PROPERTY_STRING_PAGINATION_SEARCH_ID_PARAM);        if (result == null)        {            result = "searchId";        }        return result;    }    public String getPaginationAscValue()    {        String result = getProperty(PROPERTY_STRING_PAGINATION_ASC_VALUE);        if (result == null)        {            result = "asc";        }        return result;    }    public String getPaginationDescValue()    {        String result = getProperty(PROPERTY_STRING_PAGINATION_DESC_VALUE);        if (result == null)        {            result = "desc";        }        return result;    }    public boolean getPaginationSkipPageNumberInSort()    {        String s = getProperty(PROPERTY_BOOLEAN_PAGINATION_SKIP_PAGE_NUMBER_IN_SORT);        if (s == null)        {            return true;        }        else        {            return getBooleanProperty(PROPERTY_BOOLEAN_PAGINATION_SKIP_PAGE_NUMBER_IN_SORT);        }    }    // </JBN>    /**     * Returns the configured resource provider instance. If necessary instantiate the resource provider from config and     * then keep a cached instance.     * @return I18nResourceProvider instance.     * @see I18nResourceProvider     */    public I18nResourceProvider geResourceProvider()    {        String className = getProperty(PROPERTY_CLASS_LOCALEPROVIDER);        if (resourceProvider == null)        {            if (className != null)            {                try                {                    Class classProperty = ReflectHelper.classForName(className);                    resourceProvider = (I18nResourceProvider) classProperty.newInstance();                    log.info(Messages.getString("TableProperties.classinitializedto", //$NON-NLS-1$                        new Object[]{ClassUtils.getShortClassName(I18nResourceProvider.class), className}));                }                catch (Throwable e)                {                    log.warn(Messages.getString("TableProperties.errorloading", //$NON-NLS-1$                        new Object[]{                            ClassUtils.getShortClassName(I18nResourceProvider.class),                            e.getClass().getName(),                            e.getMessage()}));                }            }            else            {                log.info(Messages.getString("TableProperties.noconfigured", //$NON-NLS-1$                    new Object[]{ClassUtils.getShortClassName(I18nResourceProvider.class)}));            }            // still null?            if (resourceProvider == null)            {                // fallback provider, no i18n                resourceProvider = new I18nResourceProvider()                {                    // Always returns null                    public String getResource(String titleKey, String property, Tag tag, PageContext context)                    {                        return null;                    }                };            }        }        return resourceProvider;    }    /**     * Reads a String property.     * @param key property name     * @return property value or <code>null</code> if property is not found     */    private String getProperty(String key)    {        return this.properties.getProperty(key);    }    /**     * Sets a property.     * @param key property name     * @param value property value     */    public void setProperty(String key, String value)    {        this.properties.setProperty(key, value);    }    /**     * Reads a boolean property.     * @param key property name     * @return boolean <code>true</code> if the property value is "true", <code>false</code> for any other value.     */    private boolean getBooleanProperty(String key)    {        return Boolean.TRUE.toString().equals(getProperty(key));    }    /**     * Returns an instance of a configured Class. Returns a configured Class instantiated     * callingClass.forName([configuration value]).     * @param key configuration key     * @return instance of configured class     * @throws FactoryInstantiationException if unable to load or instantiate the configurated class.     */    private Object getClassPropertyInstance(String key) throws FactoryInstantiationException    {        Object instance = objectCache.get(key);        if (instance != null)        {            return instance;        }        String className = getProperty(key);        // shouldn't be null, but better check it        if (className == null)        {            return null;        }        try        {            Class classProperty = ReflectHelper.classForName(className);            instance = classProperty.newInstance();            objectCache.put(key, instance);            return instance;        }        catch (Exception e)        {            throw new FactoryInstantiationException(getClass(), key, className, e);        }    }    /**     * Reads an int property.     * @param key property name     * @param defaultValue default value returned if property is not found or not a valid int value     * @return property value     */    private int getIntProperty(String key, int defaultValue)    {        try        {            return Integer.parseInt(getProperty(key));        }        catch (NumberFormatException e)        {            // Don't care, use default            log.warn(Messages.getString("TableProperties.invalidvalue", //$NON-NLS-1$                new Object[]{key, getProperty(key), new Integer(defaultValue)}));        }        return defaultValue;    }    /**     * Obtain the name of the decorator configured for a given media type.     * @param thatEnum A media type     * @return The name of the decorator configured for a given media type.     * @deprecated Use getMediaTypeDecoratorName instead.     */    public String getExportDecoratorName(MediaTypeEnum thatEnum)    {        return getProperty(PROPERTY_EXPORT_PREFIX + SEP + thatEnum + SEP + PROPERTY_DECORATOR_SUFFIX);    }    /**     * Obtain the name of the decorator configured for a given media type.     * @param thatEnum A media type     * @return The name of the decorator configured for a given media type.     */	public String getMediaTypeDecoratorName(MediaTypeEnum thatEnum)	{        return getProperty(PROPERTY_DECORATOR_SUFFIX + SEP + PROPERTY_DECORATOR_MEDIA + SEP + thatEnum);	}    public Comparator getDefaultComparator()    {        String className = getProperty(PROPERTY_DEFAULT_COMPARATOR);          if (className != null)        {            try            {                Class classProperty = ReflectHelper.classForName(className);                return (Comparator) classProperty.newInstance();            }            catch (Throwable e)            {                log.warn(Messages.getString("TableProperties.errorloading", //$NON-NLS-1$                    new Object[]{                        ClassUtils.getShortClassName(Comparator.class),                        e.getClass().getName(),                        e.getMessage()}));            }        }        return new DefaultComparator(Collator.getInstance(getLocale()));    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -