Example usage for java.beans PropertyChangeSupport PropertyChangeSupport

List of usage examples for java.beans PropertyChangeSupport PropertyChangeSupport

Introduction

In this page you can find the example usage for java.beans PropertyChangeSupport PropertyChangeSupport.

Prototype

public PropertyChangeSupport(Object sourceBean) 

Source Link

Document

Constructs a PropertyChangeSupport object.

Usage

From source file:org.jtrfp.trcl.core.TR.java

public TR() {
    try {/*from  w  w w . jav a  2 s.  c o  m*/
        new OutputDump();
    } catch (Exception e) {
        e.printStackTrace();
    }
    AutoInitializable.Initializer.initialize(this);
    pcSupport = new PropertyChangeSupport(this);
    rootWindow = new RootWindow();
    if (config.isWaitForProfiler()) {
        waitForProfiler();
    } //end if(waitForProfiler)
    keyStatus = new KeyStatus(rootWindow);
    gpu = new TRFutureTask<GPU>(this, new Callable<GPU>() {
        @Override
        public GPU call() throws Exception {
            return new GPU(TR.this);
        }
    });
    soundSystem = new TRFutureTask<SoundSystem>(this, new Callable<SoundSystem>() {
        @Override
        public SoundSystem call() throws Exception {
            return new SoundSystem(TR.this);
        }
    });
    threadManager = new ThreadManager(this);
    threadManager.threadPool.submit(gpu);
    threadManager.threadPool.submit(soundSystem);//TODO: Use new methods
    System.out.println("Initializing graphics engine...");
    mainRenderer = new TRFutureTask<Renderer>(this, new Callable<Renderer>() {
        @Override
        public Renderer call() throws Exception {
            Thread.currentThread().setName("Renderer constructor.");
            return gpu.get().rendererFactory.get().newRenderer();
        }//end call()
    });
    threadManager.threadPool.submit(mainRenderer);
    matrixWindow = new TRFutureTask<MatrixWindow>(this, new Callable<MatrixWindow>() {
        @Override
        public MatrixWindow call() throws Exception {
            return new MatrixWindow(TR.this);
        }//end call()
    });
    threadManager.threadPool.submit(matrixWindow);
    objectListWindow = new TRFutureTask<ObjectListWindow>(this, new Callable<ObjectListWindow>() {
        @Override
        public ObjectListWindow call() throws Exception {
            return new ObjectListWindow(TR.this);
        }//end call()
    });
    threadManager.threadPool.submit(objectListWindow);
    objectDefinitionWindow = new TRFutureTask<ObjectDefinitionWindow>(this,
            new Callable<ObjectDefinitionWindow>() {
                @Override
                public ObjectDefinitionWindow call() throws Exception {
                    return new ObjectDefinitionWindow(TR.this);
                }//end call()
            });
    threadManager.threadPool.submit(objectDefinitionWindow);
    System.out.println("...Done");
    setResourceManager(new ResourceManager(this));

    final Renderer renderer = mainRenderer.get();
    renderer.setRootGrid(getDefaultGrid());//TODO: replace with Camera objects?
    renderer.setCollisionManager(getCollisionManager());
    getThreadManager().addRepeatingGLTask(renderer.render);

    gameShell = new GameShell(this);
    menuSystem = new MenuSystem(this);
    gameShell.startShell();

    Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            try {
                config.saveConfig();
            } catch (Exception e) {
                System.err.println("Failed to write the config file.\n" + e.getLocalizedMessage() + "\n");
            } //end catch(Exception)
            System.err.println("Great work, Guys!");
        }//end run()
    });
}

From source file:org.mili.core.properties.DefaultChangeSupport.java

/**
 * Instantiates a new default change support.
 *
 * @param source the source/*ww w. jav  a2s .com*/
 */
protected DefaultChangeSupport(Object source) {
    Validate.notNull(source, "source cannot be null!");
    this.source = source;
    this.vcs = new VetoableChangeSupport(source);
    this.pcs = new PropertyChangeSupport(source);
}

From source file:org.openconcerto.erp.core.common.ui.DeviseField.java

private DeviseField(int columns, boolean autoCompletion, boolean bold) {
    super(columns);
    if (bold) {/*from w  ww.  java2  s .c o  m*/
        this.setFont(getFont().deriveFont(Font.BOLD));
    }
    this.supp = new PropertyChangeSupport(this);
    this.gained = false;
    this.autoCompletion = autoCompletion;
    this.getDocument().addDocumentListener(new SimpleDocumentListener() {
        public void update(DocumentEvent e) {
            DeviseField.this.textModified();
        }
    });
}

From source file:org.openconcerto.erp.panel.ITreeSelection.java

