Package edu.stanford.bmir.protege.web.client.ui.editor

Source Code of edu.stanford.bmir.protege.web.client.ui.editor.ClassFrameEditorManager

package edu.stanford.bmir.protege.web.client.ui.editor;

import edu.stanford.bmir.protege.web.client.dispatch.actions.GetClassFrameAction;
import edu.stanford.bmir.protege.web.client.dispatch.actions.UpdateClassFrameAction;
import edu.stanford.bmir.protege.web.client.ui.frame.*;
import edu.stanford.bmir.protege.web.shared.dispatch.GetObjectAction;
import edu.stanford.bmir.protege.web.shared.dispatch.UpdateObjectAction;
import edu.stanford.bmir.protege.web.shared.frame.ClassFrame;
import edu.stanford.bmir.protege.web.shared.project.ProjectId;

/**
* Author: Matthew Horridge<br>
* Stanford University<br>
* Bio-Medical Informatics Research Group<br>
* Date: 23/04/2013
*/
public class ClassFrameEditorManager implements EditorManager<OWLEntityDataContext, LabelledFrame<ClassFrame>> {

    private ClassFrameEditor editor;

    private ProjectId projectId;

    public ClassFrameEditorManager() {

    }

    @Override
    public EditorView<LabelledFrame<ClassFrame>> getView(OWLEntityDataContext context) {
        if (editor == null || !projectId.equals(context.getProjectId())) {
            projectId = context.getProjectId();
            PropertyValueListEditor annotationsEditor = new PropertyValueListEditor(projectId);
            annotationsEditor.setGrammar(PropertyValueGridGrammar.getAnnotationsGrammar());
            PropertyValueListEditor propertiesEditor = new PropertyValueListEditor(projectId);
            propertiesEditor.setGrammar(PropertyValueGridGrammar.getClassGrammar());
            editor = new ClassFrameEditor(projectId, annotationsEditor, propertiesEditor);
        }
        return editor;
    }

    @Override
    public GetObjectAction<LabelledFrame<ClassFrame>> createGetObjectAction(OWLEntityDataContext editorContext) {
        return new GetClassFrameAction(editorContext.getEntityData().getEntity().asOWLClass(), editorContext.getProjectId());
    }

    @Override
    public UpdateObjectAction<LabelledFrame<ClassFrame>> createUpdateObjectAction(LabelledFrame<ClassFrame> pristineObject, LabelledFrame<ClassFrame> editedObject, OWLEntityDataContext editorContext) {
        return new UpdateClassFrameAction(editorContext.getProjectId(), pristineObject, editedObject);
    }

    @Override
    public String getDescription(OWLEntityDataContext editorContext) {
        return "Class description for " + editorContext.getEntityData().getBrowserText();
    }
}
TOP

Related Classes of edu.stanford.bmir.protege.web.client.ui.editor.ClassFrameEditorManager

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.