Package javax.swing

Examples of javax.swing.JDialog


        bitmapPanel.setGeneFont(textview.getFont());
        bitmapPanel.setArrayFont(arraynameview.getFont());
        bitmapPanel.setIncludedArrayHeaders(arraynameview.getHeaderSummary().getIncluded());
        bitmapPanel.setIncludedGeneHeaders(textview.getHeaderSummary().getIncluded());
       
        final JDialog popup = new CancelableSettingsDialog(viewFrame, "Export to Image", bitmapPanel);
        popup.pack();
        popup.setVisible(true);
      }
    });
    menu.add(bitmapItem);
   
   
View Full Code Here


    runAction(controller, HomeView.ActionType.IMPORT_BACKGROUND_IMAGE, tester);
    // Wait for import furniture view to be shown
    tester.waitForFrameShowing(new AWTHierarchy(), preferences.getLocalizedString(
        BackgroundImageWizardController.class, "wizard.title"));
    // Check dialog box is displayed
    JDialog wizardDialog = (JDialog)TestUtilities.findComponent(frame, JDialog.class);
    assertTrue("Wizard view dialog not showing", wizardDialog.isShowing());

    // Retrieve ImportedFurnitureWizardStepsPanel components
    BackgroundImageWizardStepsPanel panel = (BackgroundImageWizardStepsPanel)TestUtilities.findComponent(
        wizardDialog, BackgroundImageWizardStepsPanel.class);
    JButton imageChoiceOrChangeButton = (JButton)TestUtilities.getField(panel, "imageChoiceOrChangeButton");
View Full Code Here

    Room room = frame.home.getRooms().get(0);
    assertEquals("Wrong point count", 5, room.getPoints().length);
    assertEquals("Wrong room area", 69273.02f, room.getArea());
   
    // 4. Edit created room
    JDialog attributesDialog = showRoomPanel(frame.preferences, frame.homeController, frame, tester);
    // 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);
    tester.click(ceilingVisibleCheckBox);
   
    final JOptionPane attributesOptionPane = (JOptionPane)TestUtilities.findComponent(
        attributesDialog, JOptionPane.class);
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Select Ok option to hide dialog box in Event Dispatch Thread
          attributesOptionPane.setValue(JOptionPane.OK_OPTION);
        }
      });
    assertFalse("Dialog still showing", attributesDialog.isShowing());
   
    // Assert room was modified accordingly
    assertEquals("Name is incorrect", "Test", room.getName());
    assertFalse("Area is visible", room.isAreaVisible());
    assertFalse("Floor is visible", room.isFloorVisible());
View Full Code Here

      });
    // Wait for wall view to be shown
    tester.waitForFrameShowing(new AWTHierarchy(), preferences.getLocalizedString(
        RoomPanel.class, "room.title"));
    // Check dialog box is displayed
    JDialog attributesDialog = (JDialog)new BasicFinder().find(parent,
        new ClassMatcher (JDialog.class, true));
    assertTrue("Room dialog not showing", attributesDialog.isShowing());
    return attributesDialog;
  }
