Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Added new layout code to the PlotGridComposite in the spirit of Anna's
Browse files Browse the repository at this point in the history
grid layout settings.

Added some notes for fixing bugs.

Signed-off-by: Jordan Deyton <deytonjh@ornl.gov>
  • Loading branch information
Jordan Deyton committed Apr 10, 2015
1 parent 88c03be commit 72ef96f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Expand Up @@ -293,6 +293,9 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
*/
private void showResource(ICEResource resource) throws PartInitException {

// TODO This method has several return statements, making it a little
// hard to read. It should be updated and simplified.

// If no resource is selected, then clear the current contents of
// the ResourcePage and set the top Control to be the browser with
// an informative text.
Expand Down
Expand Up @@ -40,6 +40,9 @@
*/
public class PlotGridComposite extends Composite {

// FIXME There is a bug where plots are added more than expected. This may
// be an issue with duplicate selection events from the ICEResourceView.

// TODO Populate the context menu based on the clicked plot.

/**
Expand Down Expand Up @@ -303,7 +306,7 @@ public int addPlot(IPlot plot) throws Exception {
// new cell in the grid.
if (category != null && type != null) {
// Create the Composite to contain the plot rendering.
Composite composite = new Composite(gridComposite, SWT.NONE);
Composite composite = new Composite(gridComposite, SWT.BORDER);
adapt(composite);

// Try to create the plot rendering.
Expand Down Expand Up @@ -500,9 +503,21 @@ private void hideCloseButton(MouseEvent e) {
* on the {@link #rows} and {@link #columns} and the number of drawn plots.
*/
private void refreshLayout() {
// TODO

// Remove all excess drawn plots.
int limit = rows * columns;
for (int i = drawnPlots.size() - 1; i >= limit; i--) {
drawnPlots.remove(i).composite.dispose();
}

// Set the user-defined number of columns. The rows are handled already
// because we've removed all excess plots.
gridLayout.numColumns = columns;

// Refresh the grid layout.
gridComposite.layout();

return;
}

/**
Expand Down

0 comments on commit 72ef96f

Please sign in to comment.