public ITreeSelection(SQLElement element) {
    super();//from w w  w. j a v  a 2 s  .co  m
    DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
    renderer.setOpenIcon(null);
    renderer.setClosedIcon(null);
    renderer.setLeafIcon(null);
    this.setCellRenderer(renderer);

    this.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    this.element = element;

    this.supp = new PropertyChangeSupport(this);

    // Value changed
    this.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            ITreeSelection.this.supp.firePropertyChange("value", null, getUncheckedValue());
        }
    });

}

From source file:org.openconcerto.sql.element.ElementSQLObject.java

/**
 * Create a new instance./*from  w  ww.j  a v  a  2 s .co  m*/
 * 
 * @param parent the component containing the private foreign key, eg RECEPTEUR.
 * @param comp the component to edit, eg OBSERVATION.
 */
public ElementSQLObject(SQLComponent parent, SQLComponent comp) {
    this.supp = new PropertyChangeSupport(this);
    this.validSupp = new ValidChangeSupport(this);
    this.parent = parent;
    this.comp = comp;
    this.required = false;
    this.comp.setOpaque(false);
    // first set the parent so it can be used in uiInit()
    this.comp.setSQLParent(this);
    this.comp.setNonExistantEditable(true);
    // only uiInit() comp when necessary
    this.comp.addValidListener(new ValidListener() {
        public void validChange(ValidObject src, ValidState newValue) {
            // don't fire if our objects change (eg combo reloading) while we're uncreated
            if (isCreated()) {
                ElementSQLObject.this.supp.firePropertyChange("value", null, null);
            }
            fireValidChange();
        }
    });

    this.addValidListener(new ValidListener() {
        public void validChange(ValidObject src, ValidState newValue) {
            compChanged();
        }
    });

    this.uiInit();
    // setCreated() checks this.created
    this.created = null;
    this.setCreated(false);
}

From source file:org.openconcerto.sql.sqlobject.ISQLElementWithCodeSelector.java

public ISQLElementWithCodeSelector(SQLElement e, SQLField optField, SQLRowValues defaultCreateRowValues) {

    this.optField = optField;
    this.element = e;
    this.updating = false;
    this.supp = new PropertyChangeSupport(this);
    this.emptyHelper = new EmptyObjectHelper(this, new Predicate() {
        public boolean evaluate(Object object /* cad le getUncheckedValue() */) {
            // final Integer val = (Integer) object;
            return ISQLElementWithCodeSelector.this.id == SQLRow.NONEXISTANT_ID;
        }/*from   w  ww  . ja v  a2  s  . com*/
    });
    if (defaultCreateRowValues == null) {
        this.defaultCreateRowValues = new SQLRowValues(e.getTable());
    } else {
        this.defaultCreateRowValues = defaultCreateRowValues;
    }
}

From source file:org.openconcerto.sql.view.listview.ListSQLView.java

public ListSQLView(SQLComponent parent, String name, ItemPoolFactory factory/*
                                                                             * , ListItemSQLView
                                                                             * style
                                                                             */) {
    this.parent = parent;
    this.name = name;
    this.pool = factory.create(this);

    this.supp = new PropertyChangeSupport(this);
    this.items = new ArrayList<ListItemSQLView>();

    this.addValidListener(new ValidListener() {
        public void validChange(ValidObject src, ValidState newValue) {
            // compChanged(); FIXME
        }/*  w w  w  .ja v a2 s.  co  m*/
    });

    this.addValueListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            ListSQLView.this.addBtn.setEnabled(getPool().availableItem());
        }
    });

    this.helper = new EmptyChangeSupport(this);

    this.addBtn = new JButton("Ajout");
    // for when an item is removed the following ones go up
    this.itemsPanel = new JPanel(new GridBagLayout());
    this.itemsConstraints = new GridBagConstraints();
    this.uiInit();
}

From source file:org.openide.windows.DummyWindowManager.java

public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
    if (pcs == null) {
        pcs = new PropertyChangeSupport(this);
    }//from  ww w  .j  a v  a 2  s  .c o  m
    pcs.addPropertyChangeListener(l);
}

From source file:org.photovault.swingui.selection.FieldController.java

/**
 * Constructory/*from  w w  w . j  a  v  a  2  s . c om*/
 * @param parentCtrl The parent controller
 * @param propName Name of the property represented
 */
public FieldController(PhotoSelectionController parentCtrl, String propName) {
    this.parentCtrl = parentCtrl;
    this.property = propName;
    propertySupport = new PropertyChangeSupport(this);
    values = new ArrayList();
}

From source file:org.protempa.AbstractPropositionDefinition.java

@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
    if (this.changes == null) {
        this.changes = new PropertyChangeSupport(this);
    }//from  w  w  w .java2 s  .  com
    if (this.changes != null) {
        this.changes.addPropertyChangeListener(listener);
    }
}