Esempio n. 1
0
  @Test
  public void createButton() {
    ApplicationContext context = new ApplicationContext();
    ButtonFactory buttonFactory = context.getButtonFactory();

    JButton button = buttonFactory.createButton(CopyAction.class);
    assertEquals("F5 Copy", button.getText());
  }
Esempio n. 2
0
  public ApplicationFrame(ApplicationContext context) {
    this.context = context;
    this.actionFactory = context.getActionFactory();
    this.buttonFactory = context.getButtonFactory();
    this.uiFactory = context.getUiFactory();

    setSize(1024, 768);
    setLocationRelativeTo(null);
    setTitle("Jar Commander");

    setFocusable(true);
    setPreferredSize(new Dimension(1024, 768));
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

    addWindowListener(new CustomWindowAdapter());

    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(gridBagLayout);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    add(createHeaderPanel(), c);

    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 1;
    c.gridy++;

    add(uiFactory.createSessionsPanel(), c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.weighty = 0;
    c.gridy++;
    JPanel footerPanel = createFooterPanel();
    add(footerPanel, c);

    pack();
    ((SessionPanel) context.getSessionsPanel().getSelectedComponent())
        .getSelectedNavigationPanel()
        .getFileTablePane()
        .getTable()
        .requestFocusInWindow();
  }
Esempio n. 3
0
 public SessionPanel createSessionPanel(String title, FileSystem fileSystem) {
   SessionPanel sessionPanel = null;
   try {
     sessionPanel =
         new SessionPanel(
             createNavigationPanel(new LocalFileSystem()), createNavigationPanel(fileSystem));
     context.getSessionsPanel().addTab(title, sessionPanel);
   } catch (ApplicationException e) {
     e.show();
   }
   return sessionPanel;
 }
Esempio n. 4
0
 public JTabbedPane createSessionsPanel() {
   JTabbedPane sessionsPanel = new JTabbedPane();
   context.setSessionsPanel(sessionsPanel);
   createSessionPanel("Local", new LocalFileSystem());
   return sessionsPanel;
 }