コード例 #1
0
ファイル: Smape.java プロジェクト: rabbbit/mock-up-with-GWT
  private Window createStatisticWindow() {

    Window w = new Window();
    w.setIcon(IconHelper.createStyle("bogus"));
    w.setMinimizable(true);
    w.setMaximizable(true);
    w.setHeading("Statistics ");
    w.setSize(400, 400);

    w.setLayout(new AccordionLayout());

    ContentPanel cp = new ContentPanel();
    cp.setHeading("Most contacted friends this month");
    cp.setFrame(false);
    cp.setSize(300, 300);

    Frame frame = new Frame();
    frame.setUrl("chart.html");
    frame.setLayoutData(new FitLayout());
    cp.setLayout(new FitLayout());
    cp.add(frame);

    w.add(cp);

    cp = new ContentPanel();
    cp.setHeading("Most contacted friends in total");
    cp.setFrame(false);
    cp.setSize(300, 300);

    frame = new Frame();
    frame.setUrl(
        "https://chart.googleapis.com/chart?cht=p3&chs=350x200&chd=t:70,30,10&&chl=Hollie|Emerson|Christinal");
    frame.setLayoutData(new FitLayout());
    cp.setLayout(new FitLayout());
    cp.add(frame);

    w.add(cp);

    cp = new ContentPanel();
    cp.setHeading("Average sms per day last two weeks");
    cp.setFrame(false);
    cp.setSize(300, 300);

    frame = new Frame();
    frame.setUrl(
        "https://chart.googleapis.com/chart?cht=lc&chs=350x200&chd=t:25,50,70,90,25,44,56,34,23,56,0,0,34,5,5,103,3,2,6,13&&chl=1|2|3|4|5|6|7|8|9|10|11|12|13|14&chxt=x,y");
    frame.setLayoutData(new FitLayout());
    cp.setLayout(new FitLayout());
    cp.add(frame);

    w.add(cp);

    return w;
  }
コード例 #2
0
ファイル: SearchFormPanel.java プロジェクト: ctomc/cms
  public SearchFormPanel() {

    ListStore<BeanModel> comboStore = new ListStore<BeanModel>();
    combo = new ComboBox<BeanModel>();
    combo.setStore(comboStore);
    combo.setFieldLabel("Asset type");
    combo.setDisplayField("name");
    combo.setTypeAhead(true);
    combo.setForceSelection(true);
    combo.setTriggerAction(ComboBox.TriggerAction.ALL);
    // combo.setWidth(150);
    combo.addSelectionChangedListener(
        new SelectionChangedListener<BeanModel>() {
          public void selectionChanged(SelectionChangedEvent<BeanModel> se) {
            prepareForm((MetaAsset) combo.getValue().getBean());
          }
        });

    Button btnSearch = new Button("Search");
    btnSearch.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent be) {
            submitSearch();
          }
        });

    form = new FormPanel();
    form.setHeaderVisible(false);
    form.setBodyBorder(false);
    form.setScrollMode(Style.Scroll.AUTOY);
    // form.setWidth(300);

    HBoxLayout layout = new HBoxLayout();
    layout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
    ContentPanel topPanel = new ContentPanel(layout);
    topPanel.setHeaderVisible(false);
    topPanel.setFrame(true);
    topPanel.setHeight(40);
    topPanel.add(new Text("Asset type: "));
    HBoxLayoutData layoutData = new HBoxLayoutData(0, 2, 0, 2);
    topPanel.add(combo, layoutData);
    topPanel.add(btnSearch);

    setHeading("Advanced search");
    setLayout(new FitLayout());
    setFrame(true);
    setTopComponent(topPanel);
    add(form);

    /*
    addListener(Events.Expand, new Listener<BaseEvent>() {
    	public void handleEvent(BaseEvent be) {
    		initComponents(false);
    	}
    });*/
    initComponents(false);
  }
