Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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();
 }
Exemplo n.º 3
0
  /**
   * 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();
    }	*/
  }
Exemplo n.º 4
0
 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();
   }
 }
Exemplo n.º 5
0
 public void setInstantSearch(String searchParameter) {
   properties.searchParameter = searchParameter.toLowerCase();
   for (AbstractArrayController hc : historyControllers) {
     hc.getView().redraw();
   }
 }