*/
protected void init()
{
+ getTopFrame().setSplitFrame(this);
+ getBottomFrame().setSplitFrame(this);
+ getTopFrame().setVisible(true);
+ getBottomFrame().setVisible(true);
+
+ ((AlignFrame) getTopFrame()).getViewport().setCodingComplement(
+ ((AlignFrame) getBottomFrame()).getViewport());
+
setSize(AlignFrame.DEFAULT_WIDTH, Desktop.instance.getHeight() - 20);
adjustLayout();
addKeyListener();
addKeyBindings();
+
+ addCommandListeners();
+ }
+
+ /**
+ * Set the top and bottom frames to listen to each others Commands (e.g. Edit,
+ * Order).
+ */
+ protected void addCommandListeners()
+ {
+ // TODO if CommandListener is only ever 1:1 for complementary views,
+ // may change broadcast pattern to direct messaging (more efficient)
+ final StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
+ ssm.addCommandListener(((AlignFrame) getTopFrame()).getViewport());
+ ssm.addCommandListener(((AlignFrame) getBottomFrame()).getViewport());
}
/**
int w1 = ((AlignFrame) getTopFrame()).getViewport().getIdWidth();
int w2 = ((AlignFrame) getBottomFrame()).getViewport().getIdWidth();
int w3 = Math.max(w1, w2);
- ((AlignFrame) getTopFrame()).getViewport().setIdWidth(w3);
- ((AlignFrame) getBottomFrame()).getViewport().setIdWidth(w3);
+ if (w1 != w3)
+ {
+ ((AlignFrame) getTopFrame()).getViewport().setIdWidth(w3);
+ }
+ if (w2 != w3)
+ {
+ ((AlignFrame) getBottomFrame()).getViewport().setIdWidth(w3);
+ }
/*
* Set the character width for protein to 3 times that for dna.