コード例 #3
0
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    ContentPanel inforPanel = new ContentPanel();
    //		 inforPanel.setHeading(this.getCurState().getAuction().getString(IAuction.AUCTION_NAME));
    HorizontalPanel infoContent = new HorizontalPanel();
    infoContent.setSpacing(20);
    Label sk = new Label("拍卖活动名称:");
    Label sv = new Label(this.getCurState().getAuction().getString(IAuction.AUCTION_NAME));
    Label ek = new Label("拍卖商品名称:");
    Label ev = new Label(this.getCurState().getAuction().getString(IAuction.GOOD_NAME));
    infoContent.add(sk);
    infoContent.add(sv);
    infoContent.add(ek);
    infoContent.add(ev);
    inforPanel.add(infoContent);

    BasePagingLoader loader = new PagingListService().getLoader(ModelNames.AUCTIONLOG);
    loader.load(0, 10);
    store = new ListStore<BeanObject>(loader);
    toolBar = new PagingToolBar(10);
    toolBar.bind(loader);

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    final CheckBoxSelectionModel<BeanObject> smRowSelection =
        new CheckBoxSelectionModel<BeanObject>();
    columns.add(smRowSelection.getColumn());
    columns.add(new ColumnConfig(IAuctionLog.BID_USER, "买家", 150));
    columns.add(new ColumnConfig(IAuctionLog.BID_PRICE, "出价", 150));
    columns.add(new ColumnConfig(IAuctionLog.BID_TIME, "时间", 150));
    columns.add(new ColumnConfig(IAuctionLog.LOG_ID, "状态", 150));

    ColumnModel cm = new ColumnModel(columns);
    grid = new Grid<BeanObject>(store, cm);

    //        grid.setLoadMask(true);
    //        grid.setBorders(true);
    grid.setSelectionModel(smRowSelection);
    grid.addPlugin(smRowSelection);
    grid.setHeight(250);

    ContentPanel contentPanel = new ContentPanel();
    contentPanel.setFrame(true);
    contentPanel.setCollapsible(true);
    contentPanel.setAnimCollapse(false);
    contentPanel.setButtonAlign(HorizontalAlignment.CENTER);
    contentPanel.setIconStyle("icon-table");
    contentPanel.setLayout(new FitLayout());
    contentPanel.add(grid);
    contentPanel.setBottomComponent(toolBar);

    topPanel.add(inforPanel);
    topPanel.add(contentPanel);
    add(topPanel);
  }
コード例 #4
0
  /** This widget can be used to display the actions that are considered relevant */
  public WidgetSpecialActions() {
    Listener<ComponentEvent> l =
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent ce) {
            DataList l = (DataList) ce.component;
            ServiceVisualizerManager.displayService(l.getSelectedItem().getId());
          }
        };
    ContentPanel frame = new ContentPanel();
    frame.setFrame(true);
    frame.setCollapsible(true);
    frame.setAnimCollapse(false);
    frame.setHeading("Interesting actions");

    final DataList list = new DataList();
    list.setFlatStyle(true);

    list.addListener(Events.SelectionChange, l);

    DataListItem item = new DataListItem();
    item.setText("Get Twitter followers");
    item.setId("http://soa4all.eu/twitter/getFollowers");
    list.add(item);

    item = new DataListItem();
    item.setText("Watson Search");
    item.setId("http://soa4all.eu/watson/search");
    list.add(item);

    item = new DataListItem();
    item.setText("BT Scenario 1");
    item.setStyleAttribute("color", "#00FF00");
    item.setId("http://soa4all.eu/composed/BTscenario1");
    list.add(item);

    item = new DataListItem();
    item.setText("Get Twitter Follower (Semantic)");
    item.setId("http://soa4all.eu/twitter/getFollowersSemantic");
    list.add(item);

    item = new DataListItem();
    item.setText("Profile Details (Fake Service)");
    item.setId("http://soa4all.eu/twitter/getProfileDetails");
    list.add(item);

    frame.setLayout(new FitLayout());
    frame.add(list);

    initWidget(frame);
  }
コード例 #5
0
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    ContentPanel cp = new ContentPanel();
    cp.setHeading("Charts Gallery");
    cp.setFrame(true);
    cp.setSize(700, 350);
    cp.setLayout(new BorderLayout());

    BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 370);

    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0, 5, 0, 0));

    cp.add(getChart(), centerData);
    cp.add(getDetails(), eastData);

    add(cp, new MarginData(20));
  }
