if (addHomeFurnitureAction != null) {
toolBar.add(addHomeFurnitureAction);
toolBar.addSeparator();
}
final JToggleButton selectToggleButton =
new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.SELECT));
selectToggleButton.setSelected(true);
toolBar.add(selectToggleButton);
final JToggleButton panToggleButton =
new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.PAN));
toolBar.add(panToggleButton);
final JToggleButton createWallsToggleButton =
new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_WALLS));
toolBar.add(createWallsToggleButton);
final JToggleButton createRoomsToggleButton =
new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_ROOMS));
toolBar.add(createRoomsToggleButton);
final JToggleButton createDimensionLinesToggleButton =
new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_DIMENSION_LINES));
toolBar.add(createDimensionLinesToggleButton);
final JToggleButton createLabelsToggleButton =
new JToggleButton(getToolBarAction(homeView, HomeView.ActionType.CREATE_LABELS));
toolBar.add(createLabelsToggleButton);
// Add Select, Create Walls and Create dimensions buttons to radio group
ButtonGroup group = new ButtonGroup();
group.add(selectToggleButton);
group.add(panToggleButton);
group.add(createWallsToggleButton);
group.add(createRoomsToggleButton);
group.add(createDimensionLinesToggleButton);
group.add(createLabelsToggleButton);
controller.getPlanController().addPropertyChangeListener(PlanController.Property.MODE,
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent ev) {
PlanController.Mode mode = controller.getPlanController().getMode();
selectToggleButton.setSelected(mode == PlanController.Mode.SELECTION);
panToggleButton.setSelected(mode == PlanController.Mode.PANNING);
createWallsToggleButton.setSelected(mode == PlanController.Mode.WALL_CREATION);
createRoomsToggleButton.setSelected(mode == PlanController.Mode.ROOM_CREATION);
createDimensionLinesToggleButton.setSelected(mode == PlanController.Mode.DIMENSION_LINE_CREATION);
createLabelsToggleButton.setSelected(mode == PlanController.Mode.LABEL_CREATION);
}
});
toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
addToolBarAction(homeView, HomeView.ActionType.ZOOM_OUT, toolBar);