public static Unit getUnitFromSymbol(String symbol) {
if (symbol == null) {
- return null;
+ return Unit.PIXELS; // Defaults to pixels
}
for (Unit unit : Unit.values()) {
if (symbol.equals(unit.getSymbol())) {
return unit;
}
}
- return null;
+ return Unit.PIXELS; // Defaults to pixels
}
}
public UserError(String message, ContentMode contentMode,
ErrorLevel errorLevel) {
+ if (contentMode == null) {
+ contentMode = ContentMode.TEXT;
+ }
+ if (errorLevel == null) {
+ errorLevel = ErrorLevel.ERROR;
+ }
msg = message;
mode = contentMode;
level = errorLevel;
/*
* (non-Javadoc)
*
- * @see com.vaadin.terminal.Sizeable#setHeight(float, int)
+ * @see com.vaadin.terminal.Sizeable#setHeight(float, Unit)
*/
public void setHeight(float height, Unit unit) {
+ if (unit == null) {
+ throw new IllegalArgumentException("Unit can not be null");
+ }
this.height = height;
heightUnit = unit;
requestRepaint();
/*
* (non-Javadoc)
*
- * @see com.vaadin.terminal.Sizeable#setWidth(float, int)
+ * @see com.vaadin.terminal.Sizeable#setWidth(float, Unit)
*/
public void setWidth(float width, Unit unit) {
+ if (unit == null) {
+ throw new IllegalArgumentException("Unit can not be null");
+ }
this.width = width;
widthUnit = unit;
requestRepaint();
* @return the header for the specified column if it has one.
*/
public String getColumnHeader(Object propertyId) {
- if (getColumnHeaderMode() == COLUMN_HEADER_MODE_HIDDEN) {
+ if (getColumnHeaderMode() == ColumnHeaderMode.HIDDEN) {
return null;
}
String header = columnHeaders.get(propertyId);
- if ((header == null && getColumnHeaderMode() == COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID)
- || getColumnHeaderMode() == COLUMN_HEADER_MODE_ID) {
+ if ((header == null && getColumnHeaderMode() == ColumnHeaderMode.EXPLICIT_DEFAULTS_ID)
+ || getColumnHeaderMode() == ColumnHeaderMode.ID) {
header = propertyId.toString();
}
* the New value of property columnHeaderMode.
*/
public void setColumnHeaderMode(ColumnHeaderMode columnHeaderMode) {
+ if(columnHeaderMode == null){
+ throw new IllegalArgumentException("Column header mode can not be null");
+ }
if (columnHeaderMode != this.columnHeaderMode) {
this.columnHeaderMode = columnHeaderMode;
requestRepaint();
}
private boolean areColumnHeadersEnabled() {
- return getColumnHeaderMode() != COLUMN_HEADER_MODE_HIDDEN;
+ return getColumnHeaderMode() != ColumnHeaderMode.HIDDEN;
}
private void paintVisibleColumns(PaintTarget target) throws PaintException {