View Full Code Here

    // Check camera yaw changed
    assertCoordinatesAndAnglesEqualCameraLocationAndAngles(108.657f, 111.4631f, 170,
        2.5656f, 0.2139f, home.getCamera());
   
    // 11. Edit 3D view modal dialog box
    JDialog attributesDialog = showHome3DAttributesPanel(preferences, controller, frame, tester);
    // Retrieve Home3DAttributesPanel components
    Home3DAttributesPanel panel = (Home3DAttributesPanel)TestUtilities.findComponent(
        attributesDialog, Home3DAttributesPanel.class);
    Home3DAttributesController panelController =
        (Home3DAttributesController)TestUtilities.getField(panel, "controller");
    JSpinner observerFieldOfViewSpinner =
        (JSpinner)TestUtilities.getField(panel, "observerFieldOfViewSpinner");
    JSpinner observerHeightSpinner =
        (JSpinner)TestUtilities.getField(panel, "observerHeightSpinner");
    ColorButton groundColorButton = 
        (ColorButton)TestUtilities.getField(panel, "groundColorButton");
    ColorButton skyColorButton =
        (ColorButton)TestUtilities.getField(panel, "skyColorButton");
    JSlider brightnessSlider =
        (JSlider)TestUtilities.getField(panel, "brightnessSlider");
    JSlider wallsTransparencySlider =
        (JSlider)TestUtilities.getField(panel, "wallsTransparencySlider");
    // Check edited values
    float oldCameraFieldOfView = observerCamera.getFieldOfView();
    float oldCameraHeight = observerCamera.getHeight();
    int oldGroundColor = home.getEnvironment().getGroundColor();
    TextureImage oldGroundTexture = home.getEnvironment().getGroundTexture();
    int oldSkyColor = home.getEnvironment().getSkyColor();
    int oldLightColor = home.getEnvironment().getLightColor();
    float oldWallsAlpha = home.getEnvironment().getWallsAlpha();
    assertEquals("Wrong field of view", (int)Math.round(Math.toDegrees(oldCameraFieldOfView)),
        observerFieldOfViewSpinner.getValue());
    assertEquals("Wrong height", (float)Math.round(oldCameraHeight * 100) / 100,
        observerHeightSpinner.getValue());
    assertEquals("Wrong ground color", oldGroundColor,
        groundColorButton.getColor().intValue());
    assertEquals("Wrong ground texture", oldGroundTexture,
        panelController.getGroundTextureController().getTexture());
    assertEquals("Wrong sky color", oldSkyColor,
        skyColorButton.getColor().intValue());
    assertEquals("Wrong brightness", oldLightColor & 0xFF,
        brightnessSlider.getValue());
    assertEquals("Wrong transparency", (int)(oldWallsAlpha * 255),
        wallsTransparencySlider.getValue());
   
    // 12. Change dialog box values
    observerFieldOfViewSpinner.setValue(90);
    observerHeightSpinner.setValue(300f);
    groundColorButton.setColor(0xFFFFFF);
    skyColorButton.setColor(0x000000);
    brightnessSlider.setValue(128);
    wallsTransparencySlider.setValue(128);
    // Click on Ok in dialog box
    doClickOnOkInDialog(attributesDialog, tester);
    // Check home attributes are modified accordingly
    assert3DAttributesEqualHomeAttributes((float)Math.toRadians(90), 300f,
        0xFFFFFF, null, 0x000000, 0x808080, 1 / 255f * 128f, home);
   
    // 13. Undo changes
    runAction(controller, HomePane.ActionType.UNDO, tester);
    // Check home attributes have previous values
    assert3DAttributesEqualHomeAttributes(oldCameraFieldOfView, oldCameraHeight,
        oldGroundColor, null, oldSkyColor, oldLightColor, oldWallsAlpha, home);
    // Redo
    runAction(controller, HomePane.ActionType.REDO, tester);
    // Check home attributes are modified accordingly
    assert3DAttributesEqualHomeAttributes((float)Math.toRadians(90), 300f,
        0xFFFFFF, null, 0x000000, 0x808080, 1 / 255f * 128f, home);
   
    // 14. Edit 3D view modal dialog box to change ground texture
    attributesDialog = showHome3DAttributesPanel(preferences, controller, frame, tester);
    panel = (Home3DAttributesPanel)TestUtilities.findComponent(
        attributesDialog, Home3DAttributesPanel.class);
    panelController = (Home3DAttributesController)TestUtilities.getField(panel, "controller");
    JRadioButton groundColorRadioButton =
        (JRadioButton)TestUtilities.getField(panel, "groundColorRadioButton");
    final TextureChoiceComponent groundTextureButton =
        (TextureChoiceComponent)panelController.getGroundTextureController().getView();
    JRadioButton groundTextureRadioButton =
        (JRadioButton)TestUtilities.getField(panel, "groundTextureRadioButton");
   
    // Check color and texture radio buttons
    assertTrue("Ground color radio button isn't checked",
        groundColorRadioButton.isSelected());
    assertFalse("Ground texture radio button is checked",
        groundTextureRadioButton.isSelected());
    // Click on ground texture button
    tester.invokeLater(new Runnable() {
        public void run() {
          // Display texture dialog later in Event Dispatch Thread to avoid blocking test thread
          groundTextureButton.doClick();
        }
      });
    // Wait for 3D view to be shown
    String groundTextureTitle = preferences.getLocalizedString(
        Home3DAttributesController.class, "groundTextureTitle");
    tester.waitForFrameShowing(new AWTHierarchy(), groundTextureTitle);
    // Check texture dialog box is displayed
    JDialog textureDialog = (JDialog)new BasicFinder().find(attributesDialog,
        new WindowMatcher(groundTextureTitle));
    assertTrue("Texture dialog not showing", textureDialog.isShowing());
   
    JList availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    availableTexturesList.setSelectedIndex(0);
    CatalogTexture firstTexture = preferences.getTexturesCatalog().getCategories().get(0).getTexture(0);
