Search in sources :

Example 1 with MessagePanel

use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.MessagePanel in project clusterMaker2 by RBVI.

the class DendroView method setupViews.

/**
 *  This method should be called only during initial setup of the modelview
 *
 *  It sets up the views and binds them all to config nodes.
 */
protected void setupViews() {
    colorPresets = new ColorPresets(root);
    cpresetEditor = new ColorPresetEditor(colorPresets);
    ColorExtractor colorExtractor = new ColorExtractor();
    colorExtractor.setDefaultColorSet(colorPresets.getDefaultColorSet());
    colorExtractor.bindConfig(root);
    colorExtractor.setMissing(DataModel.NODATA, DataModel.EMPTY);
    hintpanel = new MessagePanel("Usage Hints");
    statuspanel = new MessagePanel("View Status");
    DoubleArrayDrawer dArrayDrawer = new DoubleArrayDrawer();
    dArrayDrawer.setColorExtractor(colorExtractor);
    arrayDrawer = dArrayDrawer;
    ((Observable) getDataModel()).addObserver(arrayDrawer);
    globalview = new GlobalView();
    // scrollbars, mostly used by maps
    globalXscrollbar = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 1);
    globalYscrollbar = new JScrollBar(JScrollBar.VERTICAL, 0, 1, 0, 1);
    zoomXscrollbar = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 1);
    zoomYscrollbar = new JScrollBar(JScrollBar.VERTICAL, 0, 1, 0, 1);
    zoomXmap = new MapContainer();
    zoomXmap.setDefaultScale(12.0);
    zoomXmap.setScrollbar(zoomXscrollbar);
    zoomYmap = new MapContainer();
    zoomYmap.setDefaultScale(12.0);
    zoomYmap.setScrollbar(zoomYscrollbar);
    // globalmaps tell globalview, atrview, and gtrview
    // where to draw each data point.
    // the scrollbars "scroll" by communicating with the maps.
    globalXmap = new MapContainer();
    globalXmap.setDefaultScale(2.0);
    globalXmap.setScrollbar(globalXscrollbar);
    globalYmap = new MapContainer();
    globalYmap.setDefaultScale(2.0);
    globalYmap.setScrollbar(globalYscrollbar);
    globalview.setXMap(globalXmap);
    globalview.setYMap(globalYmap);
    globalview.setZoomYMap(getZoomYmap());
    globalview.setZoomXMap(getZoomXmap());
    globalview.setArrayDrawer(arrayDrawer);
    arraynameview = new ArrayNameView(getDataModel().getArrayHeaderInfo());
    arraynameview.setDataModel(getDataModel());
    leftTreeDrawer = new LeftTreeDrawer();
    gtrview = new GTRView();
    gtrview.setMap(globalYmap);
    gtrview.setLeftTreeDrawer(leftTreeDrawer);
    gtrview.getHeaderSummary().setIncluded(new int[] { 0, 3 });
    invertedTreeDrawer = new InvertedTreeDrawer();
    atrview = new ATRView();
    atrview.setMap(globalXmap);
    atrview.setInvertedTreeDrawer(invertedTreeDrawer);
    atrview.getHeaderSummary().setIncluded(new int[] { 0, 3 });
    atrzview = new ATRZoomView();
    atrzview.setZoomMap(getZoomXmap());
    atrzview.setHeaderSummary(atrview.getHeaderSummary());
    atrzview.setInvertedTreeDrawer(invertedTreeDrawer);
    zoomview = new ZoomView();
    zoomview.setYMap(getZoomYmap());
    zoomview.setXMap(getZoomXmap());
    zoomview.setArrayDrawer(arrayDrawer);
    arraynameview.setMapping(getZoomXmap());
    textview = new TextViewManager(getDataModel().getGeneHeaderInfo());
    textview.setMap(getZoomYmap());
    doDoubleLayout();
    // reset persistent popups
    settingsFrame = null;
    // urls
    colorExtractor.bindConfig(getFirst("ColorExtractor"));
    // set data first to avoid adding auto-genereated contrast to documentConfig.
    dArrayDrawer.setDataMatrix(getDataModel().getDataMatrix());
    dArrayDrawer.bindConfig(getFirst("ArrayDrawer"));
    // this is here because my only subclass shares this code.
    bindTrees();
    zoomview.setHeaders(getDataModel().getGeneHeaderInfo(), getDataModel().getArrayHeaderInfo());
    globalXmap.bindConfig(getFirst("GlobalXMap"));
    globalYmap.bindConfig(getFirst("GlobalYMap"));
    getZoomXmap().bindConfig(getFirst("ZoomXMap"));
    getZoomYmap().bindConfig(getFirst("ZoomYMap"));
    textview.bindConfig(getFirst("TextView"));
    arraynameview.bindConfig(getFirst("ArrayNameView"));
    HeaderSummary atrSummary = atrview.getHeaderSummary();
    atrzview.setHeaderSummary(atrSummary);
    atrSummary.bindConfig(getFirst("AtrSummary"));
    gtrview.getHeaderSummary().bindConfig(getFirst("GtrSummary"));
    // perhaps I could remember this stuff in the MapContainer...
    globalXmap.setIndexRange(0, dataModel.getDataMatrix().getNumCol() - 1);
    globalYmap.setIndexRange(0, dataModel.getDataMatrix().getNumRow() - 1);
    getZoomXmap().setIndexRange(-1, -1);
    getZoomYmap().setIndexRange(-1, -1);
    globalXmap.notifyObservers();
    globalYmap.notifyObservers();
    getZoomXmap().notifyObservers();
    getZoomYmap().notifyObservers();
}
Also used : Observable(java.util.Observable) HeaderSummary(edu.ucsf.rbvi.clusterMaker2.internal.treeview.HeaderSummary) MessagePanel(edu.ucsf.rbvi.clusterMaker2.internal.treeview.MessagePanel)

