private ContentPanel getJobnamePanel() {
   if (jobnamePanel == null) {
     jobnamePanel = new ContentPanel();
     jobnamePanel.setWidth("314px");
     jobnamePanel.setHeading("Jobname & group");
     jobnamePanel.setLayout(new FitLayout());
     jobnamePanel.add(getFirstRowLeftSide(), new FitData(10));
   }
   return jobnamePanel;
 }
 private ContentPanel getEmailPanel() {
   if (emailPanel == null) {
     emailPanel = new ContentPanel();
     emailPanel.setWidth("275px");
     emailPanel.setLayout(new FitLayout());
     emailPanel.setHeading("Email");
     emailPanel.setCollapsible(false);
     emailPanel.add(getFirstRowRightSide(), new FitData(10));
   }
   return emailPanel;
 }
Exemple #3
0
  public LibraryData(HorizontalPanel lp, DrakeGeneticsServiceAsync drakeGeneticsService) {
    this.libraryPanel = lp;

    final DrakeGeneticsServiceAsync dgs = drakeGeneticsService;
    drakeGeneticsService.getLibrary(
        new AsyncCallback<LibraryNode>() {
          public void onSuccess(LibraryNode results) {
            getTreeModelSucceeded(results, dgs);
          }

          public void onFailure(Throwable caught) {
            getTreeModelFailed(caught);
          }
        });

    treePanel.setHeaderVisible(true);
    treePanel.setLayout(new FitLayout());
    treePanel.setHeading("Publications");

    tree.setDisplayProperty("name");
    tree.setWidth(200);
    // tree.setHeight(450);
    tree.setHeight(670);
    tree.addListener(
        Events.OnClick,
        new Listener<TreePanelEvent<ModelData>>() {

          public void handleEvent(TreePanelEvent<ModelData> be) {
            ModelData item = be.getItem();
            String url = (String) item.get("url");
            if (url != null && !url.equals("")) {
              if (url.startsWith("/")) {
                url = url.substring(1);
              }
              libraryDocumentPanel.setUrl(GWT.getHostPageBaseURL() + url);
            }
          }
        });

    treePanel.add(tree);

    libraryPanel.add(treePanel);

    libraryDocumentPanel.setHeaderVisible(false);
    libraryDocumentPanel.setWidth(494);
    // libraryDocumentPanel.setHeight(451);
    libraryDocumentPanel.setHeight(671);
    libraryDocumentPanel.setUrl(GWT.getHostPageBaseURL() + "Library/index.html");
    libraryPanel.add(libraryDocumentPanel);
  }
  private FieldSet setupIdentifierfieldSet(int widthPanel, int tabIndex) {
    FieldSet identifierfieldSet = new FieldSet();
    identifierfieldSet.setHeading("Identifiers");
    identifierfieldSet.setCollapsible(true);
    identifierfieldSet.setBorders(false);
    FormLayout identifierlayout = new FormLayout();
    identifierlayout.setLabelWidth(150);
    identifierlayout.setDefaultWidth(390); // It is the real function to set the textField width
    identifierfieldSet.setLayout(identifierlayout);

    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.setWidth(widthPanel);
    cp.add(setupIdentifierGrid(identifierStore, widthPanel - 33, tabIndex));

    identifierfieldSet.add(cp);

    return identifierfieldSet;
  }
  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;
  }
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    final FitLayout fl = new FitLayout();

    LayoutContainer layoutContainer = new LayoutContainer();
    layoutContainer.setBorders(false);
    layoutContainer.setLayout(fl);

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(3);

    ContentPanel cpGrid = new ContentPanel();
    cpGrid.setHeaderVisible(true);
    cpGrid.setHeading("Lista Dipendenti.");
    cpGrid.setBorders(false);
    cpGrid.setFrame(true);
    cpGrid.setHeight((h - 65));
    cpGrid.setWidth(w - 250);
    cpGrid.setScrollMode(Scroll.AUTO);
    cpGrid.setLayout(new FitLayout());
    cpGrid.setButtonAlign(HorizontalAlignment.CENTER);
    Resizable r = new Resizable(cpGrid);

    btnPrint = new Button();
    btnPrint.setEnabled(true);
    btnPrint.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.print24()));
    btnPrint.setIconAlign(IconAlign.TOP);
    btnPrint.setToolTip("Stampa");
    btnPrint.setSize(26, 26);
    btnPrint.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            SessionManagementService.Util.getInstance()
                .setDatiReportCostiDip(
                    "RIEP.COSTI",
                    store.getModels(),
                    new AsyncCallback<Boolean>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        Window.alert("Error on setNomeReport()");
                      }

                      @Override
                      public void onSuccess(Boolean result) {
                        if (result) fp.submit();
                        else
                          Window.alert(
                              "Problemi durante il settaggio dei parametri in Sessione (http)");
                      }
                    });
          }
        });

    btnAdd = new Button();
    btnAdd.setStyleAttribute("padding-left", "2px");
    btnAdd.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.add()));
    btnAdd.setIconAlign(IconAlign.TOP);
    btnAdd.setSize(26, 26);
    btnAdd.setToolTip("Nuova Offerta");
    btnAdd.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            RiepilogoCostiDipendentiModel am =
                new RiepilogoCostiDipendentiModel(
                    0, 0, "", "0.00", "", "0", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "",
                    "", "");

            gridRiepilogo.stopEditing();
            store.insert(am, 0);
            gridRiepilogo.startEditing(store.indexOf(am), 0);
          }
        });

    btnConfirm = new Button();
    btnConfirm.setEnabled(true);
    btnConfirm.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.confirm()));
    btnConfirm.setIconAlign(IconAlign.TOP);
    btnConfirm.setToolTip("Conferma modifiche");
    btnConfirm.setSize(26, 26);
    btnConfirm.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {

            RiepilogoCostiDipendentiModel c = new RiepilogoCostiDipendentiModel();

            for (Record record : store.getModifiedRecords()) {

              c = (RiepilogoCostiDipendentiModel) record.getModel();

              AdministrationService.Util.getInstance()
                  .editDatiCostiAzienda(
                      c,
                      new AsyncCallback<Boolean>() {

                        @Override
                        public void onFailure(Throwable caught) {
                          Window.alert("Errore di connessione on insertNewOffertaWithRda();");
                        }

                        @Override
                        public void onSuccess(Boolean result) {
                          if (result) {
                            caricaTabellaDati();
                          } else {
                            Window.alert(
                                "error: Impossibile effettuare l'inserimento/modifica dei dati!");
                          }
                        }
                      });
            }
          }
        });

    if ((ruolo.compareTo("PM") == 0)) {
      btnConfirm.disable();
      btnAdd.disable();
    }

    smplcmbxSede = new SimpleComboBox<String>();
    smplcmbxSede.setFieldLabel("Sede");
    smplcmbxSede.setWidth(65);
    smplcmbxSede.setEmptyText("Sede..");
    smplcmbxSede.setAllowBlank(false);
    smplcmbxSede.add("T");
    smplcmbxSede.add("B");
    smplcmbxSede.setStyleAttribute("padding-left", "2px");
    smplcmbxSede.addListener(
        Events.Select,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            caricaTabellaDati();
          }
        });

    // caricaTabellaDati();

    cm = new ColumnModel(createColumns());
    gridRiepilogo = new EditorGrid<RiepilogoCostiDipendentiModel>(store, cm);
    gridRiepilogo.setBorders(false);
    gridRiepilogo.setColumnLines(true);
    gridRiepilogo.setStripeRows(true);
    gridRiepilogo.setItemId("grid");
    gridRiepilogo.setSelectionModel(csm);

    fp.setMethod(FormPanel.METHOD_POST);
    fp.setAction(url);
    fp.addSubmitCompleteHandler(new FormSubmitCompleteHandler());
    fp.add(btnPrint);
    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.add(fp);

    ToolBar tlBar = new ToolBar();
    tlBar.add(smplcmbxSede);
    tlBar.add(btnAdd);
    tlBar.add(btnConfirm);
    tlBar.add(new SeparatorToolItem());
    tlBar.add(cp);

    cpGrid.setTopComponent(tlBar);
    cpGrid.add(gridRiepilogo);

    layoutContainer.add(cpGrid, new FitData(3, 3, 3, 3));

    add(layoutContainer);
  }
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    final ExampleServiceAsync service = (ExampleServiceAsync) Registry.get(Examples.SERVICE);

    RpcProxy<List<Photo>> proxy =
        new RpcProxy<List<Photo>>() {
          @Override
          protected void load(Object loadConfig, AsyncCallback<List<Photo>> callback) {
            service.getPhotos(callback);
          }
        };

    ListLoader<ListLoadResult<Photo>> loader =
        new BaseListLoader<ListLoadResult<Photo>>(proxy, new BeanModelReader());
    ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
    loader.load();

    final ContentPanel panel = new ContentPanel();
    panel.setCollapsible(true);
    panel.setAnimCollapse(false);
    panel.setFrame(true);
    panel.setHeading("CheckBox ListView (0 items selected)");
    panel.setWidth(300);
    panel.setAutoHeight(true);
    panel.setBodyBorder(false);

    final CheckBoxListView<BeanModel> view =
        new CheckBoxListView<BeanModel>() {
          @Override
          protected BeanModel prepareData(BeanModel model) {
            String s = model.get("name");
            model.set("shortName", Format.ellipse(s, 15));
            return model;
          }
        };

    view.setStore(store);
    view.setDisplayProperty("name");
    view.getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<BeanModel>>() {

              public void handleEvent(SelectionChangedEvent<BeanModel> be) {
                panel.setHeading(
                    "CheckBox ListView (" + be.getSelection().size() + " items selected)");
              }
            });
    panel.add(view);

    panel.addButton(
        new Button(
            "get checked items",
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                Info.display(
                    "Checked Items", "There are " + view.getChecked().size() + " items checked!");
              }
            }));
    add(panel);
  }