View Full Code Here

      });
    // Wait for 3D view to be shown
    tester.waitForFrameShowing(new AWTHierarchy(), preferences.getLocalizedString(
        Home3DAttributesPanel.class, "home3DAttributes.title"));
    // Check dialog box is displayed
    JDialog attributesDialog = (JDialog)new BasicFinder().find(parent,
        new ClassMatcher (JDialog.class, true));
    assertTrue("3D view dialog not showing", attributesDialog.isShowing());
    return attributesDialog;
  }
View Full Code Here

    } else {
      Point componentLocation = new Point();
      Dimension componentSize = component.getSize();
      SwingUtilities.convertPointToScreen(componentLocation, component);
     
      Insets insets = new JDialog().getInsets();
      detachView(view, componentLocation.x - insets.left,
          componentLocation.y - insets.top,
          componentSize.width + insets.left + insets.right,
          componentSize.height + insets.top + insets.bottom);
    }
View Full Code Here

    if (!(window instanceof JFrame)) {
      window = JOptionPane.getRootFrame();
    }
    JFrame defaultFrame = (JFrame)window;
    // Create a dialog with the same title as home frame
    final JDialog separateDialog = new JDialog(defaultFrame, defaultFrame.getTitle(), false,
        component.getGraphicsConfiguration());
    separateDialog.setResizable(true);
    defaultFrame.addPropertyChangeListener("title", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent ev) {
          separateDialog.setTitle((String)ev.getNewValue());
        }
      });
    // Use same document modified indicator
    if (OperatingSystem.isMacOSXLeopardOrSuperior()) {
      defaultFrame.getRootPane().addPropertyChangeListener("Window.documentModified", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent ev) {
          separateDialog.getRootPane().putClientProperty("Window.documentModified", ev.getNewValue());
        }
      });     
    } else if (OperatingSystem.isMacOSX()) {
      defaultFrame.getRootPane().addPropertyChangeListener("windowModified", new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
            separateDialog.getRootPane().putClientProperty("windowModified", ev.getNewValue());
          }
        });     
    }
    separateDialog.setContentPane(component);
    separateDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    separateDialog.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent ev) {
          controller.attachView(view);
        }
      });
    separateDialog.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent ev) {
          controller.setVisualProperty(view.getClass().getName() + DETACHED_VIEW_WIDTH_VISUAL_PROPERTY, separateDialog.getWidth());
          controller.setVisualProperty(view.getClass().getName() + DETACHED_VIEW_HEIGHT_VISUAL_PROPERTY, separateDialog.getHeight());
        }
       
        @Override
        public void componentMoved(ComponentEvent ev) {
          controller.setVisualProperty(view.getClass().getName() + DETACHED_VIEW_X_VISUAL_PROPERTY, separateDialog.getX());
          controller.setVisualProperty(view.getClass().getName() + DETACHED_VIEW_Y_VISUAL_PROPERTY, separateDialog.getY());
        }
      });

    separateDialog.setBounds(x, y, width, height);
    separateDialog.setVisible(true);
   
    this.controller.setVisualProperty(view.getClass().getName() + DETACHED_VIEW_VISUAL_PROPERTY, true);
  }
