Package javax.swing

Examples of javax.swing.JToolBar$DefaultToolBarLayout


        }
      }
    }
   
    // Change default buttons in toolbar
    JToolBar toolBar = (JToolBar)homeView.getContentPane().getComponent(0);
    toolBar.setFloatable(false);   
    // Retrieve all buttons that are plug-in actions
    List<JComponent> pluginButtons = new ArrayList<JComponent>();
    for (int i = 0; i < toolBar.getComponentCount(); i++) {
      JComponent component = (JComponent)toolBar.getComponent(i);
      if (component instanceof AbstractButton
          && ((AbstractButton)component).getAction().
                getValue(PluginAction.Property.TOOL_BAR.name()) == Boolean.TRUE) {
        pluginButtons.add(component);
      }
    }
    toolBar.removeAll();
    // Add New, Open, Save, Save as buttons if they are enabled
    Action newHomeAction = getToolBarAction(homeView, HomeView.ActionType.NEW_HOME);
    if (newHomeAction != null && newHomeAction.isEnabled()) {
      toolBar.add(newHomeAction);
    }
    Action openAction = getToolBarAction(homeView, HomeView.ActionType.OPEN);
    if (openAction != null && openAction.isEnabled()) {
      toolBar.add(openAction);
    }
    Action saveAction = getToolBarAction(homeView, HomeView.ActionType.SAVE);
    if (saveAction != null && saveAction.isEnabled()) {
      toolBar.add(saveAction);
    }
    Action saveAsAction = getToolBarAction(homeView, HomeView.ActionType.SAVE_AS);
    if (saveAsAction != null && saveAsAction.isEnabled()) {
      toolBar.add(saveAsAction);
    }
   
    if (getAppletBooleanParameter(this.applet, ENABLE_EXPORT_TO_SH3D)) {
      try {
        // Add export to SH3D action
        Action exportToSH3DAction = new ControllerAction(getUserPreferences(),
            AppletApplication.class, "EXPORT_TO_SH3D", controller, "exportToSH3D");
        exportToSH3DAction.setEnabled(true);
        toolBar.add(new ResourceAction.ToolBarAction(exportToSH3DAction));
      } catch (NoSuchMethodException ex) {
        ex.printStackTrace();
      }
    }
   
    if (toolBar.getComponentCount() > 0) {
      toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    }
    addToolBarAction(homeView, HomeView.ActionType.PAGE_SETUP, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.PRINT, toolBar);
    Action printToPdfAction = getToolBarAction(homeView, HomeView.ActionType.PRINT_TO_PDF);
    if (printToPdfAction != null
        && getAppletBooleanParameter(this.applet, ENABLE_PRINT_TO_PDF)
        && !OperatingSystem.isMacOSX()) {
      controller.getView().setEnabled(HomeView.ActionType.PRINT_TO_PDF, true);
      toolBar.add(printToPdfAction);
    }
    Action preferencesAction = getToolBarAction(homeView, HomeView.ActionType.PREFERENCES);
    if (preferencesAction != null) {
      toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
      toolBar.add(preferencesAction);
    }
    toolBar.addSeparator();

    addToolBarAction(homeView, HomeView.ActionType.UNDO, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.REDO, toolBar);
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    addToolBarAction(homeView, HomeView.ActionType.CUT, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.COPY, toolBar);
    addToolBarAction(homeView, HomeView.ActionType.PASTE, toolBar);
    toolBar.add(Box.createRigidArea(new Dimension(2, 2)));
    addToolBarAction(homeView, HomeView.ActionType.DELETE, toolBar);
    toolBar.addSeparator();

    Action addHomeFurnitureAction = getToolBarAction(homeView, HomeView.ActionType.ADD_HOME_FURNITURE);
    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);
    addToolBarAction(homeView, HomeView.ActionType.ZOOM_IN, toolBar);

    Action createPhotoAction = getToolBarAction(homeView, HomeView.ActionType.CREATE_PHOTO);
    if (createPhotoAction != null) {
      boolean enableCreatePhoto = getAppletBooleanParameter(this.applet, ENABLE_CREATE_PHOTO);
      controller.getView().setEnabled(HomeView.ActionType.CREATE_PHOTO, enableCreatePhoto);
      if (enableCreatePhoto) {
        toolBar.addSeparator();
        toolBar.add(createPhotoAction);
      }
    }

    // Add plug-in buttons
    if (pluginButtons.size() > 0) {
      toolBar.addSeparator();
      for (JComponent pluginButton : pluginButtons) {
        toolBar.add(pluginButton);
      }
    }
   
    Action aboutAction = getToolBarAction(homeView, HomeView.ActionType.ABOUT);
    if (aboutAction != null) {
      toolBar.addSeparator();
      toolBar.add(aboutAction);
    }
   
    controller.getView().setEnabled(HomeView.ActionType.EXPORT_TO_SVG,
        getAppletBooleanParameter(this.applet, ENABLE_EXPORT_TO_SVG));
    controller.getView().setEnabled(HomeView.ActionType.EXPORT_TO_OBJ,
View Full Code Here


    updateComponents();
  }

  private void updateComponents() {
    this.removeAll();
    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(WidgetFactory.createToolBarSeparator());

    final JButton addDriverButton = new JButton("Add database driver",
        imageManager.getImageIcon("images/actions/add.png"));
    addDriverButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {

        final JMenu menu = new JMenu("Automatic download and install");
        menu.setIcon(imageManager.getImageIcon("images/actions/download.png"));

        final List<DatabaseDriverDescriptor> drivers = _databaseDriverCatalog.getDatabaseDrivers();
        for (DatabaseDriverDescriptor dd : drivers) {
          final String[] urls = dd.getDownloadUrls();
          if (urls != null && _databaseDriverCatalog.getState(dd) == DatabaseDriverState.NOT_INSTALLED) {
            final JMenuItem downloadAndInstallMenuItem = WidgetFactory.createMenuItem(dd.getDisplayName(),
                dd.getIconImagePath());
            downloadAndInstallMenuItem.addActionListener(createDownloadActionListener(dd));
            menu.add(downloadAndInstallMenuItem);
          }
        }

        if (menu.getMenuComponentCount() == 0) {
          menu.setEnabled(false);
        }

        final JMenuItem localJarFilesMenuItem = WidgetFactory.createMenuItem("Local JAR file(s)...",
            "images/filetypes/archive.png");
        localJarFilesMenuItem.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            AddDatabaseDriverDialog dialog = new AddDatabaseDriverDialog(_databaseDriverCatalog,
                DatabaseDriversPanel.this, _windowContext, _userPreferences);
            dialog.setVisible(true);
          }
        });

        final JPopupMenu popup = new JPopupMenu();
        popup.add(menu);
        popup.add(localJarFilesMenuItem);
        popup.show(addDriverButton, 0, addDriverButton.getHeight());
      }
    });
    toolBar.add(addDriverButton);

    final DCTable table = getDatabaseDriverTable();
    this.add(toolBar, BorderLayout.NORTH);
    this.add(table.toPanel(), BorderLayout.CENTER);
  }