コード例 #6
0
  // RefRecordInfoDialog
  private void buildRefRecordInfoDialog() {

    if (refRecordInfoDialog != null) {
      return;
    }
    refRecordInfoDialog = new Dialog();
    refRecordInfoDialog.setBodyBorder(false);
    refRecordInfoDialog.setWidth(940);
    refRecordInfoDialog.setHeight(540);
    refRecordInfoDialog.setIcon(IconHelper.create("images/information.png"));
    refRecordInfoDialog.setHeading("Reference Record Information");
    refRecordInfoDialog.setButtons(Dialog.OK);
    refRecordInfoDialog.setModal(true);
    refRecordInfoDialog
        .getButtonById(Dialog.OK)
        .addSelectionListener(
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {

                // refPersonInfoDialog.hide();
                refRecordInfoDialog.close();
              }
            });

    ContentPanel cp = new ContentPanel();
    cp.setFrame(false);
    cp.setLayout(new BorderLayout());
    cp.setSize(930, 500);

    formButtonContainer = new LayoutContainer();
    formButtonContainer.setScrollMode(Scroll.AUTOY);

    TableLayout identlayout = new TableLayout(2);
    identlayout.setWidth("100%");
    identlayout.setCellSpacing(5);
    identlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    FormLayout toplayout = new FormLayout();

    TableLayout formlayout = new TableLayout(2);
    formlayout.setWidth("930"); // "100%"
    formlayout.setCellSpacing(5);
    formlayout.setCellVerticalAlign(VerticalAlignment.TOP);

    identifierContainer = new LayoutContainer();
    ;
    identifierContainer.setLayout(identlayout);
    FormPanel identifierPanel = setupForm("", 150, 854);
    identifierPanel.add(setupIdentifierfieldSet(865, 1));
    identifierContainer.add(identifierPanel);

    topContainer = new LayoutContainer();
    ;
    topContainer.setLayout(toplayout);
    topFormPanel = setupForm("", 150, 400);
    topFormPanel.setStyleAttribute("padding-left", "15px");

    formContainer = new LayoutContainer();
    formContainer.setLayout(formlayout);
    leftFormPanel = setupForm("", 150, 400);
    rightFormPanel = setupForm("", 150, 400);

    if (currentEntity != null) {

      if (currentEntity.getAttributes() != null) {

        // Groups
        List<EntityAttributeGroupWeb> sortedAttributeGroups = null;
        if (currentEntity.getEntityAttributeGroups() != null) {
          sortedAttributeGroups =
              new ArrayList<EntityAttributeGroupWeb>(
                  currentEntity.getEntityAttributeGroups().size());
          for (EntityAttributeGroupWeb entityGroup : currentEntity.getEntityAttributeGroups()) {
            // Info.display("Entity Group:", entityGroup.getName()+ ";
            // "+entityGroup.getDisplayOrder());
            sortedAttributeGroups.add(entityGroup);
          }
          Collections.sort(sortedAttributeGroups, GROUP_DISPLAY_ORDER);
        }

        // Attributes
        List<EntityAttributeWeb> sortedEntityAttributes =
            new ArrayList<EntityAttributeWeb>(currentEntity.getAttributes().size());
        if (currentEntity.getAttributes() != null) {
          for (EntityAttributeWeb entityAttribute : currentEntity.getAttributes()) {
            sortedEntityAttributes.add(entityAttribute);
          }
          // sort by display order
          Collections.sort(sortedEntityAttributes, ATTRIBUTE_DISPLAY_ORDER);
        }

        attributeFieldMap = new HashMap<String, Field<?>>();

        // Attributes with no group
        for (EntityAttributeWeb entityAttribute : sortedEntityAttributes) {
          // Info.display("Attribute:", entityAttribute.getName()
          // +"; "+entityAttribute.getDatatype().getDataTypeCd());

          if (entityAttribute.getEntityAttributeGroup() == null) {
            Field<?> field = createField(entityAttribute, true, false);
            if (field != null) {
              attributeFieldMap.put(entityAttribute.getName(), field);
              topFormPanel.add(field);
            }
          }
        }

        // Attributes with group
        if (sortedAttributeGroups != null) {
          boolean leftForm = true;
          for (EntityAttributeGroupWeb attributeGroup : sortedAttributeGroups) {

            FieldSet groupfieldSet =
                createGroupFields(attributeFieldMap, attributeGroup, sortedEntityAttributes, false);

            if (groupfieldSet != null) {
              if (leftForm) {
                leftFormPanel.add(groupfieldSet);
                leftForm = false;
              } else {
                rightFormPanel.add(groupfieldSet);
                leftForm = true;
              }
            }
          }
        }
      }
    }

    topContainer.add(topFormPanel);
    formContainer.add(leftFormPanel);
    formContainer.add(rightFormPanel);

    formButtonContainer.add(identifierContainer);
    formButtonContainer.add(topContainer);
    formButtonContainer.add(formContainer);

    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
    data.setMargins(new Margins(4, 2, 4, 2));

    cp.add(formButtonContainer, data);

    refRecordInfoDialog.add(cp);
  }
