Пример #1
0
 public ScreenViewImpl getScreenView(Screen screen) {
   ScreenViewImpl screenView = null;
   if (screen != null) {
     int screenId = screen.getId();
     screenView = screenViewMap.get(screenId);
     if (screenView == null) {
       screenView = buildScreenView(screen);
       if (screenView != null) {
         screenViewMap.put(screenId, screenView);
       }
     }
   }
   return screenView;
 }
Пример #2
0
  private ScreenViewImpl buildScreenView(Screen screen) {
    ScreenViewImpl screenView = new ScreenViewImpl();

    // Set background if defined
    screenView.setBackground(screen.getBackground());

    // Check orientation
    Boolean isLandscape = screen.getLandscape();
    if (isLandscape != null && isLandscape) {
      screenView.setIsLandscape(true);
    }

    // Create panel components
    try {
      List<AbsoluteLayout> absoluteElems = screen.getAbsolute();

      if (absoluteElems != null) {
        for (AbsoluteLayout layout : absoluteElems) {
          // Create Absolute Panel Component
          AbsolutePanelComponent absPanel = AbsolutePanelComponent.build(layout);
          screenView.addPanelComponent(absPanel);
        }
      }

      List<GridLayout> gridElems = screen.getGrid();

      if (gridElems != null) {
        for (GridLayout layout : gridElems) {
          // Create Grid Panel Component
          GridPanelComponent gridPanel = GridPanelComponent.build(layout);
          screenView.addPanelComponent(gridPanel);
        }
      }

      List<FormLayout> formElems = screen.getForm();

      if (formElems != null) {
        for (FormLayout layout : formElems) {
          FormPanelComponent formPanel = FormPanelComponent.build(layout);
          screenView.addPanelComponent(formPanel);
        }
      }

      List<ListLayout> listElems = screen.getList();

      if (listElems != null) {
        for (ListLayout layout : listElems) {
          ListPanelComponent listPanel = ListPanelComponent.build(layout);
          screenView.addPanelComponent(listPanel);
        }
      }
    } catch (Exception e) {
      return null;
    }
    return screenView;
  }