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

Java tutorial

Introduction

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

Source

// Description: Java 8 JavaFX Add Pane implementation for Index.

/*
 *   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.*;

/**
 *   CFBamJavaFXIndexAddPane JavaFX Add Pane implementation
 *   for Index.
 */
public class CFBamJavaFXIndexAddPane extends CFSplitPane implements ICFBamJavaFXIndexPaneCommon {
    protected ICFFormManager cfFormManager = null;
    protected ICFBamJavaFXSchema javafxSchema = null;
    protected ScrollPane attrScrollPane = null;
    protected CFGridPane attrPane = null;

    public CFBamJavaFXIndexAddPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
            ICFBamIndexObj 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.getIndexFactory().newAttrPane(cfFormManager, argFocus);
        attrScrollPane = new ScrollPane(attrPane);
        attrScrollPane.setFitToWidth(true);
        attrScrollPane.setHbarPolicy(ScrollBarPolicy.NEVER);
        attrScrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        attrScrollPane.setContent(attrPane);
        setOrientation(Orientation.VERTICAL);
        getItems().add(attrScrollPane);
    }

    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 ICFLibAnyObj getJavaFXFocus() {
        ICFLibAnyObj obj;
        if (attrPane != null) {
            obj = attrPane.getJavaFXFocus();
        } else {
            obj = null;
        }
        return (obj);
    }

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

    public void setJavaFXFocusAsIndex(ICFBamIndexObj value) {
        setJavaFXFocus(value);
    }

    public ICFBamIndexObj getJavaFXFocusAsIndex() {
        return ((ICFBamIndexObj) getJavaFXFocus());
    }

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