Package com.eteks.sweethome3d.swing

Examples of com.eteks.sweethome3d.swing.NullableCheckBox


              elevationChangeListener);
        }
      });

    // Create movable check box bound to MOVABLE controller property
    this.movableCheckBox = new NullableCheckBox(SwingTools.getLocalizedLabelText(preferences,
        FurniturePanel.class, "movableCheckBox.text"));
    this.movableCheckBox.setNullable(controller.getMovable() == null);
    this.movableCheckBox.setValue(controller.getMovable());
    final PropertyChangeListener movableChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
        movableCheckBox.setNullable(ev.getNewValue() == null);
        movableCheckBox.setValue((Boolean)ev.getNewValue());
      }
    };
    controller.addPropertyChangeListener(FurnitureController.Property.MOVABLE, movableChangeListener);
    this.movableCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          controller.removePropertyChangeListener(FurnitureController.Property.MOVABLE, movableChangeListener);
          controller.setMovable(movableCheckBox.getValue());
          controller.addPropertyChangeListener(FurnitureController.Property.MOVABLE, movableChangeListener);
        }
      });
   
    // Create doorOrWindow check box bound to DOOR_OR_WINDOW controller property
    this.doorOrWindowCheckBox = new NullableCheckBox(SwingTools.getLocalizedLabelText(preferences,
        FurniturePanel.class, "doorOrWindowCheckBox.text"));
    this.doorOrWindowCheckBox.setNullable(controller.getDoorOrWindow() == null);
    this.doorOrWindowCheckBox.setValue(controller.getDoorOrWindow());
    final PropertyChangeListener doorOrWindowChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
        doorOrWindowCheckBox.setNullable(ev.getNewValue() == null);
        doorOrWindowCheckBox.setValue((Boolean)ev.getNewValue());
      }
    };
    controller.addPropertyChangeListener(FurnitureController.Property.DOOR_OR_WINDOW, doorOrWindowChangeListener);
    this.doorOrWindowCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          controller.removePropertyChangeListener(FurnitureController.Property.DOOR_OR_WINDOW, doorOrWindowChangeListener);
          controller.setDoorOrWindow(doorOrWindowCheckBox.getValue());
          controller.addPropertyChangeListener(FurnitureController.Property.DOOR_OR_WINDOW, doorOrWindowChangeListener);
        }
      });
   
    // Create back face shown check box bound to BACK_FACE_SHOWN controller property
    this.backFaceShownCheckBox = new NullableCheckBox(SwingTools.getLocalizedLabelText(preferences,
        FurniturePanel.class, "backFaceShownCheckBox.text"));
    this.backFaceShownCheckBox.setNullable(controller.getBackFaceShown() == null);
    this.backFaceShownCheckBox.setValue(controller.getBackFaceShown());
    final PropertyChangeListener backFaceShownChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
        backFaceShownCheckBox.setNullable(ev.getNewValue() == null);
        backFaceShownCheckBox.setValue((Boolean)ev.getNewValue());
      }
    };
    controller.addPropertyChangeListener(FurnitureController.Property.BACK_FACE_SHOWN, backFaceShownChangeListener);
    this.backFaceShownCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          controller.removePropertyChangeListener(FurnitureController.Property.BACK_FACE_SHOWN, backFaceShownChangeListener);
          controller.setBackFaceShown(backFaceShownCheckBox.getValue());
          resetIcon(false);
          controller.addPropertyChangeListener(FurnitureController.Property.BACK_FACE_SHOWN, backFaceShownChangeListener);
        }
      });
   
    // Create resizable check box bound to RESIZABLE controller property
    this.resizableCheckBox = new NullableCheckBox(SwingTools.getLocalizedLabelText(preferences,
        FurniturePanel.class, "resizableCheckBox.text"));
    this.resizableCheckBox.setNullable(controller.getResizable() == null);
    this.resizableCheckBox.setValue(controller.getResizable());
    final PropertyChangeListener resizableChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
        resizableCheckBox.setNullable(ev.getNewValue() == null);
        resizableCheckBox.setValue((Boolean)ev.getNewValue());
      }
    };
    controller.addPropertyChangeListener(FurnitureController.Property.RESIZABLE, resizableChangeListener);
    this.resizableCheckBox.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent ev) {
          controller.removePropertyChangeListener(FurnitureController.Property.RESIZABLE, resizableChangeListener);
          controller.setResizable(resizableCheckBox.getValue());
          controller.addPropertyChangeListener(FurnitureController.Property.RESIZABLE, resizableChangeListener);
        }
      });
   
    // Create deformable check box bound to DEFORMABLE controller property
    this.deformableCheckBox = new NullableCheckBox(SwingTools.getLocalizedLabelText(preferences,
        FurniturePanel.class, "deformableCheckBox.text"));
    this.deformableCheckBox.setNullable(controller.getDeformable() == null);
    this.deformableCheckBox.setValue(controller.getDeformable());
    final PropertyChangeListener deformableChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
View Full Code Here


    // Retrieve RoomPanel components
    RoomPanel wallPanel = (RoomPanel)TestUtilities.findComponent(
        attributesDialog, RoomPanel.class);
    JTextField nameTextField =
        (JTextField)TestUtilities.getField(wallPanel, "nameTextField");
    NullableCheckBox areaVisibleCheckBox =
        (NullableCheckBox)TestUtilities.getField(wallPanel, "areaVisibleCheckBox");
    NullableCheckBox floorVisibleCheckBox =
        (NullableCheckBox)TestUtilities.getField(wallPanel, "floorVisibleCheckBox");
    NullableCheckBox ceilingVisibleCheckBox =
        (NullableCheckBox)TestUtilities.getField(wallPanel, "ceilingVisibleCheckBox");
    // Check name is empty and check boxes are selected
    assertTrue("Name not empty", nameTextField.getText().length() == 0);
    assertTrue("Area check box isn't checked", areaVisibleCheckBox.getValue());
    assertTrue("Floor check box isn't checked", floorVisibleCheckBox.getValue());
    assertTrue("Ceiling check box isn't checked", ceilingVisibleCheckBox.getValue());
   
    // Enter a name and unchecked boxes
    nameTextField.setText("Test");
    tester.click(areaVisibleCheckBox);
    tester.click(floorVisibleCheckBox);
View Full Code Here

TOP

Related Classes of com.eteks.sweethome3d.swing.NullableCheckBox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.