import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class FrameEditor extends ObjEditor implements //ItemListener, ChangeListener, ObjectUI, ActionListener { FrameEditor(FrameSelector inBP, GroupEditor callee) { super(inBP,callee); objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee); frameselect = (FrameSelector) inBP; // parent = p; //SetupUI2(callee.objEditor); SetupUI2(objEditor); } // TEMP FrameEditor(FrameSelector inClient, Object3D localCopy, GroupEditor callee) { this(inClient, localCopy, null, callee); } FrameEditor(FrameSelector inBP, ObjectUI p, GroupEditor callee) { super(inBP,callee); objEditor = callee.GetEditor(); // new ObjEditor(inBP, this, callee); frameselect = (FrameSelector) inBP; parent = p; SetupUI2(callee.objEditor); } FrameEditor(FrameSelector inBP, Object3D copy, ObjectUI p, GroupEditor callee) // boolean ends) { //super(inBP, copy, callee); super(inBP, copy, p, callee); objEditor = this; //objEditor = new ObjEditor(inBP, copy, this, callee); // ?? super.parent = p; frameselect = (FrameSelector) copy; parent = p; //objEditor.SetupUI(false); // ? //objEditor.SetupViews(); // ? SetupUI2(objEditor); } void SetupUI2(ObjEditor oe) { /* oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; oe.aConstraints.gridx = 0; oe.aConstraints.weighty = 0; oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH+1; oe.ctrlPanel.add(nameField = new JTextField(biparam.name), oe.aConstraints); nameField.addActionListener(this); oe.aConstraints.gridy += 1; oe.aConstraints.gridwidth = 1; */ super.SetupUI2(oe); oe.aConstraints.gridwidth = 1; oe.aConstraints.fill = GridBagConstraints.VERTICAL; oe.ctrlPanel.add(frameLabel = new JLabel("Frame: "), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2); oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; // 1; oe.aConstraints.gridx += 1; oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH; oe.ctrlPanel.add(frameField = new NumberSlider(0, frameselect.getNumFrames()), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2); frameField.setInteger(frameselect.frame); oe.aConstraints.gridy += 1; oe.aConstraints.gridwidth = 1; oe.aConstraints.fill = 0; oe.aConstraints.gridx -= 1; oe.aConstraints.fill = GridBagConstraints.VERTICAL; oe.aConstraints.gridy += 1; oe.aConstraints.gridx = 0; frameField.addChangeListener(this); } void Clear() { objEditor.Clear(); frameselect = null; } // public void itemStateChanged(ItemEvent e) // { // if (//e.getSource() == nameField || // e.getSource() == endcaps) // { // //System.out.println(e); // frameselect.endcaps = (e.getStateChange() == ItemEvent.SELECTED); // //Refresh(); // frameselect.retile(); // applySelf(); // //super.applySelf(); // objEditor.refreshContents(); // } // else // { // super.itemStateChanged(e); // } // } // public void actionPerformed(ActionEvent e) // { // if (//e.getSource() == nameField || // e.getSource() == endcaps) // { // //System.out.println(e); // applySelf(); // //super.applySelf(); // refreshContents(); // //Refresh(); // } // else // { // super.actionPerformed(e); // } // } public void stateChanged(ChangeEvent e) { //System.out.println("Biparam :: stateChanged"); if (e.getSource() == frameField) { //System.out.println("#U = " + biparam.uDivs); //System.out.println("#V = " + biparam.vDivs); //new Exception().printStackTrace(); //System.out.println(e); applySelf(); //super.applySelf(); objEditor.refreshContents(); //Refresh(); } else super.stateChanged(e); } void Refresh() { // System.out.println("Biparam :: Refresh"); frameselect.frame = frameField.getInteger(); // biparam.minUDivs, 99); refreshContents(); } /* public void doLayout() { super.doLayout(); labelAndField(uDivsLabel, uDivsField); labelAndField(vDivsLabel, vDivsField); if (endcaps != null) { int h = endcaps.getPreferredSize().height; int w = endcaps.getPreferredSize().width; endcaps.setBounds(5, widgetPos, w, h); widgetPos += h; } widgetPos += 5; } */ /**/ public void applySelf() { //System.out.println("Biparam :: applySelf"); //super.applySelf(); frameselect.frame = frameField.getInteger(); // biparam.minUDivs, 99); //biparam.name = nameField.getText(); // june 2013 super.applySelf(); } /**/ public void closeUI() { ObjEditor oe = objEditor; frameField.removeChangeListener(this); oe.ctrlPanel.remove(frameField); oe.ctrlPanel.remove(frameLabel); //oe.ctrlPanel.repaint(); super.closeUI(); } public ObjEditor GetEditor() { return objEditor; } void refreshContents2() { objEditor.refreshContents(); } FrameSelector frameselect; JLabel frameLabel; NumberSlider frameField; ObjectUI parent; //ObjEditor objEditor; }