Package info.walnutstreet.vs.ps03.dbserver

Examples of info.walnutstreet.vs.ps03.dbserver.GoodModel


    Spinner numOfGoods = new Spinner(this.shell, SWT.BORDER);
    numOfGoods.setMinimum(1);
   
    Button button = new Button(this.shell, SWT.BORDER);
    button.setText("Edit");
    button.addSelectionListener(new EditNumberOfGoodsSelectionListener(idOfGood, numOfGoods));
   
    button = new Button(this.shell, SWT.BORDER);
    button.setText("Delete");
    button.addSelectionListener(new DeleteGoodSelectionListener(idOfGood));
  }
View Full Code Here


   * @param gridData
   */
  private void createButton(GridData gridData) {
    this.button = new Button(this.shell, SWT.NONE);
    this.button.setText("OK");
    this.button.addSelectionListener(new HideDialogListener(this.shell));
    this.button.setLayoutData(gridData);
  }
View Full Code Here

    this.shell.setText("View Goods - Dialog");
    this.shell.setLayout(gridLayout);
    this.shell.setSize(new Point(363, 226));
   
    this.fillUi();
    this.shell.addShellListener(new HideShellListener(this.shell));
  }
View Full Code Here

   
    this.shell = new Shell();
    this.shell.setText("vs.ps03 Client");
    this.shell.setSize(new Point(800, 500));
    this.shell.setLayout(gridLayout);
    this.shell.addShellListener(new MainWindowShellListener());
  }
View Full Code Here

              item.setText(1, Double.toString(object.getPrice()));
              item.setText(2, Integer.toString(object.getAvailable()));

              Button button = new Button(table, SWT.PUSH);
              button.setText("Details");
              button.addSelectionListener(new ViewGoodDetailsSelectionListener(dialog, object.getId()));

              TableEditor editor = new TableEditor(table);
              editor.grabHorizontal = true;
              editor.setEditor(button, item, 3);
View Full Code Here

  public void testFirstGood() throws RemoteException {
    /*
     * Test invalid use of constructor #1
     */
    try {
      new GoodModel(-1, null);
      assertTrue(false);
    } catch (InvalidUniqueIdException e) {
      assertTrue(true);
    }
   
    /*
     * Test invalid use of constructor #2
     */
    try {
      new GoodModel(0, null);
      assertTrue(false);
    } catch (InvalidUniqueIdException e) {
      assertTrue(true);
    }
   
    /*
     * Test default constructor
     */
    try {
      new GoodModel();
      assertTrue(true);
    } catch (InvalidUniqueIdException e) {
      assertTrue(false);
    }
  }
View Full Code Here

  public void testSecondGood() throws RemoteException {
    /*
     * Test construction of a good object #1
     */
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setId(1);
      goodModel.setName("Article #1");
      goodModel.setAvailable(10);
      goodModel.setDescription("Bla");
      goodModel.setPrice(10.0);
     
      assertTrue(true);
    } catch (InvalidUniqueIdException e) {
      assertTrue(false);
    } catch (InvalidAvaiableNumberException e) {
      assertTrue(false);
    } catch (InvalidPriceException e) {
      assertTrue(false);
    }
   
    /*
     * Test construction of a good object #2
     */
    try {
      GoodModel goodModel = new GoodModel(2, "Article #2");
      goodModel.setAvailable(10);
      goodModel.setDescription("Bla");
      goodModel.setPrice(10.0);
     
      assertTrue(true);
    } catch (InvalidUniqueIdException e) {
      assertTrue(false);
    } catch (InvalidAvaiableNumberException e) {
View Full Code Here

  }
 
  public void testGoodInvalidId() throws RemoteException {
    /* test constructor with invalid id */
    try {
      new GoodModel(0, "Invalid good");
      assertTrue(false);
    } catch (InvalidUniqueIdException e) {
      assertTrue(true);
    }
   
    /* test good with invalid id */
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setId(-3324);
      assertTrue(false);
    } catch (InvalidUniqueIdException e) {
      assertTrue(true);
    }
  }
View Full Code Here

  }
 
  public void testGoodInvalidAvaiableNumber() throws RemoteException {
    /* test invalid number of avaiable goods #1 */
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setAvailable(10);
     
      assertTrue(true);
    } catch (InvalidUniqueIdException e) {
      assertTrue(false);
    } catch (InvalidAvaiableNumberException e) {
      assertTrue(false);
    }
   
    /* test invalid number of avaiable goods #2 */
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setAvailable(0);
     
      assertTrue(true);
    } catch (InvalidUniqueIdException e) {
      assertTrue(false);
    } catch (InvalidAvaiableNumberException e) {
      assertTrue(false);
    }
   
    /* test invalid number of avaiable goods #3 */
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setAvailable(-10);
     
      assertTrue(false);
    } catch (InvalidUniqueIdException e) {
      assertTrue(false);
    } catch (InvalidAvaiableNumberException e) {
View Full Code Here

    }
  }
 
  public void testGoodWithInvalidPrice() throws InvalidUniqueIdException, RemoteException {
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setPrice(10.0);
     
      assertTrue(true);
    } catch (InvalidPriceException e) {
      assertTrue(false);
    }
   
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setPrice(0.0);
     
      assertTrue(true);
    } catch (InvalidPriceException e) {
      assertTrue(false);
    }
   
    try {
      GoodModel goodModel = new GoodModel();
      goodModel.setPrice(-10.0);
     
      assertTrue(false);
    } catch (InvalidPriceException e) {
      assertTrue(true);
    }
View Full Code Here

TOP

Related Classes of info.walnutstreet.vs.ps03.dbserver.GoodModel

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.