Example #1
0
  @Override
  public void initialize() {
    container =
        Panels.content(
            null,
            false,
            Layouts.vBoxLayout(
                VBoxLayout.VBoxLayoutAlign.STRETCH, new Layouts.LayoutOptions(new Padding(10))),
            "x-border-layout-ct");
    container.setScrollMode(Style.Scroll.AUTOY);
    container.addStyleName("contact-details-container");
    add(container);

    saveButton = Forms.button(I18N.CONSTANTS.save(), IconImageBundle.ICONS.save());
    deleteButton = Forms.button(I18N.CONSTANTS.delete(), IconImageBundle.ICONS.remove());
    exportButton = Forms.button(I18N.CONSTANTS.export(), IconImageBundle.ICONS.excel());

    toolBar = new ToolBar();
    toolBar.setAlignment(Style.HorizontalAlignment.LEFT);
    toolBar.setBorders(false);
    toolBar.add(saveButton);
    toolBar.add(deleteButton);
    toolBar.add(exportButton);

    container.setTopComponent(toolBar);
  }
  private void createGestureTypeList() {
    ContentPanel gestureTypesContainer = new ContentPanel();
    gestureTypesContainer.setHeaderVisible(false);
    gestureTypesContainer.setLayout(new FitLayout());
    // overflow-auto style is for IE hack.
    gestureTypesContainer.addStyleName("overflow-auto");
    gestureTypesContainer.setBorders(false);
    gestureTypesContainer.setBodyBorder(false);

    ListStore<BeanModel> gestureStore = new ListStore<BeanModel>();
    GestureType[] gestureTypes = GestureType.values();
    existsGestureTypeModels = new ArrayList<BeanModel>();

    for (int i = 0; i < gestureTypes.length; i++) {
      Gesture gesture = new Gesture(gestureTypes[i]);
      gesture.setOid(IDUtil.nextID());
      gestureMaps.put(gestureTypes[i].toString(), gesture);
      BeanModel gestureBeanModel = gesture.getBeanModel();
      gestureStore.add(gestureBeanModel);
      for (Gesture existGesture : gestures) {
        if (gestureTypes[i].equals(existGesture.getType())) {
          gestureMaps.put(existGesture.getType().toString(), existGesture);
          existsGestureTypeModels.add(gestureBeanModel);
        }
      }
    }

    gestureTypeListView =
        new CheckBoxListViewExt<BeanModel>() {
          @Override
          protected void afterRender() {
            super.afterRender();
            for (BeanModel checkedModel : existsGestureTypeModels) {
              this.setChecked(checkedModel, true);
            }
          }
        };
    gestureTypeListView.setStore(gestureStore);
    gestureTypeListView.setDisplayProperty("type");
    gestureTypeListView.setStyleAttribute("overflow", "auto");
    gestureTypesContainer.add(gestureTypeListView);

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setMargins(new Margins(0, 5, 0, 0));
    add(gestureTypesContainer, westData);
  }
Example #3
0
  private ContentPanel createScreenPairList(GroupRef groupRef) {
    TouchPanelDefinition touchPanel = groupRef.getPanel().getTouchPanelDefinition();

    ContentPanel screenContainer = new ContentPanel();
    screenContainer.setHeaderVisible(false);
    screenContainer.setWidth(260);
    screenContainer.setHeight(150);
    screenContainer.setLayout(new FitLayout());
    // overflow-auto style is for IE hack.
    screenContainer.addStyleName("overflow-auto");

    screenPairListView = new CheckBoxListView<BeanModel>();
    ListStore<BeanModel> store = new ListStore<BeanModel>();

    List<BeanModel> otherModels = new ArrayList<BeanModel>();
    List<BeanModel> screenPairModels = BeanModelDataBase.screenTable.loadAll();
    List<BeanModel> selectedModels = new ArrayList<BeanModel>();
    for (ScreenPairRef screenRef : groupRef.getGroup().getScreenRefs()) {
      selectedModels.add(screenRef.getScreen().getBeanModel());
    }
    for (BeanModel screenPairModel : screenPairModels) {
      if (((ScreenPair) screenPairModel.getBean()).getTouchPanelDefinition().equals(touchPanel)) {
        store.add(screenPairModel);
        screenPairListView.getSelectionModel().select(screenPairModel, true);
      } else if (((ScreenPair) screenPairModel.getBean())
          .getTouchPanelDefinition()
          .getCanvas()
          .equals(touchPanel.getCanvas())) {
        otherModels.add(screenPairModel);
      }
    }

    store.add(otherModels);
    for (BeanModel selectedModel : selectedModels) {
      screenPairListView.setChecked(selectedModel, true);
    }
    screenPairListView.setStore(store);
    screenPairListView.setDisplayProperty("panelName");
    screenPairListView.setStyleAttribute("overflow", "auto");
    screenPairListView.setSelectStyle("screen-view-item-sel");
    screenContainer.add(screenPairListView);
    return screenContainer;
  }