Search in sources :

Example 16 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class LocationBarPanel method createConfigurationPanel.

private JPanel createConfigurationPanel() {
    FontChooser fontChooser = createFontChooser(ThemeData.LOCATION_BAR_FONT);
    addFontChooserListener(fontChooser, normalPreview);
    addFontChooserListener(fontChooser, progressPreview);
    ProportionalGridPanel colorsPanel = new ProportionalGridPanel(3);
    addLabelRow(colorsPanel, false);
    PreviewLabel label = new PreviewLabel();
    addColorButtons(colorsPanel, fontChooser, "theme_editor.normal", ThemeData.LOCATION_BAR_FOREGROUND_COLOR, ThemeData.LOCATION_BAR_BACKGROUND_COLOR, label).addPropertyChangeListener(this);
    addColorButtons(colorsPanel, fontChooser, "theme_editor.selected", ThemeData.LOCATION_BAR_SELECTED_FOREGROUND_COLOR, ThemeData.LOCATION_BAR_SELECTED_BACKGROUND_COLOR).addPropertyChangeListener(this);
    label.setTextPainted(true);
    addFontChooserListener(fontChooser, label);
    colorsPanel.add(createCaptionLabel("theme_editor.progress"));
    colorsPanel.add(new JLabel());
    colorsPanel.add(new ColorButton(parent, themeData, ThemeData.LOCATION_BAR_PROGRESS_COLOR, PreviewLabel.OVERLAY_COLOR_PROPERTY_NAME, label));
    label.addPropertyChangeListener(this);
    JPanel flowPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    flowPanel.add(colorsPanel);
    flowPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.colors")));
    YBoxPanel mainPanel = new YBoxPanel();
    mainPanel.add(fontChooser);
    mainPanel.addSpace(10);
    mainPanel.add(flowPanel);
    return mainPanel;
}
Also used : PreviewLabel(com.mucommander.ui.chooser.PreviewLabel) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) FontChooser(com.mucommander.ui.chooser.FontChooser) ProportionalGridPanel(com.mucommander.commons.util.ui.layout.ProportionalGridPanel)

Example 17 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class LocationBarPanel method createPreviewPanel.

private JPanel createPreviewPanel() {
    YBoxPanel panel = new YBoxPanel();
    // panel.add(new JLabel(Translator.get("theme_editor.normal")));
    panel.add(createCaptionLabel("theme_editor.normal"));
    normalPreview = new ProgressTextField(0, themeData.getColor(ThemeData.LOCATION_BAR_PROGRESS_COLOR));
    panel.add(normalPreview);
    normalPreview.setText(System.getProperty("user.home"));
    panel.addSpace(10);
    panel.add(createCaptionLabel("theme_editor.progress"));
    progressPreview = new ProgressTextField(50, themeData.getColor(ThemeData.LOCATION_BAR_PROGRESS_COLOR));
    panel.add(progressPreview);
    progressPreview.setText(System.getProperty("user.home"));
    progressPreview.setEnabled(false);
    JPanel borderPanel = new JPanel(new BorderLayout());
    borderPanel.add(panel, BorderLayout.NORTH);
    borderPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("preview")));
    setBackgroundColors();
    setForegroundColors();
    setProgressColors();
    return borderPanel;
}
Also used : YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) ProgressTextField(com.mucommander.ui.progress.ProgressTextField)

Example 18 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class QuickListPanel method createPreviewPanel.

/**
 * Creates the quick list preview panel.
 * @return the quick list preview panel.
 */
private JPanel createPreviewPanel() {
    // Preview panel.
    JPanel panel;
    // Wraps the preview quick list.
    JScrollPane scroll;
    // add JScrollPane that contains the TablePopupDataList to the popup.
    scroll = new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setBorder(null);
    scroll.getVerticalScrollBar().setFocusable(false);
    scroll.getHorizontalScrollBar().setFocusable(false);
    // Creates the panel.
    panel = new JPanel();
    quickListPreviewPanel = new YBoxPanel();
    quickListPreviewPanel.add(header);
    quickListPreviewPanel.add(scroll);
    quickListPreviewPanel.setBorder(new QuickList.PopupsBorder());
    panel.add(quickListPreviewPanel);
    panel.setBorder(BorderFactory.createTitledBorder(Translator.get("preview")));
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) QuickList(com.mucommander.ui.quicklist.QuickList)