Example 2 with MessagePanel

use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.MessagePanel in project clusterMaker2 by RBVI.

the class KnnDendroView method setupViews.

/**
 *  This method should be called only during initial setup of the modelview
 *
 *  It sets up the views and binds them all to config nodes.
 */
protected void setupViews() {
    DataModel knnModel = getDataModel();
    hintpanel = new MessagePanel("Usage Hints");
    statuspanel = new MessagePanel("View Status");
    colorPresets = new ColorPresets(root);
    cpresetEditor = new ColorPresetEditor(colorPresets);
    ColorExtractor colorExtractor = new ColorExtractor();
    colorExtractor.setDefaultColorSet(colorPresets.getDefaultColorSet());
    colorExtractor.bindConfig(root);
    colorExtractor.setMissing(DataModel.NODATA, DataModel.EMPTY);
    KnnArrayDrawer kArrayDrawer = new KnnArrayDrawer();
    kArrayDrawer.setColorExtractor(colorExtractor);
    arrayDrawer = kArrayDrawer;
    // XXX shouldn't need to observer, should be immuable?
    ((Observable) getDataModel()).addObserver(arrayDrawer);
    globalview = new GlobalView();
    // scrollbars, mostly used by maps
    globalXscrollbar = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 1);
    globalYscrollbar = new JScrollBar(JScrollBar.VERTICAL, 0, 1, 0, 1);
    zoomXscrollbar = new JScrollBar(JScrollBar.HORIZONTAL, 0, 1, 0, 1);
    zoomYscrollbar = new JScrollBar(JScrollBar.VERTICAL, 0, 1, 0, 1);
    zoomXmap = new MapContainer();
    zoomXmap.setDefaultScale(12.0);
    zoomXmap.setScrollbar(zoomXscrollbar);
    zoomYmap = new MapContainer();
    zoomYmap.setDefaultScale(12.0);
    zoomYmap.setScrollbar(zoomYscrollbar);
    // globalmaps tell globalview, atrview, and gtrview
    // where to draw each data point.
    // the scrollbars "scroll" by communicating with the maps.
    globalXmap = new MapContainer();
    globalXmap.setDefaultScale(2.0);
    globalXmap.setScrollbar(globalXscrollbar);
    globalYmap = new MapContainer();
    globalYmap.setDefaultScale(2.0);
    globalYmap.setScrollbar(globalYscrollbar);
    globalview.setXMap(globalXmap);
    globalview.setYMap(globalYmap);
    globalview.setZoomYMap(getZoomYmap());
    globalview.setZoomXMap(getZoomXmap());
    arraynameview = new ArrayNameView(getDataModel().getArrayHeaderInfo());
    leftTreeDrawer = new LeftTreeDrawer();
    gtrview = new GTRView();
    gtrview.setMap(globalYmap);
    gtrview.setLeftTreeDrawer(leftTreeDrawer);
    invertedTreeDrawer = new InvertedTreeDrawer();
    atrview = new ATRView();
    atrview.setMap(globalXmap);
    atrview.setInvertedTreeDrawer(invertedTreeDrawer);
    atrzview = new ATRZoomView();
    atrzview.setZoomMap(getZoomXmap());
    atrzview.setInvertedTreeDrawer(invertedTreeDrawer);
    zoomview = new ZoomView();
    zoomview.setYMap(getZoomYmap());
    zoomview.setXMap(getZoomXmap());
    zoomview.setArrayDrawer(arrayDrawer);
    globalview.setArrayDrawer(arrayDrawer);
    arraynameview.setMapping(getZoomXmap());
    textview = new TextViewManager(getDataModel().getGeneHeaderInfo());
    textview.setMap(getZoomYmap());
    doDoubleLayout();
    // reset persistent popups
    settingsFrame = null;
    // color extractor
    colorExtractor.bindConfig(getFirst("ColorExtractor"));
    // set data first to avoid adding auto-genereated contrast to documentConfig.
    kArrayDrawer.setDataMatrix(knnModel.getDataMatrix());
    kArrayDrawer.bindConfig(getFirst("ArrayDrawer"));
    // responsible for adding and removing components...
    bindTrees();
    globalXmap.bindConfig(getFirst("GlobalXMap"));
    globalYmap.bindConfig(getFirst("GlobalYMap"));
    getZoomXmap().bindConfig(getFirst("ZoomXMap"));
    getZoomYmap().bindConfig(getFirst("ZoomYMap"));
    textview.bindConfig(getFirst("TextViewParent"));
    arraynameview.bindConfig(getFirst("ArrayNameView"));
    // perhaps I could remember this stuff in the MapContainer...
    DataMatrix dataMatrix = getDataModel().getDataMatrix();
    globalXmap.setIndexRange(0, dataMatrix.getNumCol() - 1);
    globalYmap.setIndexRange(0, dataMatrix.getNumRow() - 1);
    getZoomXmap().setIndexRange(-1, -1);
    getZoomYmap().setIndexRange(-1, -1);
    globalXmap.notifyObservers();
    globalYmap.notifyObservers();
    getZoomXmap().notifyObservers();
    getZoomYmap().notifyObservers();
}
Also used : DataMatrix(edu.ucsf.rbvi.clusterMaker2.internal.treeview.DataMatrix) Observable(java.util.Observable) JScrollBar(javax.swing.JScrollBar) DataModel(edu.ucsf.rbvi.clusterMaker2.internal.treeview.DataModel) MessagePanel(edu.ucsf.rbvi.clusterMaker2.internal.treeview.MessagePanel)

Aggregations

MessagePanel (edu.ucsf.rbvi.clusterMaker2.internal.treeview.MessagePanel)2 Observable (java.util.Observable)2 DataMatrix (edu.ucsf.rbvi.clusterMaker2.internal.treeview.DataMatrix)1 DataModel (edu.ucsf.rbvi.clusterMaker2.internal.treeview.DataModel)1 HeaderSummary (edu.ucsf.rbvi.clusterMaker2.internal.treeview.HeaderSummary)1 JScrollBar (javax.swing.JScrollBar)1