net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTokenDefViewEditPane.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTokenDefViewEditPane.java

Source

// Description: Java 8 JavaFX View/Edit Pane implementation for TokenDef.

/*
 *   CFBam
 *
 *   Copyright (c) 2014-2016 Mark Sobkow
 *   
 *   This program is available as free software under the GNU GPL v3, or
 *   under a commercial license from Mark Sobkow.  For commercial licensing
 *   details, please contact msobkow@sasktel.net.
 *   
 *   Under the terms of the GPL:
 *   
 *      This program is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation, either version 3 of the License, or
 *      (at your option) any later version.
 *     
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *     
 *      You should have received a copy of the GNU General Public License
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   
 */

package net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX;

import java.math.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import javafx.geometry.Orientation;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import net.sourceforge.msscodefactory.cflib.v2_7.CFLib.*;
import net.sourceforge.msscodefactory.cflib.v2_7.CFLib.JavaFX.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cfsecurity.v2_7.CFSecurity.*;
import net.sourceforge.msscodefactory.cfinternet.v2_7.CFInternet.*;
import net.sourceforge.msscodefactory.cfbam.v2_7.CFBam.*;
import net.sourceforge.msscodefactory.cfsecurity.v2_7.CFSecurityObj.*;
import net.sourceforge.msscodefactory.cfinternet.v2_7.CFInternetObj.*;
import net.sourceforge.msscodefactory.cfbam.v2_7.CFBamObj.*;

/**
 *   CFBamJavaFXTokenDefViewEditPane JavaFX View/Edit Pane implementation
 *   for TokenDef.
 */
public class CFBamJavaFXTokenDefViewEditPane extends CFSplitPane implements ICFBamJavaFXTokenDefPaneCommon {
    protected ICFFormManager cfFormManager = null;
    protected ICFBamJavaFXSchema javafxSchema = null;
    protected ScrollPane attrScrollPane = null;
    protected CFGridPane attrPane = null;
    protected CFTabPane eltTabPane = null;

    public CFBamJavaFXTokenDefViewEditPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
            ICFBamTokenDefObj argFocus) {
        super();
        final String S_ProcName = "construct-schema-focus";
        if (formManager == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                    "formManager");
        }
        cfFormManager = formManager;
        if (argSchema == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                    "argSchema");
        }
        // argFocus is optional; focus may be set later during execution as
        // conditions of the runtime change.
        javafxSchema = argSchema;
        setJavaFXFocus(argFocus);
        attrPane = argSchema.getTokenDefFactory().newAttrPane(cfFormManager, argFocus);
        attrScrollPane = new ScrollPane();
        attrScrollPane.setFitToWidth(true);
        attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
        attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        attrScrollPane.setContent(attrPane);
        eltTabPane = argSchema.getTokenDefFactory().newEltTabPane(cfFormManager, argFocus);
        setOrientation(Orientation.VERTICAL);
        getItems().add(attrScrollPane);
        getItems().add(eltTabPane);
    }

    public ICFFormManager getCFFormManager() {
        return (cfFormManager);
    }

    public void setCFFormManager(ICFFormManager value) {
        final String S_ProcName = "setCFFormManager";
        if (value == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "value");
        }
        cfFormManager = value;
    }

    public ICFBamJavaFXSchema getJavaFXSchema() {
        return (javafxSchema);
    }

    public void setJavaFXFocus(ICFLibAnyObj value) {
        final String S_ProcName = "setJavaFXFocus";
        if ((value == null) || (value instanceof ICFBamTokenDefObj)) {
            super.setJavaFXFocus(value);
        } else {
            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "value",
                    value, "ICFBamTokenDefObj");
        }
    }

    public void setJavaFXFocusAsTokenDef(ICFBamTokenDefObj value) {
        setJavaFXFocus(value);
    }

    public ICFBamTokenDefObj getJavaFXFocusAsTokenDef() {
        return ((ICFBamTokenDefObj) getJavaFXFocus());
    }

    public void setPaneMode(CFPane.PaneMode value) {
        CFPane.PaneMode oldMode = getPaneMode();
        if (oldMode == value) {
            return;
        }
        try {
            super.setPaneMode(value);
            ((ICFBamJavaFXTokenDefPaneCommon) attrPane).setPaneMode(value);
            ((ICFBamJavaFXTokenDefPaneCommon) eltTabPane).setPaneMode(value);
        } catch (Throwable t) {
            super.setPaneMode(oldMode);
            ((ICFBamJavaFXTokenDefPaneCommon) attrPane).setPaneMode(oldMode);
            ((ICFBamJavaFXTokenDefPaneCommon) eltTabPane).setPaneMode(oldMode);
            throw t;
        }
    }
}