コード例 #7
0
  private void initUI() {
    long time = new java.util.Date().getTime();
    GWT.log("Initializing the UI ", null);

    container = new LayoutContainer();
    container.setLayout(new CenterLayout());

    // Rpc Proxy setup
    pagingToolBar = setupRpcProxy();

    // Audit event grid setup
    grid = setupGrid();

    // Panel
    ContentPanel cp = new ContentPanel();
    cp.setHeading("Entity Event Viewer");
    cp.setFrame(true);
    cp.setIcon(IconHelper.create("images/search_icon_16x16.png"));
    cp.setLayout(new FormLayout());
    cp.setSize(1100, 630);

    // Search Container
    ContentPanel searchContainer = new ContentPanel();
    searchContainer.setHeaderVisible(false);
    FormLayout searchFormLayout = new FormLayout();
    searchFormLayout.setLabelWidth(130);
    searchFormLayout.setDefaultWidth(770);

    searchContainer.setLayout(searchFormLayout);

    selectedEvenyTypes = new TextField<String>();
    selectedEvenyTypes.setFieldLabel("Selected Event Types");
    selectedEvenyTypes.setReadOnly(true);

    evenyTypes = new ListView<AuditEventTypeWeb>();
    evenyTypes.setDisplayProperty("auditEventTypeName");
    evenyTypes.setWidth(220);
    evenyTypes.setHeight(110);
    evenyTypes.setStore(eventTypesStore);
    evenyTypes
        .getSelectionModel()
        .addListener(
            Events.SelectionChange,
            new Listener<SelectionChangedEvent<AuditEventTypeWeb>>() {

              public void handleEvent(SelectionChangedEvent<AuditEventTypeWeb> be) {
                List<AuditEventTypeWeb> selections = be.getSelection();
                String selectedTypes = "";
                for (AuditEventTypeWeb type : selections) {
                  if (selectedTypes.isEmpty()) {
                    selectedTypes = type.getAuditEventTypeName();
                  } else {
                    selectedTypes = selectedTypes + ", " + type.getAuditEventTypeName();
                  }
                }
                selectedEvenyTypes.setValue(selectedTypes);

                if (selectedTypes.isEmpty()) {
                  searchButton.disable();
                } else {
                  searchButton.enable();
                }
              }
            });

    DateTimePropertyEditor dateFormat = new DateTimePropertyEditor("yyyy-MM-dd HH:mm");
    startDate = new DateField();
    startDate.setFieldLabel("Start Date Time");
    startDate.setToolTip("yyyy-MM-dd HH:mm");
    startDate.setPropertyEditor(dateFormat);

    endDate = new DateField();
    endDate.setFieldLabel("End Date Time");
    endDate.setToolTip("yyyy-MM-dd HH:mm");
    endDate.setPropertyEditor(dateFormat);

    LayoutContainer main = new LayoutContainer();
    main.setLayout(new ColumnLayout());

    LayoutContainer left = new LayoutContainer();
    left.setStyleAttribute("paddingRight", "10px");
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    // layout.setLabelAlign(LabelAlign.TOP);
    left.setLayout(layout);
    left.add(startDate);

    LayoutContainer right = new LayoutContainer();
    right.setStyleAttribute("paddingLeft", "10px");
    layout = new FormLayout();
    // layout.setLabelAlign(LabelAlign.TOP);
    layout.setLabelWidth(130);
    layout.setDefaultWidth(220);
    right.setLayout(layout);
    right.add(endDate);

    main.add(left, new ColumnData(.5));
    main.add(right, new ColumnData(.5));

    HBoxLayoutData dataSelectedTypes = new HBoxLayoutData(new Margins(5, 0, 0, 0));
    searchContainer.add(selectedEvenyTypes, dataSelectedTypes);
    HBoxLayoutData dataTypes = new HBoxLayoutData(new Margins(5, 0, 5, 135));
    searchContainer.add(evenyTypes, dataTypes);

    searchContainer.add(main);
    HBoxLayoutData dataButtons = new HBoxLayoutData(new Margins(0, 0, 5, 0));
    searchContainer.add(setupButtonPanel(3), dataButtons);

    cp.add(searchContainer);
    cp.add(grid);
    cp.setBottomComponent(pagingToolBar);

    container.add(cp);

    LayoutContainer wrapper = (LayoutContainer) Registry.get(Constants.CENTER_PANEL);
    wrapper.removeAll();
    wrapper.add(container);
    wrapper.layout();
    GWT.log("Done Initializing the UI in " + (new java.util.Date().getTime() - time), null);
  }
コード例 #8
0
  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);
  }
コード例 #9
0
  @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);
  }
