use of org.cytoscape.ding.impl.cyannotator.annotations.TextAnnotationImpl in project cytoscape-impl by cytoscape.
the class TextAnnotationDialog method initComponents.
private void initComponents() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setModalityType(DEFAULT_MODALITY_TYPE);
setResizable(false);
setTitle(create ? "Create Text Annotation" : "Modify Text Annotation");
// Create the preview panel
preview = new TextAnnotationImpl(view, getOwner());
preview.setUsedForPreviews(true);
preview.getComponent().setSize(PREVIEW_WIDTH - 10, PREVIEW_HEIGHT - 10);
PreviewPanel previewPanel = new PreviewPanel(preview);
textAnnotationPanel = new TextAnnotationPanel(mAnnotation, previewPanel);
getContentPane().add(textAnnotationPanel);
getContentPane().add(previewPanel);
applyButton = new JButton(new AbstractAction("OK") {
@Override
public void actionPerformed(ActionEvent e) {
applyButtonActionPerformed(e);
}
});
cancelButton = new JButton(new AbstractAction("Cancel") {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
});
final JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(applyButton, cancelButton);
final JPanel contents = new JPanel();
final GroupLayout layout = new GroupLayout(contents);
contents.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(LEADING, true).addComponent(textAnnotationPanel).addComponent(previewPanel, DEFAULT_SIZE, PREVIEW_WIDTH, Short.MAX_VALUE).addComponent(buttonPanel));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(textAnnotationPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(previewPanel, DEFAULT_SIZE, PREVIEW_HEIGHT, Short.MAX_VALUE).addComponent(buttonPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(getRootPane(), applyButton.getAction(), cancelButton.getAction());
getRootPane().setDefaultButton(applyButton);
getContentPane().add(contents);
pack();
}
use of org.cytoscape.ding.impl.cyannotator.annotations.TextAnnotationImpl in project cytoscape-impl by cytoscape.
the class TextAnnotationFactory method createAnnotation.
@Override
public TextAnnotation createAnnotation(Class<? extends TextAnnotation> type, CyNetworkView view, Map<String, String> argMap) {
if (!(view instanceof DGraphView))
return null;
DGraphView dView = (DGraphView) view;
if (type.equals(TextAnnotation.class)) {
final TextAnnotationImpl a = new TextAnnotationImpl(dView, argMap, getActiveWindow());
a.update();
return (TextAnnotation) a;
}
return null;
}
Aggregations