Search in sources :

Example 1 with PropertyPanel

use of org.jwildfire.swing.PropertyPanel in project JWildfire by thargor6.

the class DancingFractalsController method motionTableClicked.

public void motionTableClicked() {
    if (!refreshing) {
        if (motionPropertyPnl != null) {
            motionPropertyRootPnl.remove(motionPropertyPnl);
            motionPropertyPnl = null;
        }
        if (project.getMotions().size() > 0 && motionTable.getSelectedRow() >= 0 && motionTable.getSelectedRow() < project.getMotions().size()) {
            Motion motion = project.getMotions().get(motionTable.getSelectedRow());
            @SuppressWarnings("rawtypes") Map<Class, PropertyEditor> editors = new HashMap<Class, PropertyEditor>();
            editors.put(Motion.class, new MotionTypeEditor(project.getMotions()));
            motionPropertyPnl = new PropertyPanel(motion, editors);
            motionPropertyPnl.setDescriptionVisible(false);
            PropertyChangeListener listener = new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                    refreshing = true;
                    try {
                        int oldSel = motionTable.getSelectedRow();
                        refreshMotionTable();
                        motionTable.getSelectionModel().setSelectionInterval(oldSel, oldSel);
                        enableControls();
                    } finally {
                        refreshing = false;
                    }
                }
            };
            motionPropertyPnl.addPropertySheetChangeListener(listener);
            motionPropertyRootPnl.add(motionPropertyPnl, BorderLayout.CENTER);
            enableControls();
        }
    }
    refreshMotionLinksTable();
    motionPropertyRootPnl.invalidate();
    motionPropertyRootPnl.validate();
}
Also used : Motion(org.jwildfire.create.tina.dance.motion.Motion) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) HashMap(java.util.HashMap) ComboBoxPropertyEditor(com.l2fprod.common.beans.editor.ComboBoxPropertyEditor) PropertyEditor(java.beans.PropertyEditor) PropertyPanel(org.jwildfire.swing.PropertyPanel)

Aggregations

ComboBoxPropertyEditor (com.l2fprod.common.beans.editor.ComboBoxPropertyEditor)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 PropertyEditor (java.beans.PropertyEditor)1 HashMap (java.util.HashMap)1 Motion (org.jwildfire.create.tina.dance.motion.Motion)1 PropertyPanel (org.jwildfire.swing.PropertyPanel)1