use of org.cytoscape.view.presentation.annotations.ShapeAnnotation in project cytoscape-impl by cytoscape.
the class ShapeAnnotationFactory method createAnnotation.
@Override
public ShapeAnnotation createAnnotation(Class<? extends ShapeAnnotation> type, CyNetworkView view, Map<String, String> argMap) {
if (!(view instanceof DGraphView))
return null;
DGraphView dView = (DGraphView) view;
if (type.equals(ShapeAnnotation.class)) {
final ShapeAnnotationImpl a = new ShapeAnnotationImpl(dView, argMap, getActiveWindow());
a.update();
return (ShapeAnnotation) a;
}
return null;
}
use of org.cytoscape.view.presentation.annotations.ShapeAnnotation in project cytoscape-impl by cytoscape.
the class BoundedTextAnnotationDialog method initComponents.
private void initComponents() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setModalityType(DEFAULT_MODALITY_TYPE);
setResizable(false);
setTitle(create ? "Create Bounded Text Annotation" : "Modify Bounded Text Annotation");
// Create the preview panel
preview = new BoundedTextAnnotationImpl(view, getOwner());
preview.setUsedForPreviews(true);
preview.setText(mAnnotation.getText());
preview.setFont(mAnnotation.getFont());
preview.fitShapeToText();
PreviewPanel previewPanel = new PreviewPanel(preview);
shapeAnnotationPanel = new ShapeAnnotationPanel((ShapeAnnotation) mAnnotation, previewPanel);
textAnnotationPanel = new TextAnnotationPanel((TextAnnotation) mAnnotation, 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(shapeAnnotationPanel).addComponent(textAnnotationPanel).addComponent(previewPanel, DEFAULT_SIZE, PREVIEW_WIDTH, Short.MAX_VALUE).addComponent(buttonPanel));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(shapeAnnotationPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).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();
}
Aggregations