Search in sources :

Example 11 with HierarchyEvent

use of java.awt.event.HierarchyEvent in project freeplane by freeplane.

the class ManageAddOnsDialog method install.

public void install(final URL url) {
    if (addOnInstallerPanel.isShowing()) {
        addOnInstallerPanel.getUrlField().setText(url.toString());
        tabbedPane.paintImmediately(0, 0, tabbedPane.getWidth(), tabbedPane.getHeight());
        addOnInstallerPanel.getInstallButton().doClick();
    } else {
        addOnInstallerPanel.addHierarchyListener(new HierarchyListener() {

            public void hierarchyChanged(HierarchyEvent e) {
                if (addOnInstallerPanel.isShowing()) {
                    addOnInstallerPanel.removeHierarchyListener(this);
                    install(url);
                }
            }
        });
        tabbedPane.setSelectedComponent(addOnInstallerPanel);
        if (!isVisible())
            setVisible(true);
    }
}
Also used : HierarchyEvent(java.awt.event.HierarchyEvent) HierarchyListener(java.awt.event.HierarchyListener)

Example 12 with HierarchyEvent

use of java.awt.event.HierarchyEvent in project freeplane by freeplane.

the class PresentationController method createPanel.

private Component createPanel() {
    final Component presentationEditor = presentationEditorController.createPanel(modeController);
    presentationEditor.addHierarchyListener(new HierarchyListener() {

        @Override
        public void hierarchyChanged(HierarchyEvent e) {
            if (0 != (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED))
                presentationState.setHighlightsNodes(e.getComponent().isShowing());
        }
    });
    return new JAutoScrollBarPane(presentationEditor);
}
Also used : JAutoScrollBarPane(org.freeplane.core.ui.components.JAutoScrollBarPane) HierarchyEvent(java.awt.event.HierarchyEvent) Component(java.awt.Component) HierarchyListener(java.awt.event.HierarchyListener)

Example 13 with HierarchyEvent

use of java.awt.event.HierarchyEvent in project freeplane by freeplane.

the class AddAttributeAction method getPanel.

/**
 * This method creates the input dialog
 *
 * @return : the input dialog
 */
private JPanel getPanel() {
    final JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    panel.setBorder(new EtchedBorder());
    final GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.CENTER;
    gridBagConstraints.insets = new Insets(20, 10, 2, 10);
    // Size of JComboBoxes
    final String pattern = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    final JLabel patternLabel = new JLabel(pattern);
    final Dimension comboBoxMaximumSize = patternLabel.getPreferredSize();
    comboBoxMaximumSize.width += 4;
    comboBoxMaximumSize.height += 10;
    // Label: name
    final JLabel nameLabel = new JLabel(TextUtils.getText("attribute_name"));
    panel.add(nameLabel, gridBagConstraints);
    gridBagConstraints.gridx++;
    // Label: value
    final JLabel valueLabel = new JLabel(TextUtils.getText("attribute_value"));
    panel.add(valueLabel, gridBagConstraints);
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    // Attribute name combo-box
    gridBagConstraints.insets = new Insets(2, 10, 20, 10);
    attributeNames = new JComboBoxWithBorder();
    final MapModel map = Controller.getCurrentController().getMap();
    final AttributeRegistry attributes = AttributeRegistry.getRegistry(map);
    final ComboBoxModel names = attributes.getComboBoxModel();
    attributeNames.setModel(new ClonedComboBoxModel(names));
    attributeNames.setEditable(true);
    attributeNames.setMaximumSize(comboBoxMaximumSize);
    attributeNames.setPreferredSize(comboBoxMaximumSize);
    attributeNames.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            selectedAttributeChanged(e.getItem(), attributeValues);
        }
    });
    panel.add(attributeNames, gridBagConstraints);
    // Attribute value combo-box
    attributeValues = new JComboBoxWithBorder();
    attributeValues.setRenderer(new TypedListCellRenderer());
    attributeValues.setMaximumSize(comboBoxMaximumSize);
    attributeValues.setPreferredSize(comboBoxMaximumSize);
    gridBagConstraints.gridx++;
    panel.add(attributeValues, gridBagConstraints);
    // set focus to attributeNames
    panel.addHierarchyListener(new HierarchyListener() {

        public void hierarchyChanged(HierarchyEvent e) {
            final Component component = e.getComponent();
            if (component.isShowing()) {
                attributeNames.requestFocus();
                component.removeHierarchyListener(this);
            }
        }
    });
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) ItemEvent(java.awt.event.ItemEvent) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) MapModel(org.freeplane.features.map.MapModel) HierarchyListener(java.awt.event.HierarchyListener) EtchedBorder(javax.swing.border.EtchedBorder) TypedListCellRenderer(org.freeplane.core.ui.components.TypedListCellRenderer) AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) HierarchyEvent(java.awt.event.HierarchyEvent) ItemListener(java.awt.event.ItemListener) ClonedComboBoxModel(org.freeplane.features.attribute.mindmapmode.AssignAttributeDialog.ClonedComboBoxModel) JComboBoxWithBorder(org.freeplane.core.ui.components.JComboBoxWithBorder) Component(java.awt.Component) ClonedComboBoxModel(org.freeplane.features.attribute.mindmapmode.AssignAttributeDialog.ClonedComboBoxModel) ComboBoxModel(javax.swing.ComboBoxModel)

