use of javax.swing.event.ChangeEvent in project gephi by gephi.
the class RankingSizeTransformerPanel method setup.
public void setup(RankingFunction function) {
sizeTransformer = (RankingNodeSizeTransformer) function.getTransformer();
final String MIN_SIZE = "RankingSizeTransformerPanel_" + sizeTransformer.getClass().getSimpleName() + "_min";
final String MAX_SIZE = "RankingSizeTransformerPanel_" + sizeTransformer.getClass().getSimpleName() + "_max";
float minSizeStart = NbPreferences.forModule(RankingSizeTransformerPanel.class).getFloat(MIN_SIZE, sizeTransformer.getMinSize());
float maxSizeStart = NbPreferences.forModule(RankingSizeTransformerPanel.class).getFloat(MAX_SIZE, sizeTransformer.getMaxSize());
sizeTransformer.setMinSize(minSizeStart);
sizeTransformer.setMaxSize(maxSizeStart);
minSize.setValue(minSizeStart);
maxSize.setValue(maxSizeStart);
minSize.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sizeTransformer.setMinSize((Float) minSize.getValue());
NbPreferences.forModule(RankingSizeTransformerPanel.class).putFloat(MIN_SIZE, (Float) minSize.getValue());
}
});
maxSize.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sizeTransformer.setMaxSize((Float) maxSize.getValue());
NbPreferences.forModule(RankingSizeTransformerPanel.class).putFloat(MAX_SIZE, (Float) maxSize.getValue());
}
});
}
use of javax.swing.event.ChangeEvent in project gephi by gephi.
the class ConvertColumnToDynamicTimestampsUI method buildValidationPanel.
private void buildValidationPanel() {
validationPanel = new ValidationPanel();
validationPanel.setInnerComponent(this);
ValidationGroup group = validationPanel.getValidationGroup();
group.add(titleTextField, new ColumnTitleValidator(table));
group.add(timestampText, new IntervalBoundValidator());
validationPanel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
dialogControls.setOkButtonEnabled(!validationPanel.isProblem());
}
});
}
use of javax.swing.event.ChangeEvent in project gephi by gephi.
the class ConvertColumnToDynamicUI method buildValidationPanel.
private void buildValidationPanel() {
validationPanel = new ValidationPanel();
validationPanel.setInnerComponent(this);
ValidationGroup group = validationPanel.getValidationGroup();
group.add(titleTextField, new ColumnTitleValidator(table));
group.add(intervalStartText, new IntervalBoundValidator());
group.add(intervalEndText, new IntervalBoundValidator(intervalStartText));
validationPanel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
dialogControls.setOkButtonEnabled(!validationPanel.isProblem());
}
});
}
use of javax.swing.event.ChangeEvent in project gephi by gephi.
the class EqualStringPanel method createValidationPanel.
public static ValidationPanel createValidationPanel(final EqualStringPanel innerPanel) {
final ValidationPanel validationPanel = new ValidationPanel();
validationPanel.setInnerComponent(innerPanel);
ValidationGroup group = validationPanel.getValidationGroup();
validationPanel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
innerPanel.okButton.setEnabled(!validationPanel.isProblem());
}
});
//Node field
group.add(innerPanel.textField, new RegexValidator(innerPanel));
return validationPanel;
}
use of javax.swing.event.ChangeEvent in project gephi by gephi.
the class DesktopImportControllerUI method importStream.
@Override
public void importStream(final InputStream stream, String importerName) {
try {
final FileImporter importer = controller.getFileImporter(importerName);
if (importer == null) {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message(NbBundle.getMessage(getClass(), "DesktopImportControllerUI.error_no_matching_file_importer"), NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(msg);
return;
}
ImporterUI ui = controller.getUI(importer);
if (ui != null) {
String title = NbBundle.getMessage(DesktopImportControllerUI.class, "DesktopImportControllerUI.file.ui.dialog.title", ui.getDisplayName());
JPanel panel = ui.getPanel();
FileImporter[] fi = (FileImporter[]) Array.newInstance(importer.getClass(), 1);
fi[0] = importer;
ui.setup(fi);
final DialogDescriptor dd = new DialogDescriptor(panel, title);
if (panel instanceof ValidationPanel) {
ValidationPanel vp = (ValidationPanel) panel;
vp.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
dd.setValid(!((ValidationPanel) e.getSource()).isProblem());
}
});
}
Object result = DialogDisplayer.getDefault().notify(dd);
if (!result.equals(NotifyDescriptor.OK_OPTION)) {
ui.unsetup(false);
return;
}
ui.unsetup(true);
}
LongTask task = null;
if (importer instanceof LongTask) {
task = (LongTask) importer;
}
//Execute task
final String containerSource = NbBundle.getMessage(DesktopImportControllerUI.class, "DesktopImportControllerUI.streamSource", importerName);
String taskName = NbBundle.getMessage(DesktopImportControllerUI.class, "DesktopImportControllerUI.taskName", containerSource);
executor.execute(task, new Runnable() {
@Override
public void run() {
try {
Container container = controller.importFile(stream, importer);
if (container != null) {
container.setSource(containerSource);
finishImport(container);
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}, taskName, errorHandler);
} catch (Exception ex) {
Logger.getLogger("").log(Level.WARNING, "", ex);
}
}
Aggregations