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

clime.messadmin.providers.spi.BaseTabularServerDataProvider Maven / Gradle / Ivy

Go to download

Notification system and Session administration for J2EE Web Applications

There is a newer version: 4.1.1
Show newest version
/**
 * 
 */
package clime.messadmin.providers.spi;

import java.text.NumberFormat;


/**
 * Base implementation class for ServerDataProvider displaying tabular data.
 * @author Cédrik LIME
 */
public abstract class BaseTabularServerDataProvider extends BaseTabularDataProvider implements ServerDataProvider {

	/**
	 * 
	 */
	public BaseTabularServerDataProvider() {
		super();
	}

	/**
	 * @return application-specific data labels for given HttpSession, or null if it can be determined
	 */
	public abstract String[] getServerTabularDataLabels();
	/**
	 * @return application-specific data values for given HttpSession, or null if it can be determined
	 */
	public abstract Object[][] getServerTabularData();

	protected String getTableCaption(String[] labels, Object[][] values) {
		NumberFormat numberFormatter = NumberFormat.getNumberInstance();
		return ""+numberFormatter.format(values.length)+" server-specific attributes";
	}

	/**
	 * {@inheritDoc}
	 */
	public String getXHTMLServerData() {
		try {
			String[] labels = getServerTabularDataLabels();
			Object[][] values = getServerTabularData();
			return buildXHTML(labels, values, "extraServerAttributesTable-"+getClass().getName(), getTableCaption(labels, values));
		} catch (RuntimeException rte) {
			return "Error in " + this.getClass().getName() + ": " + rte;
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy