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