コード例 #10
0
  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    setLayout(new FlowLayout(10));

    Folder model = TestData.getTreeModel();

    TreeStore<ModelData> store = new TreeStore<ModelData>();

    store.add(model.getChildren(), true);

    ColumnConfig name = new ColumnConfig("name", "Name", 100);
    name.setRenderer(new TreeGridCellRenderer<ModelData>());

    ColumnConfig date = new ColumnConfig("author", "Author", 100);

    ColumnConfig size = new ColumnConfig("genre", "Genre", 100);

    ColumnModel cm = new ColumnModel(Arrays.asList(name, date, size));

    ContentPanel cp = new ContentPanel();
    cp.setBodyBorder(false);
    cp.setHeading("TreeGrid");
    cp.setButtonAlign(HorizontalAlignment.CENTER);
    cp.setLayout(new FitLayout());
    cp.setFrame(true);
    cp.setSize(600, 300);

    TreeGrid<ModelData> tree = new TreeGrid<ModelData>(store, cm);
    tree.setBorders(true);
    tree.getStyle().setLeafIcon(Resources.ICONS.music());
    tree.setAutoExpandColumn("name");
    tree.setTrackMouseOver(false);

    cp.add(tree);

    add(cp);

    StoreFilterField<ModelData> filter =
        new StoreFilterField<ModelData>() {

          @Override
          protected boolean doSelect(
              Store<ModelData> store,
              ModelData parent,
              ModelData record,
              String property,
              String filter) {
            // only match leaf nodes
            if (record instanceof Folder) {
              return false;
            }
            String name = record.get("name");
            name = name.toLowerCase();
            if (name.startsWith(filter.toLowerCase())) {
              return true;
            }
            return false;
          }
        };
    filter.bind(store);

    ToolBar toolBar = new ToolBar();
    toolBar.setBorders(true);
    toolBar.add(new LabelToolItem("Filter:"));
    toolBar.add(filter);

    cp.setTopComponent(toolBar);
  }
コード例 #11
0
  @Override
  protected void onRender(Element parent, int index) {

    super.onRender(parent, index);

    setLayout(new CenterLayout());

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    configs.add(sm.getColumn());

    ColumnConfig column = new ColumnConfig();
    column.setId("ragioneSociale");
    column.setHeader("Ragione Sociale");
    column.setWidth(120);

    TextField<String> text = new TextField<String>();
    // text.setAllowBlank(false);
    column.setEditor(new CellEditor(text));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("cognome");
    column.setHeader("Cognome");
    column.setWidth(120);

    text = new TextField<String>();
    // text.setAllowBlank(false);
    column.setEditor(new CellEditor(text));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("nome");
    column.setHeader("Nome");
    column.setWidth(120);

    text = new TextField<String>();
    // text.setAllowBlank(false);
    column.setEditor(new CellEditor(text));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("cf");
    column.setHeader("Codice Fiscale");
    column.setWidth(120);

    text = new TextField<String>();
    // text.setAllowBlank(false);
    column.setEditor(new CellEditor(text));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("piva");
    column.setHeader("Partita IVA");
    column.setWidth(120);

    text = new TextField<String>();
    text.setAllowBlank(false);
    column.setEditor(new CellEditor(text));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("denominazione");
    column.setHeader("Denominazione");
    column.setWidth(120);

    text = new TextField<String>();
    text.setAllowBlank(false);
    column.setEditor(new CellEditor(text));
    configs.add(column);

    caricaDati();

    ColumnModel cm = new ColumnModel(configs);

    ContentPanel cp = new ContentPanel();
    cp.setHeading("Anagrafica aziende");
    cp.setFrame(true);
    // cp.setIcon(Resources.ICONS.table());
    cp.setSize(Consts.LarghezzaFinestra, Consts.AltezzaFinestra);
    cp.setLayout(new FitLayout());

    final EditorGrid<BeanModel> grid = new EditorGrid<BeanModel>(store, cm);
    grid.setSelectionModel(sm);
    grid.setAutoExpandColumn("nome");
    grid.setBorders(true);
    grid.setClicksToEdit(EditorGrid.ClicksToEdit.TWO);
    cp.add(grid);

    ToolBar toolBar = new ToolBar();
    Button addButton = new Button("Aggiungi azienda");
    addButton.setIcon(
        IconHelper.create(
            "/resources/grafica/x16/add2.png", Consts.ICON_WIDTH_SMALL, Consts.ICON_HEIGHT_SMALL));
    addButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            BeanModelFactory factory = BeanModelLookup.get().getFactory(Azienda.class);
            Azienda azienda =
                new Azienda(
                    "NuovoNome",
                    "NuovoCognome",
                    "nuovaRS",
                    "nuovoCF",
                    "nuovaPIVA",
                    "NuovaDenominazione");
            BeanModel model = factory.createModel(azienda);

            grid.stopEditing();
            aziende.add(azienda);
            store.insert(model, 0);
            grid.startEditing(store.indexOf(model), 0);
          }
        });
    toolBar.add(addButton);
    toolBar.add(new SeparatorToolItem());

    Button remove = new Button("Rimuovi selezionati");
    remove.setIcon(
        IconHelper.create(
            "/resources/grafica/x16/delete2.png",
            Consts.ICON_WIDTH_SMALL,
            Consts.ICON_HEIGHT_SMALL));
    remove.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            if (!(sm.getSelectedItems()).isEmpty()) {
              MessageBox.confirm(
                  "Confirm",
                  "Sei sicuro di voler eliminare gli elemtni selezionati?",
                  cancellazione);
            } else {
              MessageBox.alert("Errore", "Selezionare uno o più elementi", cancellazione);
            }
          }
          // conferma per l'eliminazione
          final Listener<MessageBoxEvent> cancellazione =
              new Listener<MessageBoxEvent>() {

                @Override
                public void handleEvent(MessageBoxEvent ce) {
                  Button btn = ce.getButtonClicked();
                  if (btn.getText().equals("Yes")) {
                    List<BeanModel> modelsDaRimuovere = sm.getSelectedItems();
                    ArrayList<Azienda> aziendeDaRimuovere = new ArrayList();
                    if (modelsDaRimuovere != null) {
                      Iterator it = modelsDaRimuovere.iterator();
                      while (it.hasNext()) {
                        Object model = it.next();
                        store.remove((BeanModel) model);
                        Azienda azienda = ((BeanModel) model).getBean();
                        aziendeDaRimuovere.add(azienda);
                        aziende.remove(azienda);
                      }
                      cancellaDati(aziendeDaRimuovere);
                    }
                  }
                }
              };
        });
    toolBar.add(remove);
    cp.setTopComponent(toolBar);

    ToolBar statusBar = new ToolBar();
    status.setWidth(350);
    statusBar.add(status);
    cp.setBottomComponent(statusBar);
    cp.setButtonAlign(HorizontalAlignment.CENTER);

    Button resetButton =
        new Button(
            "Reset",
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                store.rejectChanges();
              }
            });
    resetButton.setIcon(
        IconHelper.create(
            "/resources/grafica/x16/undo.png", Consts.ICON_WIDTH_SMALL, Consts.ICON_HEIGHT_SMALL));
    cp.addButton(resetButton);

    Button saveButton =
        new Button(
            "Save",
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                store.commitChanges();
                salvaDati(aziende);
              }
            });
    saveButton.setIcon(
        IconHelper.create(
            "/resources/grafica/x16/save.png", Consts.ICON_WIDTH_SMALL, Consts.ICON_HEIGHT_SMALL));
    cp.addButton(saveButton);

    add(cp);
  }
