Package welcome.shared.store

Examples of welcome.shared.store.Article


        Label amountLabel;
        IntegerBox amountTB;
        Button orderBt;

        Iterator<Article> it = result.iterator();
        Article currentArticle;

        // construct a new Grid with correct size (we can t add a row
        // dynamically...

        for (int i = 0; it.hasNext(); i++) {

          currentArticle = it.next();
          nameLabel = new Label(currentArticle.getName());
          amountLabel = new Label(String.valueOf(currentArticle
              .getAmount()));

          amountTB = new IntegerBox();
          amountTB.setValue(0);
View Full Code Here


   
   
    //newStore is the distant store for demonstration purpose only ^^
    Store newStore = new Store();
   
    newStore.addArticle(new Article ("computer",10));
    newStore.addArticle(new Article ("macbook",2));
    newStore.addArticle(new Article ("pen",3));
    newStore.addArticle(new Article ("car",5));
   
   
    return newStore;
  }
View Full Code Here

    this.addBt.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {

        if (newNameTB.getText() != null && newAmountTB.getValue() != null) {
          Article article = new Article(newNameTB.getText(), newAmountTB.getValue());

          store.addArticle(article);
//          sendStoreToDataStore();

View Full Code Here

        Iterator<Article> it = result.iterator();

        for (int i = 1; it.hasNext(); i++) {

          final Article currentArticle = it.next();
          final Label nameLabel = new Label(currentArticle.getName());
          amountLabel = new Label(String.valueOf(currentArticle.getAmount()));

          amountTB = new IntegerBox();
          amountTB.setValue(0);
          amountTB.setWidth("20px");
          removeBT = new Button("Remove");
          editBT=new Button("Edit");
          editBT.addClickHandler(new ClickHandler() {
           
            @Override
            public void onClick(ClickEvent event) {
             
              Popup pop = new Popup();
              ArticleEditor articleEditor = new ArticleEditor(currentArticle.getId(), pop);
              pop.setContent(articleEditor);
              pop.center();
             
            }
          });
         
          removeBT.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              removeArticle(currentArticle.getId());

            }

          });

          articleTable.setWidget(i, 0, nameLabel);
          articleTable.setWidget(i, 1, amountLabel);
          articleTable.setWidget(i, 2, amountTB);
          articleTable.setWidget(i, 3, removeBT);
          articleTable.setWidget(i, 4, editBT);
          articleTable.setCellSpacing(4);
        }
      }
    });

    mainPanel.add(articleTable);
    initWidget(mainPanel);
    mainPanel.setSize("558px", "126px");

    this.newArticleCptPanel = new CaptionPanel("Add a new article");
    mainPanel.add(this.newArticleCptPanel);

    this.horizontalPanel = new HorizontalPanel();
    this.newArticleCptPanel.setContentWidget(this.horizontalPanel);
    this.horizontalPanel.setSize("506px", "55px");

    this.newNameLabel = new Label("Article Name :");
    this.horizontalPanel.add(this.newNameLabel);
    this.newNameLabel.setWidth("90px");

    this.newNameTB = new TextBox();
    this.horizontalPanel.add(this.newNameTB);
    this.newNameTB.setSize("109px", "18px");

    this.newAmountLabel = new Label("Amount in stock :");
    this.horizontalPanel.add(this.newAmountLabel);

    this.newAmountTB = new IntegerBox();
    this.horizontalPanel.add(this.newAmountTB);
    this.newAmountTB.setSize("30px", "18px");

    this.addBt = new Button("Add");

    this.addBt.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {

        if (newNameTB.getText() != null && newAmountTB.getValue() != null) {
          Article article = new Article(newNameTB.getText(), newAmountTB.getValue());

          storeService.addArticle(article, new AsyncCallback<Object>() {

            @Override
            public void onFailure(Throwable caught) {
View Full Code Here

  @Override
  public Article getArticle(Long id) throws IllegalArgumentException {
   
    pm = pmfInstance.getPersistenceManager();

    Article art = pm.getObjectById(Article.class, id);
    pm.close();

    return art;
  }
View Full Code Here

  @Override
  public void updateArticle (Long id, String name, Integer amount)throws IllegalArgumentException
  {
    pm = pmfInstance.getPersistenceManager();

    Article art = pm.getObjectById(Article.class, id);
    art.setName(name);
    art.setAmount(amount);
   
    pm.makePersistent(art);
    pm.evictAll();
    pm.close();
  }
View Full Code Here

TOP

Related Classes of welcome.shared.store.Article

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.