org.vaadin.tltv.vprocjs.ui.ProcessingCodeExtension.java Source code

Java tutorial

Introduction

Here is the source code for org.vaadin.tltv.vprocjs.ui.ProcessingCodeExtension.java

Source

/*
 * Copyright 2013 Tomi Virtanen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.vaadin.tltv.vprocjs.ui;

import org.vaadin.tltv.vprocjs.shared.ui.processingcode.ProcessingCodeState;

import com.vaadin.server.AbstractExtension;

/**
 * Abstract extension for the Java implementation of the sketches. This
 * extension allows us to write our own Java sketches. This acts as a
 * server-side link to the client-side code connector.
 * 
 */
@SuppressWarnings("serial")
public abstract class ProcessingCodeExtension extends AbstractExtension {

    @SuppressWarnings("unused")
    private Processing owner;
    private String processingJavaCodeClass;

    public void extend(Processing owner) {
        this.owner = owner;
        super.extend(owner);
    }

    /**
     * Get identifier for the client side Java implementation class of the
     * active sketch.
     * 
     */
    public String getProcessingJavaCodeClass() {
        return processingJavaCodeClass;
    }

    /**
     * Set identifier for the client side Java implementation of the active
     * sketch. Full class name is preferred.
     * 
     * @param processingJavaCodeClass
     */
    public void setProcessingJavaCodeClass(String processingJavaCodeClass) {
        this.processingJavaCodeClass = processingJavaCodeClass;
        getState().processingJavaCodeClass = this.processingJavaCodeClass;
    }

    @Override
    public ProcessingCodeState getState() {
        return (ProcessingCodeState) super.getState();
    }
}