Example 19 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class QuickListPanel method initUI.

/**
 * Initializes the panel's UI.
 */
private void initUI() {
    // Contains all the configuration elements.
    YBoxPanel headerConfigurationPanel;
    // Contains all the configuration elements.
    YBoxPanel itemConfigurationPanel;
    // Used to select a font.
    FontChooser fontChooser1;
    // Used to select a font.
    FontChooser fontChooser2;
    // Main panel.
    JPanel mainPanel;
    JTabbedPane tabbedPane;
    header.addComponentListener(new ComponentListener() {

        public void componentHidden(ComponentEvent e) {
        }

        public void componentMoved(ComponentEvent e) {
        }

        public void componentResized(ComponentEvent e) {
            quickListPreviewPanel.repaint();
        }

        public void componentShown(ComponentEvent e) {
        }
    });
    // Font chooser and preview initialization.
    fontChooser1 = createFontChooser(ThemeData.QUICK_LIST_HEADER_FONT);
    fontChooser2 = createFontChooser(ThemeData.QUICK_LIST_ITEM_FONT);
    addFontChooserListener(fontChooser1, header);
    addFontChooserListener(fontChooser2, list);
    // Header configuration panel initialization.
    headerConfigurationPanel = new YBoxPanel();
    headerConfigurationPanel.add(fontChooser1);
    headerConfigurationPanel.addSpace(10);
    headerConfigurationPanel.add(createHeaderColorsPanel(fontChooser1));
    // Item configuration panel initialization.
    itemConfigurationPanel = new YBoxPanel();
    itemConfigurationPanel.add(fontChooser2);
    itemConfigurationPanel.addSpace(10);
    itemConfigurationPanel.add(createItemColorsPanel(fontChooser1));
    // Create the tabbed pane.
    tabbedPane = new JTabbedPane();
    tabbedPane.add(Translator.get("theme_editor.header"), headerConfigurationPanel);
    tabbedPane.add(Translator.get("theme_editor.item"), itemConfigurationPanel);
    // Main layout.
    mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(tabbedPane, BorderLayout.CENTER);
    mainPanel.add(createPreviewPanel(), BorderLayout.EAST);
    // Layout.
    setLayout(new BorderLayout());
    add(mainPanel, BorderLayout.NORTH);
}
Also used : JPanel(javax.swing.JPanel) ComponentListener(java.awt.event.ComponentListener) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) BorderLayout(java.awt.BorderLayout) FontChooser(com.mucommander.ui.chooser.FontChooser) JTabbedPane(javax.swing.JTabbedPane) ComponentEvent(java.awt.event.ComponentEvent)

Example 20 with YBoxPanel

use of com.mucommander.commons.util.ui.layout.YBoxPanel in project mucommander by mucommander.

the class FileCollisionDialog method init.

