Search in sources :

Example 1 with PropertyUpdatedEvent

use of org.cytoscape.property.PropertyUpdatedEvent in project cytoscape-impl by cytoscape.

the class PreferencesDialog method initGUI.

private void initGUI() throws Exception {
    closeButton = new JButton(new AbstractAction("Close") {

        @Override
        public void actionPerformed(ActionEvent e) {
            final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
            for (String key : itemChangedMap.keySet()) {
                if (itemChangedMap.get(key)) {
                    PropertyUpdatedEvent event = new PropertyUpdatedEvent(cyPropMap.get(key));
                    eventHelper.fireEvent(event);
                    itemChangedMap.put(key, false);
                }
            }
            dispose();
        }
    });
    propsTablePane.getViewport().add(prefsTable, null);
    prefsTable.setPreferredScrollableViewportSize(new Dimension(400, 200));
    final JPanel propsTablePanel = new JPanel();
    propsTablePanel.setBorder(LookAndFeelUtil.createTitledBorder("Properties"));
    {
        final GroupLayout layout = new GroupLayout(propsTablePanel);
        propsTablePanel.setLayout(layout);
        layout.setAutoCreateContainerGaps(true);
        layout.setAutoCreateGaps(true);
        layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(cmbPropCategories, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(propsTablePane, DEFAULT_SIZE, DEFAULT_SIZE, 460).addGroup(Alignment.CENTER, layout.createSequentialGroup().addComponent(addPropBtn).addComponent(modifyPropBtn).addComponent(deletePropBtn)));
        layout.setVerticalGroup(layout.createSequentialGroup().addComponent(cmbPropCategories, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(propsTablePane, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(addPropBtn).addComponent(modifyPropBtn).addComponent(deletePropBtn)));
    }
    final JPanel contentPane = new JPanel();
    {
        final GroupLayout layout = new GroupLayout(contentPane);
        contentPane.setLayout(layout);
        layout.setAutoCreateContainerGaps(true);
        layout.setAutoCreateGaps(true);
        // #3534
        final JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(null, closeButton, "Linkout");
        layout.setHorizontalGroup(layout.createParallelGroup(Alignment.TRAILING, true).addComponent(propsTablePanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createSequentialGroup().addComponent(propsTablePanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel));
    }
    setContentPane(contentPane);
    LookAndFeelUtil.setDefaultOkCancelKeyStrokes(getRootPane(), closeButton.getAction(), closeButton.getAction());
    getRootPane().setDefaultButton(closeButton);
}
Also used : CyEventHelper(org.cytoscape.event.CyEventHelper) JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) PropertyUpdatedEvent(org.cytoscape.property.PropertyUpdatedEvent) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) Dimension(java.awt.Dimension) AbstractAction(javax.swing.AbstractAction)

Example 2 with PropertyUpdatedEvent

use of org.cytoscape.property.PropertyUpdatedEvent in project cytoscape-impl by cytoscape.

the class TestProxySettings method run.

@Override
public void run(TaskMonitor tm) {
    tm.setProgress(0.0);
    final CyProperty<Properties> proxyProps = getProxyProperties();
    final Properties props = proxyProps.getProperties();
    storeProxySettings(props);
    final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
    for (String key : oldSettings.keySet()) {
        if (!oldSettings.get(key).equals(props.get(key))) {
            eventHelper.fireEvent(new PropertyUpdatedEvent(proxyProps));
            break;
        }
    }
    oldSettings.clear();
    tm.setProgress(1.0);
}
Also used : CyEventHelper(org.cytoscape.event.CyEventHelper) PropertyUpdatedEvent(org.cytoscape.property.PropertyUpdatedEvent) Properties(java.util.Properties)

Aggregations

CyEventHelper (org.cytoscape.event.CyEventHelper)2 PropertyUpdatedEvent (org.cytoscape.property.PropertyUpdatedEvent)2 Dimension (java.awt.Dimension)1 ActionEvent (java.awt.event.ActionEvent)1 Properties (java.util.Properties)1 AbstractAction (javax.swing.AbstractAction)1 GroupLayout (javax.swing.GroupLayout)1 JButton (javax.swing.JButton)1 JPanel (javax.swing.JPanel)1