Package com.mucommander.ui.main

Examples of com.mucommander.ui.main.MainFrame


      return WindowManager.getMainFrames().size()-1;
    }

  @Override
  public MainFrame[] build() {
    MainFrame currentMainFrame = WindowManager.getCurrentMainFrame();
   
    MainFrame mainFrame = new MainFrame(currentMainFrame);
   
    // If this is a cloned window, use the same dimensions as the previous MainFrame, with
        // a slight horizontal and vertical offset to make sure we keep both of them visible.
   
    Dimension screenSize   = Toolkit.getDefaultToolkit().getScreenSize();
    int x             = currentMainFrame.getX() + X_OFFSET;
        int y             = currentMainFrame.getY() + Y_OFFSET;
        int width         = currentMainFrame.getWidth();
        int height        = currentMainFrame.getHeight();

        // Make sure we're still within the screen.
        // Note that while the width and height tests look redundant, they are required. Some
        // window managers, such as Gnome, return rather peculiar results.
        if(!isInsideUsableScreen(currentMainFrame, x + width, -1))
            x = 0;
        if(!isInsideUsableScreen(currentMainFrame, -1, y + height))
            y = 0;
        if(width + x > screenSize.width)
            width = screenSize.width - x;
        if(height + y > screenSize.height)
            height = screenSize.height - y;
       
        mainFrame.setBounds(new Rectangle(x, y, width, height));
       
    return new MainFrame[] { mainFrame };
  }
View Full Code Here


  private List<MainFrame> mainFrames = new LinkedList<MainFrame>();
 
  public CommandLineMainFrameBuilder(String[] folders) {
    for(int i=0; i < folders.length; i += 2) {
      mainFrames.add(new MainFrame(
          new ConfFileTableTab(getInitialAbstractPaths(folders[i], FolderPanelType.LEFT)),
          getFileTableConfiguration(FolderPanelType.LEFT, mainFrames.size()),
          new ConfFileTableTab(getInitialAbstractPaths(i < folders.length - 1 ? folders[i + 1] : null, FolderPanelType.RIGHT)),
          getFileTableConfiguration(FolderPanelType.RIGHT, mainFrames.size())));
        }
View Full Code Here

    this.folderPanel = folderPanel;
  }
 
  @Override
    protected void acceptListItem(AbstractFile item) {
    MainFrame mainFrame = WindowManager.getCurrentMainFrame();

    if(item.getURL().getScheme().equals(FileProtocols.FILE) && (item.hasAncestor(LocalFile.class))) {
            try { DesktopManager.open(item); }
            catch(IOException e) {}
        }
View Full Code Here

            windowMenuFrames = new WeakHashMap<JMenuItem, Frame>();
           
            // Create a menu item for each of the MainFrame instances, that displays the MainFrame's path
            // and a keyboard accelerator to recall the frame (for the first 10 frames only).
            java.util.List<MainFrame> mainFrames = WindowManager.getMainFrames();
            MainFrame mainFrame;
            JCheckBoxMenuItem checkBoxMenuItem;
            int nbFrames = mainFrames.size();
            for(int i=0; i<nbFrames; i++) {
                mainFrame = mainFrames.get(i);
                checkBoxMenuItem = new JCheckBoxMenuItem();

                // If frame number is less than 10, use the corresponding action class (accelerator will be displayed in the menu item)
                MuAction recallWindowAction;
                if(i<10) {
                    recallWindowAction = ActionManager.getActionInstance(RECALL_WINDOW_ACTION_IDS[i], this.mainFrame);
                }
                // Else use the generic RecallWindowAction
                else {
                    Hashtable<String, Object> actionProps = new Hashtable<String, Object>();
                    // Specify the window number using the dedicated property
                    actionProps.put(RecallWindowAction.WINDOW_NUMBER_PROPERTY_KEY, ""+(i+1));
                    recallWindowAction = ActionManager.getActionInstance(new ActionParameters(RecallWindowAction.Descriptor.ACTION_ID, actionProps), this.mainFrame);
                }

                checkBoxMenuItem.setAction(recallWindowAction);

                // Replace the action's label and use the MainFrame's current folder path instead
                checkBoxMenuItem.setText((i+1)+" "+mainFrame.getActiveTable().getFolderPanel().getCurrentFolder().getAbsolutePath());

                // Use the action's label as a tooltip
                checkBoxMenuItem.setToolTipText(recallWindowAction.getLabel());

                // Check current MainFrame (the one this menu bar belongs to)
View Full Code Here

                table.sortBy(col);
        }
        // One of the table headers was right-clicked, popup a menu that offers to hide the column
        else if(DesktopManager.isRightMouseButton(e)) {
            JPopupMenu popupMenu = new JPopupMenu();
            MainFrame mainFrame = table.getFolderPanel().getMainFrame();

            JCheckBoxMenuItem checkboxMenuItem;
            for(Column c : Column.values()) {
                if(c==Column.NAME)
                    continue;

                checkboxMenuItem = new JCheckBoxMenuItem(ActionManager.getActionInstance(c.getToggleColumnActionId(), mainFrame));

                checkboxMenuItem.setSelected(table.isColumnEnabled(c));
                checkboxMenuItem.setEnabled(table.isColumnDisplayable(c));
                // Override the action's label to a shorter one
                checkboxMenuItem.setText(c.getLabel());

                popupMenu.add(checkboxMenuItem);
            }

            popupMenu.add(new JSeparator());

            checkboxMenuItem = new JCheckBoxMenuItem(ActionManager.getActionInstance(ToggleAutoSizeAction.Descriptor.ACTION_ID, mainFrame));
            checkboxMenuItem.setSelected(mainFrame.isAutoSizeColumnsEnabled());
            popupMenu.add(checkboxMenuItem);

            popupMenu.show(this, e.getX(), e.getY());
            popupMenu.setVisible(true);
        }
View Full Code Here

    }

    @Override
    public void performAction() {
        List<MainFrame> mainFrames = WindowManager.getMainFrames();
        MainFrame currentMainFrame = WindowManager.getCurrentMainFrame();

        int nbMainFrames = mainFrames.size();
        MainFrame mainFrame;
        for(int i=nbMainFrames-1; i>=0; i--) {
            mainFrame = mainFrames.get(i);
            if(mainFrame!=currentMainFrame) {
                mainFrame.toFront();
            }
        }

        currentMainFrame.toFront();
    }
View Full Code Here

TOP

Related Classes of com.mucommander.ui.main.MainFrame

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.