Package com.eteks.sweethome3d.viewcontroller

Examples of com.eteks.sweethome3d.viewcontroller.FurnitureController$AlignedPieceOfFurniture


    Home home = new Home(homeFurniture);
    // Check home furniture isn't empty
    assertTrue("Home furniture is empty", homeFurniture.size() > 0);

    // 2. Create a table that displays home furniture with its controller 
    FurnitureController furnitureController =
        new FurnitureController(home, preferences, new SwingViewFactory());
    FurnitureTable table = (FurnitureTable)furnitureController.getView();
   
    // 3. Sort furniture table in alphabetical order of furniture name
    furnitureController.sortFurniture(HomePieceOfFurniture.SortableProperty.NAME);
    // Check the alphabetical order of table data
    assertFurnitureIsSortedByName(table, true);
   
    // 4. Sort in descending order and check order
    furnitureController.sortFurniture(HomePieceOfFurniture.SortableProperty.NAME);
    // Check table data is sorted in alphabetical descending order
    assertFurnitureIsSortedByName(table, false);
   
    // 5. Change first furniture name
    HomePieceOfFurniture firstPiece = home.getFurniture().get(0);
View Full Code Here


    Home home = new Home(homeFurniture);
    // Check home furniture isn't empty
    assertTrue("Home furniture is empty", homeFurniture.size() > 0);

    // 2. Create a table that displays home furniture with its controller 
    FurnitureController furnitureController =
        new FurnitureController(home, preferences, new SwingViewFactory());
    FurnitureTable table = (FurnitureTable)furnitureController.getView();
    assertEquals("Home furniture count and row count different", homeFurniture.size(), table.getRowCount());
    // Apply a filter on furniture that refuses pieces that are windows
    table.setFurnitureFilter(new FurnitureFilter() {
        public boolean include(Home home, HomePieceOfFurniture piece) {         
          return !piece.isDoorOrWindow();
        }
      });
    // Count how many doors and windows are in home
    int doorsAndWindowsCount = 0;
    HomePieceOfFurniture doorOrWindowPiece = null;
    HomePieceOfFurniture otherPiece = null;
    for (HomePieceOfFurniture piece : home.getFurniture()) {
      if (piece.isDoorOrWindow()) {
        doorsAndWindowsCount++;
        doorOrWindowPiece = piece;
      } else {
        otherPiece = piece;
      }
    }
    // Check there's no door or window in table
    int homeFurnitureCount = homeFurniture.size();
    int tableFilterRowCount = table.getRowCount();
    assertEquals("Home furniture count and row count same",
        homeFurnitureCount - doorsAndWindowsCount, tableFilterRowCount);
   
    // 3. Add a door or window to home
    home.addPieceOfFurniture(new HomePieceOfFurniture(doorOrWindowPiece));
    // Check no row were added in table
    assertEquals("Wrong furniture count in home", homeFurnitureCount + 1, home.getFurniture().size());
    assertEquals("Wrong row count in table", tableFilterRowCount, table.getRowCount());
   
    // 4. Add an other kind of piece to home
    home.addPieceOfFurniture(new HomePieceOfFurniture(otherPiece));
    // Check one row was added in table
    assertEquals("Wrong furniture count in home", homeFurnitureCount + 2, home.getFurniture().size());
    assertEquals("Wrong row count in table", tableFilterRowCount + 1, table.getRowCount());
   
    // 5. Test sort and filter internal buffer of the table
    furnitureController.sortFurniture(HomePieceOfFurniture.SortableProperty.NAME);
    // Check the alphabetical order of table data
    assertFurnitureIsSortedByName(table, true);
    // Add a door or window and an other kind of piece to home
    home.addPieceOfFurniture(new HomePieceOfFurniture(doorOrWindowPiece));
    home.addPieceOfFurniture(new HomePieceOfFurniture(otherPiece));
View Full Code Here

    createClipboardAction(ActionType.PASTE, preferences, TransferHandler.getPasteAction());
    createAction(ActionType.DELETE, preferences, controller, "delete");
    createAction(ActionType.SELECT_ALL, preferences, controller, "selectAll");
   
    createAction(ActionType.ADD_HOME_FURNITURE, preferences, controller, "addHomeFurniture");
    FurnitureController furnitureController = controller.getFurnitureController();
    createAction(ActionType.DELETE_HOME_FURNITURE, preferences,
        furnitureController, "deleteSelection");
    createAction(ActionType.MODIFY_FURNITURE, preferences, controller, "modifySelectedFurniture");
    createAction(ActionType.GROUP_FURNITURE, preferences,
        furnitureController, "groupSelectedFurniture");
View Full Code Here

      homeController.getView();
      preferences.setFurnitureCatalogViewedInTree(false);
      new FurnitureCatalogController(preferences.getFurnitureCatalog(), preferences, viewFactory, contentManager).getView();
      preferences.setFurnitureCatalogViewedInTree(true);
      new FurnitureCatalogController(preferences.getFurnitureCatalog(), preferences, viewFactory, contentManager).getView();
      new FurnitureController(home, preferences, viewFactory).getView();
      new PlanController(home, preferences, viewFactory, contentManager, undoableEditSupport).getView();
      new HomeController3D(home, preferences, viewFactory, contentManager, undoableEditSupport).getView();
     
      new PageSetupController(home, preferences, viewFactory, undoableEditSupport).getView();
      new PrintPreviewController(home, preferences, homeController, viewFactory).getView();
View Full Code Here

TOP

Related Classes of com.eteks.sweethome3d.viewcontroller.FurnitureController$AlignedPieceOfFurniture

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.