/** * Factory method * * @param parent the parent SWT composite in which the view of this controller should be created * @param history the actual history * @return created {@link AbstractHistoryController} */ public AbstractArrayController createArrayController( final Composite parent, final ArrayExpression exp, final FieldImpl field) { final AbstractArrayController newController; if (exp.getType(field) instanceof PrimitiveType) { switch (mode) { case ArraysMainController.MODE_SERIES: newController = new NumericArrayController(parent, exp, field, properties); break; case ArraysMainController.MODE_HISTOGRAM: newController = new BarChartArrayController(parent, exp, field, properties); break; default: newController = null; } } else { newController = new NonNumericArrayController(parent, exp, field, properties); } if (newController != null) { historyControllers.add(newController); newController .getView() .getBtnClose() .addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { historyControllers.remove(newController); adjustWidth(); } }); } return newController; }
/** * Sets the zoom factor for the history views in this manager. * * @param value the zoom factor (must be > 0): 0 < value < 1 --> zoom out 1 = value --> default * size 1 < value < inifity --> zoom in */ public void setZoomFactor(float value) { properties.zoomFactor = value; for (AbstractArrayController hc : historyControllers) { hc.getView().redraw(); } adjustWidth(); }
/** * Compute the required widths of the views and adjust the minimum-width of the scrollbar if * necessary */ public void adjustWidth() { int maxWidth = 0; for (AbstractArrayController hc : historyControllers) { int width = hc.getRequiredWidth(); if (width > maxWidth) { maxWidth = width; } } compViews.setMinWidth(maxWidth); /*for (AbstractArrayController hc : historyControllers) { hc.refresh(); } */ }
public void setMode(int mode) { if (this.mode != mode) { this.mode = mode; ArrayList<AbstractArrayController> controllers = new ArrayList<AbstractArrayController>(historyControllers); for (AbstractArrayController controller : controllers) { controller.getView().dispose(); } historyControllers.clear(); for (AbstractArrayController controller : controllers) { createArrayController(viewsArea, controller.exp, controller.field); } viewsArea.layout(); } }
public void setInstantSearch(String searchParameter) { properties.searchParameter = searchParameter.toLowerCase(); for (AbstractArrayController hc : historyControllers) { hc.getView().redraw(); } }