コード例 #12
0
  public PanelGridContrato() {

    setCollapsible(true);
    setResizable(false);
    setMinimizable(true);
    setHeadingHtml("Contratos");
    setSize(700, 459);
    setLayout(new FitLayout());

    mainPanel = new ContentPanel();
    mainPanel.setFrame(true);
    mainPanel.setHeaderVisible(false);
    mainPanel.setLayout(new RowLayout(Orientation.VERTICAL));

    panelTool = new ContentPanel();
    panelTool.setHeaderVisible(false);
    panelTool.setFrame(true);
    panelTool.setCollapsible(true);
    panelTool.setLayout(new AbsoluteLayout());

    btnRelatrio = new Button("Relatório");
    btnRelatrio.setSize("44px", "44px");
    btnRelatrio.setIconAlign(IconAlign.TOP);
    btnRelatrio.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.report24()));
    //		btnRelatrio.setEnabled(false);
    btnRelatrio.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            ParametrosReport parametros = new ParametrosReport();
            parametros.setNomeRelatorio(JasperName.CONTRATO);
            parametros.setContratoId(getSelecaoGrid().getId());

            InstanceService.RELATORIO_SERVICE.relatorio(parametros, new RelatorioCallback());
          }
        });

    panelTool.add(btnRelatrio, new AbsoluteData(606, 6));

    btnEditar = new Button("Editar");
    btnEditar.setSize("44px", "44px");
    btnEditar.setIconAlign(IconAlign.TOP);
    btnEditar.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconEditar24()));
    btnEditar.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {

            DTOContrato contrato = getSelecaoGrid();

            if (contrato != null) {
              FormContrato formContrato = ProviderFacadeManager.formContrato.createInstance();
              formContrato.setModal(true);
              formContrato.loadDTOContrato(contrato);
              formContrato.show();
            } else {
              WebMessageBox.alert("Selecione o contrato para editar!");
            }
          }
        });
    panelTool.add(btnEditar, new AbsoluteData(556, 6));

    btnNovo = new Button("Novo");
    btnNovo.setSize("44px", "44px");
    btnNovo.setIconAlign(IconAlign.TOP);
    btnNovo.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconAdicionar24()));
    btnNovo.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            FormContrato formContrato = ProviderFacadeManager.formContrato.createInstance();
            formContrato.setModal(true);
            formContrato.show();
          }
        });
    panelTool.add(btnNovo, new AbsoluteData(506, 6));

    panelTool.add(new LabelField("Cliente:"), new AbsoluteData(6, 6));

    RpcProxy<PagingLoadResult<DTOCliente>> proxyCliente =
        new RpcProxy<PagingLoadResult<DTOCliente>>() {
          @Override
          public void load(
              Object loadConfig, AsyncCallback<PagingLoadResult<DTOCliente>> callback) {
            InstanceService.CLIENTE_SERVICE.loadPagingList((PagingLoadConfig) loadConfig, callback);
          }
        };

    PagingLoader<PagingLoadResult<ModelData>> loaderCliente =
        new BasePagingLoader<PagingLoadResult<ModelData>>(proxyCliente);

    storeCliente = new ListStore<DTOCliente>(loaderCliente);

    comboCliente = new ComboBox<DTOCliente>();
    comboCliente.setStore(storeCliente);
    comboCliente.setSize("286px", "22px");
    comboCliente.setTemplate(getTemplateNome());
    comboCliente.setValueField("id");
    comboCliente.setDisplayField("nome");
    comboCliente.setItemSelector("div.search-item");
    comboCliente.setHideTrigger(true);
    comboCliente.setLoadingText("Carregando...");
    comboCliente.setPageSize(10);
    comboCliente.addListener(
        Events.OnBlur,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent evt) {
            if (comboCliente.getValue() == null) {
              comboCliente.clear();
            }
          };
        });

    panelTool.add(comboCliente, new AbsoluteData(6, 28));

    tfData = new DateField();
    tfData.setSize("119px", "22px");
    tfData.setEditable(false);
    tfData.setValue(new Date());
    tfData
        .getDatePicker()
        .addListener(
            Events.Select,
            new Listener<DatePickerEvent>() {
              @Override
              public void handleEvent(DatePickerEvent be) {
                loadContratos();
              }
            });
    tfData.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
    panelTool.add(tfData, new AbsoluteData(298, 28));

    btnPesquisa = new Button();
    btnPesquisa.setSize("44px", "44px");
    btnPesquisa.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconPesquisa24()));
    btnPesquisa.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            pesquisa();
          }
        });
    panelTool.add(btnPesquisa, new AbsoluteData(423, 6));

    panelTool.add(new LabelField("Data:"), new AbsoluteData(300, 6));
    mainPanel.add(panelTool, new RowData(Style.DEFAULT, 75.0, new Margins(3)));

    storeContratos = new ListStore<DTOContrato>();

    gridContratos = new Grid<DTOContrato>(storeContratos, getColumnModel());
    gridContratos.setBorders(true);
    gridContratos.setAutoExpandColumn("nomeCliente");

    mainPanel.add(gridContratos, new RowData(Style.DEFAULT, 340.0, new Margins(3)));

    add(mainPanel);

    loadContratos();
  }
