Ejemplo n.º 1
0
 protected void assignToCustomer(LegalEntity legalEntity) {
   TradeManagerRemote tm = TradePlugin.getDefault().getTradeManager();
   AnchorID customerID = (AnchorID) JDOHelper.getObjectId(legalEntity);
   OrderID orderID = (OrderID) getArticleContainerEdit().getArticleContainerID();
   try {
     tm.assignCustomer(orderID, customerID, true, null, 1);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Ejemplo n.º 2
0
  protected void createComposite(Composite parent, ArticleContainerID articleContainerID) {
    //		getArticleContainerEdit().setShowHeader(false);
    getArticleContainerEdit().createComposite(parent);
    getArticleContainerEdit().setShowHeader(false);
    XComposite wrapper = new XComposite(parent, SWT.NONE, LayoutDataMode.GRID_DATA_HORIZONTAL);

    buttonComp = new XComposite(wrapper, SWT.NONE);
    buttonComp.setLayout(new GridLayout(8, false));
    buttonComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    deleteAllButton = new Button(buttonComp, SWT.FLAT);
    deleteAllButton.setText(
        Messages.getString(
            "org.nightlabs.jfire.trade.quicksale.ui.ArticleContainerQuickSaleEditorPage.deleteAllButton.text")); //$NON-NLS-1$
    deleteAllButton.setImage(SharedImages.DELETE_16x16.createImage());
    deleteAllButton.addSelectionListener(deleteAllListener);

    deleteSelectionButton = new Button(buttonComp, SWT.FLAT);
    deleteSelectionButton.setText(
        Messages.getString(
            "org.nightlabs.jfire.trade.quicksale.ui.ArticleContainerQuickSaleEditorPage.button.deleteSelection.text")); //$NON-NLS-1$
    deleteSelectionButton.setImage(SharedImages.DELETE_16x16.createImage());
    deleteSelectionButton.addSelectionListener(deleteSelectionListener);
    deleteSelectionButton.setEnabled(false);

    // need to add listeners for activeSegmentEdit by this listener, because at this time
    // activeSegementEdit is null
    getArticleContainerEdit()
        .addActiveSegmentEditSelectionListener(
            new ActiveSegmentEditSelectionListener() {
              @Override
              public void selected(ActiveSegmentEditSelectionEvent event) {
                // add listener to check for articleSelection to set enable state for
                // deleteSelectionButton
                event
                    .getActiveSegmentEdit()
                    .addSegmentEditArticleSelectionListener(segmentEditArticleSelectionListener);
              }
            });

    Label spacerLabel = new Label(buttonComp, SWT.NONE);
    spacerLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label customerSearchLabel = new Label(buttonComp, SWT.NONE);
    customerSearchLabel.setText(
        Messages.getString(
            "org.nightlabs.jfire.trade.quicksale.ui.ArticleContainerQuickSaleEditorPage.customerSearchLabel.text")); //$NON-NLS-1$
    customerSearchText = new Text(buttonComp, wrapper.getBorderStyle());
    GridData textData = new GridData();
    textData.widthHint = 100;
    textData.heightHint = 15;
    textData.minimumWidth = 100;
    customerSearchText.setLayoutData(textData);
    customerSearchText.addSelectionListener(okListenerCustomer);

    okButtonCustomer = new Button(buttonComp, SWT.FLAT);
    okButtonCustomer.setText(
        Messages.getString(
            "org.nightlabs.jfire.trade.quicksale.ui.ArticleContainerQuickSaleEditorPage.okButtonCustomer.text")); //$NON-NLS-1$
    okButtonCustomer.setImage(
        SharedImages.getSharedImage(TradePlugin.getDefault(), LegalEntityEditorView.class));
    okButtonCustomer.addSelectionListener(okListenerCustomer);

    //		Label separator = new Label(buttonComp, SWT.SEPARATOR);

    okButtonAnonymous = new Button(buttonComp, SWT.FLAT);
    okButtonAnonymous.setText(
        Messages.getString(
            "org.nightlabs.jfire.trade.quicksale.ui.ArticleContainerQuickSaleEditorPage.okButtonAnonymous.text")); //$NON-NLS-1$
    okButtonAnonymous.setImage(
        SharedImages.getSharedImage(TradePlugin.getDefault(), SelectAnonymousViewAction.class));
    okButtonAnonymous.addSelectionListener(okListenerAnonymous);

    getArticleContainerEdit().addArticleChangeListener(articleChangeListener);
    getArticleContainerEdit().addArticleCreateListener(articleCreateListener);

    buttonComp.setEnabled(false);
  }