private void init(int collisionType, AbstractFile sourceFile, AbstractFile destFile, boolean multipleFilesMode, boolean allowRename) {
    // Init choices
    List<DialogAction> actionChoices = new ArrayList<>();
    actionChoices.add(FileCollisionAction.CANCEL);
    if (multipleFilesMode) {
        actionChoices.add(FileCollisionAction.SKIP);
    }
    // Add 'overwrite' / 'overwrite if older' / 'resume' actions only for 'destination file already exists' collision type
    if (collisionType == FileCollisionChecker.DESTINATION_FILE_ALREADY_EXISTS && !destFile.isDirectory()) {
        actionChoices.add(FileCollisionAction.OVERWRITE);
        if (sourceFile != null) {
            actionChoices.add(FileCollisionAction.OVERWRITE_IF_OLDER);
            actionChoices.add(FileCollisionAction.OVERWRITE_IF_SIZE_DIFFERS);
            // Give resume option only if destination file is smaller than source file
            long destSize = destFile.getSize();
            long sourceSize = sourceFile.getSize();
            if (destSize != -1 && (sourceSize == -1 || destSize < sourceSize)) {
                actionChoices.add(FileCollisionAction.RESUME);
            }
            if (allowRename) {
                actionChoices.add(FileCollisionAction.RENAME);
            }
        }
    }
    // Init UI
    String desc = null;
    switch(collisionType) {
        case FileCollisionChecker.DESTINATION_FILE_ALREADY_EXISTS:
            desc = Translator.get("file_exists_in_destination");
            break;
        case FileCollisionChecker.SAME_SOURCE_AND_DESTINATION:
            desc = Translator.get("same_source_destination");
            break;
        case FileCollisionChecker.SOURCE_PARENT_OF_DESTINATION:
            desc = Translator.get("source_parent_of_destination");
            break;
    }
    YBoxPanel yPanel = new YBoxPanel();
    if (desc != null) {
        yPanel.add(new InformationPane(desc, null, Font.PLAIN, InformationPane.QUESTION_ICON));
        yPanel.addSpace(10);
    }
    // Add a separator before file details
    yPanel.add(new JSeparator());
    XAlignedComponentPanel tfPanel = new XAlignedComponentPanel(10);
    // If collision type is 'same source and destination' no need to show both source and destination
    if (collisionType == FileCollisionChecker.SAME_SOURCE_AND_DESTINATION) {
        addFileDetails(tfPanel, sourceFile, Translator.get("name"));
    } else {
        if (sourceFile != null) {
            addFileDetails(tfPanel, sourceFile, Translator.get("source"));
        }
        addFileDetails(tfPanel, destFile, Translator.get("destination"));
    }
    yPanel.add(tfPanel);
    // Add a separator after file details
    yPanel.add(new JSeparator());
    init(yPanel, actionChoices, 3);
    // TODO below there's workaround to accommodate texts within buttons - any idea to how to make it better?
    // override to avoid FocusDialog#pack making the dialog box too small for some buttons
    // so they won't display full texts (observe when Spanish lang pack is chosen - a lot of them have ellipsis)
    setMinimumSize(null);
    setMaximumSize(null);
    // 'Apply to all' is available only for 'destination file already exists' collision type
    if (multipleFilesMode && collisionType == FileCollisionChecker.DESTINATION_FILE_ALREADY_EXISTS) {
        applyToAllCheckBox = new JCheckBox(Translator.get("apply_to_all"));
        addComponent(applyToAllCheckBox);
    }
    // Send a system notification if a notifier is available and enabled
    if (NotifierProvider.isAvailable() && NotifierProvider.getNotifier().isEnabled()) {
        NotifierProvider.displayBackgroundNotification(NotificationType.JOB_ERROR, getTitle(), desc);
    }
}
Also used : JCheckBox(javax.swing.JCheckBox) XAlignedComponentPanel(com.mucommander.commons.util.ui.layout.XAlignedComponentPanel) YBoxPanel(com.mucommander.commons.util.ui.layout.YBoxPanel) DialogAction(com.mucommander.ui.dialog.DialogAction) ArrayList(java.util.ArrayList) InformationPane(com.mucommander.ui.layout.InformationPane) JSeparator(javax.swing.JSeparator)

Aggregations

YBoxPanel (com.mucommander.commons.util.ui.layout.YBoxPanel)26 JPanel (javax.swing.JPanel)11 JButton (javax.swing.JButton)8 JLabel (javax.swing.JLabel)7 FlowLayout (java.awt.FlowLayout)6 ButtonChoicePanel (com.mucommander.commons.util.ui.button.ButtonChoicePanel)4 ProportionalGridPanel (com.mucommander.commons.util.ui.layout.ProportionalGridPanel)4 FontChooser (com.mucommander.ui.chooser.FontChooser)4 BorderLayout (java.awt.BorderLayout)4 ActionEvent (java.awt.event.ActionEvent)3 JCheckBox (javax.swing.JCheckBox)3 JScrollPane (javax.swing.JScrollPane)3 XAlignedComponentPanel (com.mucommander.commons.util.ui.layout.XAlignedComponentPanel)2 CollapseExpandButton (com.mucommander.ui.button.CollapseExpandButton)2 SpinningDial (com.mucommander.ui.icon.SpinningDial)2 InformationPane (com.mucommander.ui.layout.InformationPane)2 Container (java.awt.Container)2 Dimension (java.awt.Dimension)2 ActionListener (java.awt.event.ActionListener)2 WindowAdapter (java.awt.event.WindowAdapter)2