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);
}
}
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);
}
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;
}
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);
}
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));
}
}
Aggregations