コード例 #13
0
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    criteria.addCondition(new Condition(IGoods.DELETED, Condition.EQUALS, "true"));
    BasePagingLoader loader = new PagingListService().getLoader(ModelNames.GOODS, criteria);
    loader.load(0, 10);
    final ListStore<BeanObject> store = new ListStore<BeanObject>(loader);

    toolBar = new PagingToolBar(10);
    toolBar.bind(loader);

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    final CheckBoxSelectionModel<BeanObject> smRowSelection =
        new CheckBoxSelectionModel<BeanObject>();
    columns.add(smRowSelection.getColumn());
    columns.add(new ColumnConfig(IGoods.ID, "ID", 50));
    ColumnConfig col = new ColumnConfig(IGoods.NAME, Resources.constants.Goods_name(), 100);
    columns.add(col);
    col = new ColumnConfig(IGoods.SN, Resources.constants.Goods_SN(), 100);
    columns.add(col);

    col = new ColumnConfig(IGoods.SHOPPRICE, Resources.constants.Goods_shopPrice(), 80);
    col.setAlignment(HorizontalAlignment.RIGHT);
    col.setNumberFormat(NumberFormat.getCurrencyFormat());
    columns.add(col);

    ColumnConfig actcol = new ColumnConfig("Action", Resources.constants.GoodsList_action(), 100);
    //		columns.add(actcol);

    ColumnModel cm = new ColumnModel(columns);

    Grid<BeanObject> grid = new EditorGrid<BeanObject>(store, cm);
    grid.setLoadMask(true);
    grid.setBorders(true);
    grid.setSelectionModel(smRowSelection);
    //      grid.setAutoExpandColumn("forum");

    ActionCellRenderer render = new ActionCellRenderer(grid);
    ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_edit.gif");
    act.setAction("editGoods($id)");
    act.setTooltip(Resources.constants.GoodsList_action_edit());
    render.addAction(act);
    act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_trash.gif");
    act.setAction("deleteGoods($id)");
    act.setTooltip(Resources.constants.GoodsList_action_delete());
    render.addAction(act);

    actcol.setRenderer(render);

    HorizontalPanel header = new HorizontalPanel();
    header.add(Resources.images.icon_search().createImage());
    header.add(new Label("  " + Resources.constants.GoodsList_keyword()));
    header.add(txtKeyword);
    header.add(btnFind);
    add(header);

    btnFind.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent ce) {
            search();
          }
        });

    ContentPanel panel = new ContentPanel();
    panel.setFrame(true);
    panel.setCollapsible(true);
    panel.setAnimCollapse(false);
    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.setIconStyle("icon-table");
    //        panel.setHeading("Paging Grid");
    panel.setLayout(new FitLayout());
    panel.add(grid);
    panel.setSize(880, 350);
    panel.setBottomComponent(toolBar);

    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.addButton(
        new Button(
            "彻底删除",
            new SelectionListener<ButtonEvent>() {
              public void componentSelected(ButtonEvent ce) {
                List<BeanObject> items = smRowSelection.getSelectedItems();
                purgeGoods(items);
              }
            }));

    panel.addButton(
        new Button(
            "恢复",
            new SelectionListener<ButtonEvent>() {
              public void componentSelected(ButtonEvent ce) {
                List<BeanObject> items = smRowSelection.getSelectedItems();
                restoreGoods(items);
              }
            }));

    add(panel);
  }