View Full Code Here

      y++;
      WidgetUtils.addToGridBag(Box.createVerticalStrut(10), this, 0, y, 2, 1);

      y++;
      final JToolBar buttonPanel = WidgetFactory.createToolBar();
      buttonPanel.add(registerButton);
      buttonPanel.add(Box.createHorizontalGlue());
      buttonPanel.add(loginButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(cancelButton);
      WidgetUtils.addToGridBag(buttonPanel, this, 0, y, 2, 1);

      y++;
      WidgetUtils.addToGridBag(Box.createVerticalStrut(10), this, 0, y, 2, 1);
View Full Code Here

      public void actionPerformed(ActionEvent e) {
        OptionsDialog.this.dispose();
      }
    });

    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(new HumanInferenceToolbarButton());
    toolBar.add(WidgetFactory.createToolBarSeparator());
    toolBar.add(closeButton);

    final DCPanel toolBarPanel = new DCPanel(WidgetUtils.BG_COLOR_DARKEST, WidgetUtils.BG_COLOR_DARKEST);
    toolBarPanel.setLayout(new BorderLayout());
    toolBarPanel.add(toolBar, BorderLayout.CENTER);
View Full Code Here

    _presenters = new IdentityHashMap<FilterJobBuilder<?, ?>, FilterJobBuilderPresenter>();
    _analysisJobBuilder = analysisJobBuilder;
    _preconfiguredPresenters = new HashSet<FilterJobBuilderPresenter>();
    _analysisJobBuilder.getFilterChangeListeners().add(this);

    JToolBar toolBar = WidgetFactory.createToolBar();

    // Add filter
    ImageManager imageManager = ImageManager.getInstance();
    JButton addFilterButton = new JButton("Add filter", imageManager.getImageIcon("images/component-types/filter.png"));
    addFilterButton
        .setToolTipText("<html>Filters represent a way to<br/>categorize rows and use these<br/>categories as requirements for<br/>succeeding steps in a job.</html>");
    addFilterButton.addActionListener(new AddFilterActionListener(_analysisJobBuilder.getConfiguration(),
        _analysisJobBuilder, this));
    toolBar.add(addFilterButton);

    add(toolBar, BorderLayout.NORTH);

    _taskPaneContainer = WidgetFactory.createTaskPaneContainer();
    _taskPaneContainer.setOpaque(false);