Example 14 with HierarchyEvent

use of java.awt.event.HierarchyEvent in project freeplane by freeplane.

the class MapViewChangeObserverCompound method fireMapViewCreatedAfterItIsDisplayed.

private void fireMapViewCreatedAfterItIsDisplayed(final MapView view) {
    HierarchyListener retryEventListener = new HierarchyListener() {

        public void hierarchyChanged(HierarchyEvent e) {
            if (view.isShowing()) {
                view.removeHierarchyListener(this);
                mapViewCreated(view);
            }
        }
    };
    view.addHierarchyListener(retryEventListener);
}
Also used : HierarchyEvent(java.awt.event.HierarchyEvent) HierarchyListener(java.awt.event.HierarchyListener)

Example 15 with HierarchyEvent

use of java.awt.event.HierarchyEvent in project freeplane by freeplane.

the class AttributeTable method updateRowHeights.

private void updateRowHeights() {
    if (!isDisplayable()) {
        addHierarchyListener(new HierarchyListener() {

            public void hierarchyChanged(HierarchyEvent e) {
                if (isDisplayable()) {
                    updateRowHeights();
                    removeHierarchyListener(this);
                }
            }
        });
        return;
    }
    final int rowCount = getRowCount();
    if (rowCount == 0) {
        return;
    }
    final int constHeight = getTableHeaderHeight() + AttributeTable.EXTRA_HEIGHT;
    final float zoom = getZoom();
    final float fontSize = (float) getFont().getMaxCharBounds(((Graphics2D) getGraphics()).getFontRenderContext()).getHeight();
    final float tableRowHeight = fontSize + zoom * AttributeTable.TABLE_ROW_HEIGHT;
    int newHeight = (int) ((tableRowHeight * rowCount + (zoom - 1) * constHeight) / rowCount);
    if (newHeight < 1) {
        newHeight = 1;
    }
    final int highRowsNumber = (int) ((tableRowHeight - newHeight) * rowCount);
    for (int i = 0; i < highRowsNumber; i++) {
        setRowHeight(i, 1 + newHeight + (i == highRowIndex ? AttributeTable.EXTRA_HEIGHT : 0));
    }
    for (int i = highRowsNumber; i < rowCount; i++) {
        setRowHeight(i, newHeight + (i == highRowIndex ? AttributeTable.EXTRA_HEIGHT : 0));
    }
}
Also used : HierarchyEvent(java.awt.event.HierarchyEvent) HierarchyListener(java.awt.event.HierarchyListener)

Aggregations

HierarchyEvent (java.awt.event.HierarchyEvent)20 HierarchyListener (java.awt.event.HierarchyListener)19 Window (java.awt.Window)5 WindowEvent (java.awt.event.WindowEvent)5 Component (java.awt.Component)4 WindowAdapter (java.awt.event.WindowAdapter)4 DetachedFrame (com.haulmont.cuba.desktop.DetachedFrame)2 ItemEvent (java.awt.event.ItemEvent)2 ItemListener (java.awt.event.ItemListener)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 PropertyChangeListener (java.beans.PropertyChangeListener)2 JDialog (javax.swing.JDialog)2 JComboBoxWithBorder (org.freeplane.core.ui.components.JComboBoxWithBorder)2 RenderResult (com.android.tools.idea.rendering.RenderResult)1 ButtonTabComponent (com.haulmont.cuba.desktop.sys.ButtonTabComponent)1 DisabledGlassPane (com.haulmont.cuba.desktop.sys.DisabledGlassPane)1 Editor (com.intellij.openapi.editor.Editor)1 com.intellij.openapi.fileEditor (com.intellij.openapi.fileEditor)1 PsiFile (com.intellij.psi.PsiFile)1 Update (com.intellij.util.ui.update.Update)1