javaquery/canvas/src/main/java/org/apidesign/html/canvas/impl/CnvsAccssr.java
author Anton Epple <toni.epple@eppleton.de>
Tue, 11 Feb 2014 15:42:12 +0100
branchcanvas
changeset 1442 0660e56b5b33
parent 1308 e8429fba8cce
child 1449 6be5961e27ee
permissions -rw-r--r--
fixed null pointer exception (somewhat hacky solution)
     1 /**
     2  * Back 2 Browser Bytecode Translator
     3  * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, version 2 of the License.
     8  *
     9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program. Look for COPYING file in the top folder.
    16  * If not, see http://opensource.org/licenses/GPL-2.0.
    17  */
    18 /*
    19  * To change this template, choose Tools | Templates
    20  * and open the template in the editor.
    21  */
    22 package org.apidesign.html.canvas.impl;
    23 
    24 import net.java.html.canvas.GraphicsContext;
    25 import net.java.html.canvas.spi.GraphicsEnvironment;
    26 
    27 /**
    28  * 
    29  * @author antonepple
    30  */
    31 public abstract class CnvsAccssr {
    32 
    33     static CnvsAccssr DEFAULT;
    34 
    35     public CnvsAccssr() {
    36         if (DEFAULT!=null) throw new IllegalStateException("Already initialized");
    37         DEFAULT = this;
    38     }
    39 
    40     public static CnvsAccssr getDefault() {
    41         if (DEFAULT== null) GraphicsContext.getAccssr();
    42         return DEFAULT;
    43     }
    44 
    45     public abstract GraphicsContext create(GraphicsEnvironment environment);
    46 }