Exemplo n.º 1
0
  @Override
  protected void initConfig() {
    m_uiFacade = new P_UIFacade();
    super.initConfig();
    setImageTransform(new AffineTransformSpec());
    setAutoFit(getConfiguredAutoFit());
    setImageId(getConfiguredImageId());
    setPanDelta(getConfiguredPanDelta());
    setRotateDelta(getConfiguredRotateDelta());
    setZoomDelta(getConfiguredZoomDelta());
    setDragType(getConfiguredDragType());
    setDropType(getConfiguredDropType());
    setScrollBarEnabled(getConfiguredScrollBarEnabled());

    // menus
    List<Class<? extends IMenu>> declaredMenus = getDeclaredMenus();
    List<IMenu> contributedMenus = m_contributionHolder.getContributionsByClass(IMenu.class);
    OrderedCollection<IMenu> menus = new OrderedCollection<IMenu>();
    for (Class<? extends IMenu> menuClazz : declaredMenus) {
      try {
        menus.addOrdered(ConfigurationUtility.newInnerInstance(this, menuClazz));
      } catch (Exception e) {
        SERVICES
            .getService(IExceptionHandlerService.class)
            .handleException(
                new ProcessingException(
                    "error creating instance of class '" + menuClazz.getName() + "'.", e));
      }
    }
    menus.addAllOrdered(contributedMenus);

    try {
      injectMenusInternal(menus);
    } catch (Exception e) {
      LOG.error("error occured while dynamically contributing menus.", e);
    }
    new MoveActionNodesHandler<IMenu>(menus).moveModelObjects();
    m_contextMenu = new FormFieldContextMenu<IImageField>(this, menus.getOrderedList());
    m_contextMenu.setContainerInternal(this);
  }
Exemplo n.º 2
0
 protected List<Class<? extends IMenu>> getDeclaredMenus() {
   Class[] dca = ConfigurationUtility.getDeclaredPublicClasses(getClass());
   List<Class<IMenu>> filtered = ConfigurationUtility.filterClasses(dca, IMenu.class);
   return ConfigurationUtility.removeReplacedClasses(filtered);
 }