コード例 #14
0
  /** 初始化界面。 */
  public MagazineManager() {
    curState = new State();

    BasePagingLoader loader = new PagingListService().getLoader(ModelNames.MAILTEMPLATE, criteria);
    loader.load(0, 10);
    store = new ListStore<BeanObject>(loader);
    toolBar = new PagingToolBar(10);
    toolBar.bind(loader);

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    ColumnConfig title = new ColumnConfig(IMailTemplate.SUBJECT, "杂志标题", 200);
    columns.add(title);
    columns.add(new ColumnConfig(IMailTemplate.LASTMODIFY, "杂志上次编辑时间", 160));
    columns.add(new ColumnConfig(IMailTemplate.LASTSEND, "杂志上次发送时间", 160));
    ColumnConfig insert = new ColumnConfig("insert", "插入发送队列", 160);
    columns.add(insert);
    ColumnConfig actcol = new ColumnConfig("Action", "操作", 100);
    columns.add(actcol);
    ColumnModel cm = new ColumnModel(columns);

    grid = new Grid<BeanObject>(store, cm);
    grid.setLoadMask(true);
    grid.setBorders(true);

    ActionCellRenderer render = new ActionCellRenderer(grid);
    ActionCellRenderer insertRender = new ActionCellRenderer(grid);
    ActionCellRenderer.ActionInfo act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_edit.gif");
    act.setAction("editMagazine($id)");
    act.setTooltip("编辑");
    render.addAction(act);
    act = new ActionCellRenderer.ActionInfo();
    act.setImage("icon_trash.gif");
    act.setAction("deleteMagazine($id)");
    act.setTooltip("删除");
    render.addAction(act);
    act = new ActionCellRenderer.ActionInfo();
    act.setText("插入队列");
    act.setAction("insertMagazine($id)");
    act.setTooltip("插入队列");
    insertRender.addAction(act);

    actcol.setRenderer(render);
    insert.setRenderer(insertRender);

    ContentPanel panel = new ContentPanel();
    panel.setFrame(true);
    panel.setCollapsible(true);
    panel.setAnimCollapse(false);
    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.setIconStyle("icon-table");
    panel.setLayout(new FitLayout());
    panel.add(grid);
    panel.setSize(850, 350);
    panel.setBottomComponent(toolBar);
    panel.setHeading("邮件杂志列表");
    panel.setButtonAlign(HorizontalAlignment.LEFT);

    // 添加新杂志
    final com.extjs.gxt.ui.client.widget.button.Button addMagazine =
        new com.extjs.gxt.ui.client.widget.button.Button("添加新杂志");
    addMagazine.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          public void componentSelected(ButtonEvent ce) {
            // add new magazine function
            NewMagazine.State state = new NewMagazine.State();
            state.execute();
          }
        });
    panel.addButton(addMagazine);

    add(panel);
    initJS(this);
  }