View Full Code Here

        popup.add(manualInstallMenuItem);
        popup.show(addExtensionButton, 0, addExtensionButton.getHeight());
      }
    });

    final JToolBar toolBar = WidgetFactory.createToolBar();
    toolBar.add(WidgetFactory.createToolBarSeparator());
    toolBar.add(addExtensionButton);

    final DCPanel listPanel = new DCPanel();
    listPanel.setLayout(new VerticalLayout(4));
    listPanel.setBorder(new EmptyBorder(0, 10, 10, 0));
View Full Code Here

        },
        BorderFactory.createLineBorder(Color.BLACK)));
   
    this.pageLabel = new JLabel();
   
    this.toolBar = new JToolBar() {
        public void applyComponentOrientation(ComponentOrientation orientation) {
          // Ignore orientation
        }
      };
    this.toolBar.setFloatable(false);
View Full Code Here

        new ClassMatcher (JDialog.class, true));
    assertTrue("Print preview dialog not showing", printPreviewDialog.isShowing());
    // Retrieve PageSetupPanel components
    PrintPreviewPanel printPreviewPanel = (PrintPreviewPanel)TestUtilities.findComponent(
        frame, PrintPreviewPanel.class);
    JToolBar toolBar =
        (JToolBar)TestUtilities.getField(printPreviewPanel, "toolBar");
    JButton previousButton = (JButton)toolBar.getComponent(0);
    final JButton nextButton = (JButton)toolBar.getComponent(1);
    HomePrintableComponent printableComponent =
        (HomePrintableComponent)TestUtilities.getField(printPreviewPanel, "printableComponent");;
    // Check if buttons are enabled and if printable component displays the first page
    assertFalse("Previous button is enabled", previousButton.isEnabled());
    assertTrue("Next button is disabled", nextButton.isEnabled());
View Full Code Here

    menuRemote.setEnabled(b);
    buttonRemote.setEnabled(b);
  }

  JToolBar makeToolBar() {
    return new JToolBar() {
        {
          add(toolStartBundles = new JButton(openIcon) {
              {
                addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ev) {
View Full Code Here

    }

    // Create variables buttons tool bar
    this.variablesLabel = new JLabel(preferences.getLocalizedString(
        PageSetupPanel.class, "variablesLabel.text"));
    this.variableButtonsToolBar = new JToolBar();
    this.variableButtonsToolBar.setFloatable(false);
    ActionMap actions = getActionMap();
    this.variableButtonsToolBar.add(actions.get(HomePrintableComponent.Variable.PAGE_NUMBER));
    this.variableButtonsToolBar.add(actions.get(HomePrintableComponent.Variable.PAGE_COUNT));
    this.variableButtonsToolBar.add(actions.get(HomePrintableComponent.Variable.PLAN_SCALE));
View Full Code Here

TOP

Related Classes of javax.swing.JToolBar$DefaultToolBarLayout

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.