View Full Code Here

    assertNull("Wrong texture on wall 2 left side", wall2.getLeftSideTexture());
    assertNull("Wrong texture on wall 1 right side", wall1.getRightSideTexture());
    assertNull("Wrong texture on wall 2 right side", wall2.getRightSideTexture());
   
    // 3. Edit walls
    JDialog attributesDialog = showWallPanel(preferences, controller, frame, tester);
    // Retrieve WallPanel components
    WallPanel wallPanel = (WallPanel)TestUtilities.findComponent(
        attributesDialog, WallPanel.class);
    JSpinner xStartSpinner =
        (JSpinner)TestUtilities.getField(wallPanel, "xStartSpinner");
    JSpinner xEndSpinner =
        (JSpinner)TestUtilities.getField(wallPanel, "xEndSpinner");
    TextureChoiceComponent rightSideTextureComponent =
        (TextureChoiceComponent)TestUtilities.getField(wallPanel, "rightSideTextureComponent");
    // Check xStartSpinner and xEndSpinner panels aren't visible
    assertFalse("X start spinner panel is visible", xStartSpinner.getParent().isVisible());
    assertFalse("X end spinner panel is visible", xEndSpinner.getParent().isVisible());
    // Edit right side texture
    JDialog textureDialog = showTexturePanel(preferences, rightSideTextureComponent, false, attributesDialog, tester);
    JList availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    int textureCount = availableTexturesList.getModel().getSize();
    CatalogTexture defaultTexture = (CatalogTexture)availableTexturesList.getSelectedValue();
    // Import texture
    JDialog textureWizardDialog = showImportTextureWizard(preferences, frame, tester, false);   
    // Retrieve ImportedFurnitureWizardStepsPanel components
    ImportedTextureWizardStepsPanel panel = (ImportedTextureWizardStepsPanel)TestUtilities.findComponent(
        textureWizardDialog, ImportedTextureWizardStepsPanel.class);
    final JButton imageChoiceOrChangeButton = (JButton)TestUtilities.getField(panel, "imageChoiceOrChangeButton");
    final JTextField nameTextField = (JTextField)TestUtilities.getField(panel, "nameTextField");
    JComboBox categoryComboBox = (JComboBox)TestUtilities.getField(panel, "categoryComboBox");
    JSpinner widthSpinner = (JSpinner)TestUtilities.getField(panel, "widthSpinner");
    JSpinner heightSpinner = (JSpinner)TestUtilities.getField(panel, "heightSpinner");
   
    // Check current step is image
    tester.waitForIdle();
    assertStepShowing(panel, true, false);   
    WizardPane view = (WizardPane)TestUtilities.findComponent(textureWizardDialog, WizardPane.class);
    // Check wizard view next button is disabled
    final JButton nextFinishOptionButton = (JButton)TestUtilities.getField(view, "nextFinishOptionButton");
    assertFalse("Next button is enabled", nextFinishOptionButton.isEnabled());
   
    // 4. Choose tested image
    String imageChoiceOrChangeButtonText = imageChoiceOrChangeButton.getText();
    tester.invokeAndWait(new Runnable() {
        public void run() {
          imageChoiceOrChangeButton.doClick();
        }
      });
    // Wait 200 ms to let time to Java to load the image
    Thread.sleep(200);
    // Check choice button text changed
    assertFalse("Choice button text didn't change",
        imageChoiceOrChangeButtonText.equals(imageChoiceOrChangeButton.getText()));
    // Click on next button
    tester.invokeAndWait(new Runnable() {
        public void run() {
          nextFinishOptionButton.doClick();
        }
      });
    // Check current step is attributes
    assertStepShowing(panel, false, true);

    // 5. Check default furniture name is the presentation name proposed by content manager
    assertEquals("Wrong default name",
        contentManager.getPresentationName(testedImageName.toString(), ContentManager.ContentType.IMAGE),
        nameTextField.getText());
    // Check name text field has focus
    assertSame("Name text field doesn't have focus", nameTextField,
        KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());   
    // Check default category is user category 
    String userCategoryName = preferences.getLocalizedString(
        ImportedTextureWizardStepsPanel.class, "userCategory");
    assertEquals("Wrong default category", userCategoryName,
        ((TexturesCategory)categoryComboBox.getSelectedItem()).getName());
    // Rename texture 
    final String textureTestName = "#@" + System.currentTimeMillis() + "@#";
    tester.invokeAndWait(new Runnable() {
      public void run() {
        nameTextField.setText(textureTestName);   
      }
    });
    // Check next button is enabled again
    assertTrue("Next button isn't enabled", nextFinishOptionButton.isEnabled());

    // 6. Change width with a value 5 times greater
    float width = (Float)widthSpinner.getValue();
    float height = (Float)heightSpinner.getValue();
    widthSpinner.setValue(width * 5);
    // Check height is 5 times greater
    float newWidth = (Float)widthSpinner.getValue();
    float newHeight = (Float)heightSpinner.getValue();
    assertEquals("width", 5 * width, newWidth);
    assertEquals("height", 5 * height, newHeight);
   
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Click on Finish to hide dialog box in Event Dispatch Thread
          nextFinishOptionButton.doClick();
        }
      });
    assertFalse("Import texture wizard still showing", textureWizardDialog.isShowing());

    // Check the list of available textures has one more selected modifiable texture
    assertEquals("Wrong texture count in list", textureCount + 1, availableTexturesList.getModel().getSize());
    assertEquals("No selected texture in list", 1, availableTexturesList.getSelectedValues().length);
    CatalogTexture importedTexture = (CatalogTexture)availableTexturesList.getSelectedValue();
    assertNotSame("Wrong selected texture in list", defaultTexture, importedTexture);
    // Check the attributes of the new texture
    assertEquals("Wrong name", textureTestName, importedTexture.getName());
    assertEquals("Wrong category", userCategoryName, importedTexture.getCategory().getName());
    assertEquals("Wrong width", newWidth, importedTexture.getWidth());
    assertEquals("Wrong height", newHeight, importedTexture.getHeight());
    assertTrue("New texture isn't modifiable", importedTexture.isModifiable());
       
    // 7. Click on OK in texture dialog box
    doClickOnOkInDialog(textureDialog, tester);
    // Click on OK in wall dialog box
    doClickOnOkInDialog(attributesDialog, tester);   
    // Check wall attributes are modified accordingly
    assertNull("Wrong texture on wall 1 left side", wall1.getLeftSideTexture());
    assertNull("Wrong texture on wall 2 left side", wall2.getLeftSideTexture());
    assertEquals("Wrong texture on wall 1 right side", textureTestName, wall1.getRightSideTexture().getName());
    assertEquals("Wrong texture on wall 2 right side", textureTestName, wall2.getRightSideTexture().getName());
   
    // 8. Edit left side texture of first wall
    home.setSelectedItems(Arrays.asList(wall1));
    assertEquals("Wrong selected items count in home", 1, home.getSelectedItems().size());
    attributesDialog = showWallPanel(preferences, controller, frame, tester);
    // Retrieve WallPanel components
    wallPanel = (WallPanel)TestUtilities.findComponent(attributesDialog, WallPanel.class);
    xStartSpinner = (JSpinner)TestUtilities.getField(wallPanel, "xStartSpinner");
    xEndSpinner = (JSpinner)TestUtilities.getField(wallPanel, "xEndSpinner");
    TextureChoiceComponent leftSideTextureComponent =
        (TextureChoiceComponent)TestUtilities.getField(wallPanel, "leftSideTextureComponent");
    // Check xStartSpinner and xEndSpinner panels are visible
    assertTrue("X start spinner panel isn't visible", xStartSpinner.getParent().isVisible());
    assertTrue("X end spinner panel isn't visible", xEndSpinner.getParent().isVisible());
    // Edit left side texture
    textureDialog = showTexturePanel(preferences, leftSideTextureComponent, true, attributesDialog, tester);
    availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    textureCount = availableTexturesList.getModel().getSize();
    // Select imported texture
    availableTexturesList.setSelectedValue(importedTexture, true);
    // Modify texture
    textureWizardDialog = showImportTextureWizard(preferences, frame, tester, true);   
    // Retrieve ImportedFurnitureWizardStepsPanel components
    panel = (ImportedTextureWizardStepsPanel)TestUtilities.findComponent(
        textureWizardDialog, ImportedTextureWizardStepsPanel.class);
    widthSpinner = (JSpinner)TestUtilities.getField(panel, "widthSpinner");
    final JButton nextFinishOptionButton2 = (JButton)TestUtilities.getField(
        TestUtilities.findComponent(textureWizardDialog, WizardPane.class), "nextFinishOptionButton");
    tester.invokeAndWait(new Runnable() {
        public void run() {
          nextFinishOptionButton2.doClick();
        }
      });
   
    // Change width
    widthSpinner.setValue((Float)widthSpinner.getValue() * 2);
    newWidth = (Float)widthSpinner.getValue();
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Click on Finish to hide dialog box in Event Dispatch Thread
          nextFinishOptionButton2.doClick();
        }
      });
    tester.waitForIdle();
    assertFalse("Import texture wizard still showing", textureWizardDialog.isShowing());
    // Check the list of available textures has the same texture count
    // and a new selected texture
    assertEquals("Wrong texture count in list", textureCount, availableTexturesList.getModel().getSize());
    assertEquals("No selected texture in list", 1, availableTexturesList.getSelectedValues().length);
    CatalogTexture modifiedTexture = (CatalogTexture)availableTexturesList.getSelectedValue();
    assertNotSame("Wrong selected texture in list", importedTexture, modifiedTexture);
    // Check the attributes of the new texture
    assertEquals("Wrong name", textureTestName, modifiedTexture.getName());
    assertEquals("Wrong category", userCategoryName, modifiedTexture.getCategory().getName());
    assertEquals("Wrong width", newWidth, modifiedTexture.getWidth());
    assertTrue("New texture isn't modifiable", modifiedTexture.isModifiable());

    // 9. Click on OK in texture dialog box
    doClickOnOkInDialog(textureDialog, tester);
    // Click on OK in wall dialog box
    doClickOnOkInDialog(attributesDialog, tester);   
    // Check wall attributes are modified accordingly
    assertEquals("Wrong texture on wall 1 left side", newWidth, wall1.getLeftSideTexture().getWidth());
    assertNull("Wrong texture on wall 2 left side", wall2.getLeftSideTexture());
    assertEquals("Wrong texture on wall 1 right side", newWidth / 2, wall1.getRightSideTexture().getWidth());
    assertEquals("Wrong texture on wall 2 right side", newWidth / 2, wall2.getRightSideTexture().getWidth());
   
    // 10. Open wall dialog a last time to delete the modified texture
    attributesDialog = showWallPanel(preferences, controller, frame, tester);
    // Retrieve WallPanel components
    wallPanel = (WallPanel)TestUtilities.findComponent(attributesDialog, WallPanel.class);
    leftSideTextureComponent = (TextureChoiceComponent)TestUtilities.getField(wallPanel, "leftSideTextureComponent");
    // Edit left side texture
    textureDialog = showTexturePanel(preferences, leftSideTextureComponent, true, attributesDialog, tester);
    availableTexturesList = (JList)new BasicFinder().find(textureDialog,
        new ClassMatcher(JList.class, true));
    textureCount = availableTexturesList.getModel().getSize();
    // Select modified texture
    availableTexturesList.setSelectedValue(modifiedTexture, true);
    final JButton deleteButton = (JButton)new BasicFinder().find(textureDialog,
        new Matcher() {
          public boolean matches(Component c) {
            return c instanceof JButton && ((JButton)c).getText().equals(preferences.getLocalizedString(
                TextureChoiceComponent.class, "deleteTextureButton.text"));
          }
        });
    tester.invokeAndWait(new Runnable() {
        public void run() {
          // Display confirm dialog box later in Event Dispatch Thread to avoid blocking test thread
          deleteButton.doClick();       
        }
      });
    tester.waitForIdle();
    // Wait for confirm dialog to be shown
    final String confirmDeleteSelectedCatalogTextureDialogTitle = preferences.getLocalizedString(
        TextureChoiceComponent.class, "confirmDeleteSelectedCatalogTexture.title");
    tester.waitForFrameShowing(new AWTHierarchy(), confirmDeleteSelectedCatalogTextureDialogTitle);
    // Check dialog box is displayed
    JDialog confirmDialog = (JDialog)new BasicFinder().find(textureDialog, 
        new Matcher() {
            public boolean matches(Component c) {
              return c instanceof JDialog && ((JDialog)c).getTitle().equals(
                  confirmDeleteSelectedCatalogTextureDialogTitle);
            }
          });
    assertTrue("Confirm dialog not showing", confirmDialog.isShowing());
    doClickOnOkInDialog(confirmDialog, tester);
    tester.waitForIdle();
    // Check the list of available textures has one less texture and no selected texture
    assertEquals("Wrong texture count in list", textureCount - 1, availableTexturesList.getModel().getSize());
    assertEquals("No selected texture in list", 0, availableTexturesList.getSelectedValues().length);
View Full Code Here

      });
    // Wait for wall view to be shown
    tester.waitForFrameShowing(new AWTHierarchy(), preferences.getLocalizedString(
        WallPanel.class, "wall.title"));
    // Check dialog box is displayed
    JDialog attributesDialog = (JDialog)new BasicFinder().find(parent,
        new ClassMatcher (JDialog.class, true));
    assertTrue("Wall dialog not showing", attributesDialog.isShowing());
    return attributesDialog;
  }
View Full Code Here

TOP

Related Classes of javax.swing.JDialog

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.