001/* 002 * #%L 003 * GwtBootstrap3 004 * %% 005 * Copyright (C) 2015 GwtBootstrap3 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package gwt.material.design.client.base.error; 021 022import com.google.gwt.editor.client.Editor; 023import com.google.gwt.editor.client.EditorError; 024 025/** 026 * Basic {@link EditorError} implementation. 027 */ 028public class BasicEditorError implements EditorError { 029 030 protected boolean consumed = false; 031 032 protected Editor<?> editor = null; 033 034 protected String message = null; 035 036 protected Object value = null; 037 038 /** 039 * Create an new error. 040 * 041 * @param editor the editor 042 * @param value the value 043 * @param message the message 044 */ 045 public BasicEditorError(Editor<?> editor, Object value, String message) { 046 this.editor = editor; 047 this.value = value; 048 this.message = message; 049 } 050 051 @Override 052 public String getAbsolutePath() { 053 return null; 054 } 055 056 @Override 057 public Editor<?> getEditor() { 058 return editor; 059 } 060 061 @Override 062 public String getMessage() { 063 // TODO We may need to format the message using MessageFormat. 064 return message; 065 } 066 067 @Override 068 public String getPath() { 069 return null; 070 } 071 072 @Override 073 public Object getUserData() { 074 return null; 075 } 076 077 @Override 078 public Object getValue() { 079 return value; 080 } 081 082 @Override 083 public boolean isConsumed() { 084 return consumed; 085 } 086 087 @Override 088 public void setConsumed(boolean consumed) { 089 this.consumed = consumed; 090 } 091}