コード例 #1
0
  protected void controlsToObject() {
    detail.setTitle(text.toString());
    detail.setEdited(new Date());

    // TODO remove and add patterns

    // TODO remove and add properties

  }
コード例 #2
0
ファイル: MyVaadinUI.java プロジェクト: piyumie24/Application
  private void initLayout() {

    layout.setMargin(true);
    setContent(layout);

    form.setCaption("Employee Details ");
    PropertysetItem item = new PropertysetItem();
    item.addItemProperty("Name", new ObjectProperty<String>(""));
    item.addItemProperty("Address", new ObjectProperty<String>(""));

    ComboBox combobox = new ComboBox("Sex");
    combobox.setInvalidAllowed(true);
    combobox.setNullSelectionAllowed(false);
    combobox.addItem("Male");
    combobox.addItem("Female");
    item.addItemProperty("Age", new ObjectProperty<String>(""));
    item.addItemProperty("Email", new ObjectProperty<String>(""));
    item.addItemProperty("Mobile No", new ObjectProperty<String>(""));

    Form form = new Form();
    final Form reader = new Form();
    form.setCaption("Fill Your Details");
    form.setItemDataSource(item);
    reader.setItemDataSource(item);
    reader.setCaption("Your registation details");
    reader.setReadOnly(true);

    button.addClickListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {

            Label message = new Label("You are Registered");
            layout.addComponent(message);
            layout.addComponent(reader);
          }
        });
    layout.addComponent(form);

    final RichTextArea area = new RichTextArea();
    area.setValue("Add more details here");
    layout.addComponent(area);

    layout.addComponent(button);
  }
コード例 #3
0
  public DetailEditPanel2(NApplication app, Detail d) {
    super();
    this.detail = d;
    this.app = app;

    text = new RichTextArea();
    text.setWidth("100%");
    addComponent(text);

    patternBar = new GridLayout();
    patternBar.setWidth("100%");

    refreshPatternBar();
    refreshProperties();

    addComponent(patternBar);

    patternList.setWidth("100%");
    patternList.setHeight("100%");
    addComponent(patternList);

    HorizontalLayout bottomPanel = new HorizontalLayout();
    {
      Button cancelButton = new Button("Cancel");
      cancelButton.addListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
              cancel();
            }
          });
      bottomPanel.addComponent(cancelButton);

      Button saveButton = new Button("Save");
      saveButton.addListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
              controlsToObject();
              save();
            }
          });
      bottomPanel.addComponent(saveButton);
    }
    bottomPanel.setMargin(true);
    addComponent(bottomPanel);
    setComponentAlignment(bottomPanel, Alignment.TOP_RIGHT);
  }
コード例 #4
0
  @SuppressWarnings("serial")
  private Component buildNewTestrunTextFieldPanel() {
    VerticalLayout layout = new VerticalLayout();

    final RichTextArea textAreaComment = new RichTextArea();
    final TextField textAreaAuthor = new TextField();

    textAreaComment.setCaption("Kommentar");
    textAreaAuthor.setCaption("Autor");

    HorizontalLayout buttonLayout = new HorizontalLayout();

    Button newTestrun = new Button("Neuen Testrun anlegen");
    newTestrun.addListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {
            doCreateNewTestrun(
                textAreaComment.getValue().toString(), textAreaAuthor.getValue().toString());
          }
        });
    Button backProject = new Button("Zurück zur Übersicht");
    backProject.addListener(
        new Button.ClickListener() {
          public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            navigateTo(new NavigationEvent(AvailableSites.PROJECT_OVERVIEW), project);
          }
        });

    buttonLayout.addComponent(newTestrun);
    buttonLayout.addComponent(backProject);

    layout.addComponent(textAreaComment);
    layout.addComponent(textAreaAuthor);
    layout.addComponent(buttonLayout);

    return layout;
  }
コード例 #5
0
  // GoodsOrderListSvc data=new GoodsOrderListSvc();
  // @Inject   TenterpriseFacade cf;
  // @Inject  TenterpriseForm form;
  @PostConstruct
  public void initComponent() {
    /** * */
    StringBuffer sb = new StringBuffer();
    StringBuffer sb1 = new StringBuffer();
    // String fsql = data.makeSql();
    // gSqlContainer sumber=new gSqlContainer();
    MHorizontalLayout sidebar = new MHorizontalLayout();
    MHorizontalLayout isicontents = new MHorizontalLayout();
    MHorizontalLayout toolbar = new MHorizontalLayout();
    toolbar.addComponent(new CheckBox("Indv.Query"));
    // TabSheet tabsheet = new TabSheet();
    // -------------------- Header  ------------------------------
    toolbar.addComponent(new PopupDateField("Entry Date"));
    toolbar.addComponent(new PopupDateField("~"));
    toolbar.addComponent(new TextField("Item"));
    toolbar.addComponent(new ComboBox("Order Media"));
    toolbar.addComponent(new ComboBox("Order Type"));
    toolbar.addComponent(new TextField("MD"));
    toolbar.addComponent(new TextField("Vendor"));
    toolbar.addComponent(new ComboBox("Ad. Type"));

    // -------------------- Header  ------------------------------
    MHorizontalLayout toolmenu;
    toolmenu = new MHorizontalLayout();
    toolmenu.addComponent(new Button("Ret"));
    toolmenu.addComponent(new Button("Ins"));
    toolmenu.addComponent(new Button("Del"));
    toolmenu.addComponent(new Button("Save"));
    toolmenu.addComponent(new Button("Print"));
    toolmenu.addComponent(new Button("XLS"));
    addComponents(new Header("Order Item Report (GoodsOrderList)"));
    addComponents(toolmenu);
    addComponents(toolbar);
    //        addComponents(isicontents);
    // MTable table=new MTable();
    // -------------------- Header Table ---judul untuk table----------
    // List<Tenterprise> findAll = cf.findAll();
    // MTable<Tenterprise> table=new
    // MTable<Tenterprise>(Tenterprise.class).withProperties("entpName");
    // table.setBeans(findAll);
    // table.addMValueChangeListener(new MValueChangeListener<Tdescribecode>() {
    //    @Override
    //    public void valueChange(MValueChangeEvent<Tdescribecode> event) {
    //    Notification.show("ss");
    //    form.setEntity(event.getValue());
    //    }
    //    });
    // table.addContainerProperty("No", String.class,  null);
    // -------------------- Header Table ------------------------------
    //   isicontents.addComponents(table);
    try {
      SimpleJDBCConnectionPool connectionPool =
          new SimpleJDBCConnectionPool(
              "oracle.jdbc.OracleDriver", BaseEntity.jdbc, BaseEntity.user, BaseEntity.pass, 2, 5);
      SQLContainer container;
      container = new SQLContainer(new FreeformQuery(sb.toString(), connectionPool, "AD_MENU_ID"));
      // MTable table= new MTable("MENU",container);
      MTable table = new MTable();
      table.setContainerDataSource(container);
      table.addMValueChangeListener(
          new MValueChangeListener() {
            @Override
            public void valueChange(MValueChangeEvent event) {
              Notification.show("ss");
              //    form.setEntity(event.getValue());
            }
          });
      addComponents(table);
    } catch (SQLException e) {
      e.printStackTrace();
      RichTextArea rtarea = new RichTextArea();
      rtarea.setValue(sb.toString());
      addComponents(rtarea);
    }
    addLayoutClickListener(
        new LayoutEvents.LayoutClickListener() {
          @Override
          public void layoutClick(LayoutEvents.LayoutClickEvent event) {}
        });
  }
コード例 #6
0
  // ScmOutDeliveryOkSvc data=new ScmOutDeliveryOkSvc();
  // @Inject   TenterpriseFacade cf;
  // @Inject  TenterpriseForm form;
  @PostConstruct
  public void initComponent() {
    /**
     * Vendor
     *
     * <p:inputText>Term
     *
     * <p:calendar>~
     *
     * <p:calendar>Item
     *
     * <p:inputText>Type
     *
     * <p:selectOneRadio><f:selectItem itemValue="Order" /><f:selectItem itemValue="Item" /> Step
     *
     * <p:selectOneListbox>*
     */
    StringBuffer sb = new StringBuffer();
    StringBuffer sb1 = new StringBuffer();
    sb.append(
        "SELECT /* entpdelivery.xml : logistics.entpdelivery.selectOrderDeliveryOk by ScmOutDeliveryOk */");
    sb.append(
        "                   DISTINCT '0' AS CHECK_YN,                                                                             ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', NVL(SM.SLIP_NO, ''))       AS SLIP_NO,                          ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', NVL(SM.DELY_GB, ''))       AS DELY_GB,                          ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', NVL(SM.REAL_RECEIVER, '')) AS REAL_RECEIVER,                    ");
    sb.append(
        "                 OD.ORDER_NO,                                                                                 ");
    sb.append("                 OD.DO_FLAG,");
    sb.append(
        "                 OD.WH_CODE,                                                                                  ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', SM.SLIP_I_NO)     AS SLIP_I_NO,                                 ");
    sb.append(
        "                 DECODE(OD.DO_FLAG, '20', '', SM.SLIP_GB)       AS SLIP_GB,                                   ");
    sb.append(
        "                 TC.CUST_NO,                                                                                  ");
    sb.append(
        "                 TC.CUST_NAME,                                                                                ");
    sb.append(
        "                 TR.RECEIVER,                                                                                 ");
    sb.append(
        "                 TR.RECEIVER_POST,                                                                            ");
    sb.append(
        "                 FUN_ADD_POSTADDR(TR.RECEIVER_POST, TR.RECEIVER_POST_SEQ, TR.RECEIVER_ADDR) AS RECEIVER_ADDR, ");
    sb.append(
        "                 TR.RECEIVER_DDD||TR.RECEIVER_TEL1||TR.RECEIVER_TEL2 AS TEL1,                                 ");
    sb.append(
        "                 TR.RECEIVER_HP1||TR.RECEIVER_HP2||TR.RECEIVER_HP3 AS TEL2 , OD.DO_FLAG                                   ");
    sb.append(
        "            FROM TORDERDT       OD,                                                                           ");
    sb.append(
        "                 TSLIPDT        SD,                                                                           ");
    sb.append(
        "                 TSLIPM         SM,                                                                           ");
    sb.append(
        "                 TCUSTOMER      TC,                                                                           ");
    sb.append(
        "                 TRECEIVER      TR,                                                                           ");
    sb.append(
        "                 TGOODS         GM                                                                            ");
    sb.append(
        "           WHERE OD.CUST_NO          = TC.CUST_NO                                                             ");
    sb.append(
        "             AND OD.CUST_NO          = TR.CUST_NO                                                             ");
    sb.append(
        "             AND OD.ORDER_NO         = SD.ORDER_NO(+)                                                         ");
    sb.append(
        "             AND OD.ORDER_G_SEQ      = SD.ORDER_G_SEQ(+)                                                      ");
    sb.append(
        "             AND OD.ORDER_D_SEQ      = SD.ORDER_D_SEQ(+)                                                      ");
    sb.append(
        "             AND OD.ORDER_W_SEQ      = SD.ORDER_W_SEQ(+)                                                      ");
    sb.append(
        "             AND SD.SLIP_I_NO        = SM.SLIP_I_NO(+)                                                        ");
    sb.append(
        "             AND OD.RECEIVER_SEQ     = TR.RECEIVER_SEQ                                                        ");
    sb.append("             AND OD.GOODS_CODE       = GM.GOODS_CODE");
    sb.append("                  AND GM.ENTP_CODE = '100002'");
    sb.append(
        "             AND OD.LAST_PROC_DATE  >= TO_DATE('2013/11/01', 'YYYY/MM/DD')                                               ");
    sb.append(
        "             AND OD.LAST_PROC_DATE   <  TO_DATE('2014/07/01', 'YYYY/MM/DD') + 1                                          ");
    sb.append(
        "             AND OD.DO_FLAG          = '30'                                                                     ");
    sb.append(
        "             AND OD.DELY_TYPE        = '20'                                                                   ");
    sb.append("             AND OD.SYSLAST          > 0 ");
    sb.append("            ");

    sb1.append(
        "SELECT /* entpdelivery.xml : logistics.entpdelivery.selectOrderDeliveryDetailOk by ScmOutDeliveryOk */    ");
    sb1.append("               OD.ORDER_NO,");
    sb1.append("               OD.ORDER_G_SEQ,");
    sb1.append("               OD.ORDER_D_SEQ,");
    sb1.append("               OD.ORDER_W_SEQ,");
    sb1.append("               OD.GOODS_CODE,");
    sb1.append("               GM.GOODS_NAME,");
    sb1.append("               OD.GOODSDT_CODE,");
    sb1.append("               OD.GOODSDT_INFO,");
    sb1.append("               OD.GOODS_GB,");
    sb1.append("               OD.SYSLAST,");
    sb1.append("               OD.SYSLAST_AMT,");
    sb1.append("               OD.SYSLAST_NET,");
    sb1.append("               OD.SYSLAST_VAT,");
    sb1.append("               SD.DELY_QTY,");
    sb1.append("               '' AS REMARK");
    sb1.append("          FROM TORDERDT  OD,");
    sb1.append("               TSLIPDT   SD,");
    sb1.append("               TSLIPM    SM,");
    sb1.append("               TGOODS    GM");
    sb1.append("         WHERE OD.ORDER_NO     = SD.ORDER_NO(+)");
    sb1.append("           AND OD.ORDER_G_SEQ  = SD.ORDER_G_SEQ(+)");
    sb1.append("           AND OD.ORDER_D_SEQ  = SD.ORDER_D_SEQ(+)");
    sb1.append("           AND OD.ORDER_W_SEQ  = SD.ORDER_W_SEQ(+)");
    sb1.append("           AND SD.SLIP_I_NO    = SM.SLIP_I_NO(+)");
    sb1.append("           AND OD.GOODS_CODE   = GM.GOODS_CODE");
    sb1.append("           AND OD.ORDER_NO     = 20140403032491");
    sb1.append("           AND NVL(SM.SLIP_I_NO, 'X') = NVL('10000000112407', 'X')");
    sb1.append("           AND OD.DO_FLAG        = '30'");
    sb1.append("           AND OD.DELY_TYPE      = '20'");
    sb1.append("           AND OD.SYSLAST        > 0");
    sb1.append("           AND GM.OUT_STOCK_YN   = '0'            ");
    // String fsql = data.makeSql();
    // gSqlContainer sumber=new gSqlContainer();
    MHorizontalLayout sidebar = new MHorizontalLayout();
    MHorizontalLayout isicontents = new MHorizontalLayout();
    MHorizontalLayout toolbar = new MHorizontalLayout();
    toolbar.addComponent(new CheckBox("Indv.Query"));
    // TabSheet tabsheet = new TabSheet();
    // -------------------- Header  ------------------------------
    toolbar.addComponent(new TextField("Promo Name"));
    toolbar.addComponent(new PopupDateField("~"));
    toolbar.addComponent(new PopupDateField("~"));
    toolbar.addComponent(new TextField("Promo Name"));
    toolbar.addComponent(new CheckBox("Type"));
    toolbar.addComponent(new CheckBox("Order"));
    toolbar.addComponent(new CheckBox("Exchange"));
    toolbar.addComponent(new ComboBox("Step"));
    toolbar.addComponent(new Button("Select"));
    toolbar.addComponent(new Button("Deselect"));
    toolbar.addComponent(new Button("Waybil No Copy"));
    toolbar.addComponent(new TextField(""));
    toolbar.addComponent(new Button("Delivery Company"));
    toolbar.addComponent(new ComboBox("Other"));

    // -------------------- Header  ------------------------------
    MHorizontalLayout toolmenu;
    toolmenu = new MHorizontalLayout();
    toolmenu.addComponent(new Button("Ret"));
    toolmenu.addComponent(new Button("Ins"));
    toolmenu.addComponent(new Button("Del"));
    toolmenu.addComponent(new Button("Save"));
    toolmenu.addComponent(new Button("Print"));
    toolmenu.addComponent(new Button("XLS"));
    addComponents(new Header("Entp Delivery Confirm (ScmOutDeliveryOk)"));
    addComponents(toolmenu);
    addComponents(toolbar);
    //        addComponents(isicontents);
    // MTable table=new MTable();
    // -------------------- Header Table ---judul untuk table----------
    // List<Tenterprise> findAll = cf.findAll();
    // MTable<Tenterprise> table=new
    // MTable<Tenterprise>(Tenterprise.class).withProperties("entpName");
    // table.setBeans(findAll);
    // table.addMValueChangeListener(new MValueChangeListener<Tdescribecode>() {
    //    @Override
    //    public void valueChange(MValueChangeEvent<Tdescribecode> event) {
    //    Notification.show("ss");
    //    form.setEntity(event.getValue());
    //    }
    //    });
    // table.addContainerProperty("No", String.class,  null);
    // -------------------- Header Table ------------------------------
    //   isicontents.addComponents(table);
    try {
      SimpleJDBCConnectionPool connectionPool =
          new SimpleJDBCConnectionPool(
              "oracle.jdbc.OracleDriver",
              "jdbc:oracle:thin:@localhost:1521/XE",
              "dartmedia",
              "dartmedia",
              2,
              5);
      SQLContainer container;
      container = new SQLContainer(new FreeformQuery(sb.toString(), connectionPool, "AD_MENU_ID"));
      // MTable table= new MTable("MENU",container);
      TreeTable table = new TreeTable("Menu", container);
      addComponents(table);
    } catch (SQLException e) {
      e.printStackTrace();
      RichTextArea rtarea = new RichTextArea();
      rtarea.setValue(sb.toString());
      addComponents(rtarea);
    }
    addLayoutClickListener(
        new LayoutEvents.LayoutClickListener() {
          @Override
          public void layoutClick(LayoutEvents.LayoutClickEvent event) {}
        });
  }
コード例 #7
0
ファイル: MailFormWindow.java プロジェクト: gsccs/mycollab
  private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
      for (String mail : lstMail) {
        if (StringUtils.isNotBlank(mail)) {
          if (mail.indexOf("<") > -1) {
            String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
            if (strMail != null && !strMail.equalsIgnoreCase("null")) {}

          } else {

          }
        }
      }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    controlsLayout.addComponent(uploadExt);
    controlsLayout.setExpandRatio(uploadExt, 1.0f);

    controlsLayout.setSpacing(true);

    Button cancelBtn =
        new Button(
            AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                MailFormWindow.this.close();
              }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

    Button sendBtn =
        new Button(
            "Send",
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {

                if (tokenFieldMailTo.getListRecipient().size() <= 0
                    || subject.getValue().equals("")) {
                  NotificationUtil.showErrorNotification(
                      "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
                  return;
                }
                if (AppContext.getUser().getEmail() != null
                    && AppContext.getUser().getEmail().length() > 0) {
                  ExtMailService systemMailService =
                      ApplicationContextUtil.getSpringBean(ExtMailService.class);

                  List<File> listFile = attachments.files();
                  List<EmailAttachementSource> emailAttachmentSource = null;
                  if (listFile != null && listFile.size() > 0) {
                    emailAttachmentSource = new ArrayList<>();
                    for (File file : listFile) {
                      emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                  }

                  systemMailService.sendHTMLMail(
                      AppContext.getUser().getEmail(),
                      AppContext.getUser().getDisplayName(),
                      tokenFieldMailTo.getListRecipient(),
                      tokenFieldMailCc.getListRecipient(),
                      tokenFieldMailBcc.getListRecipient(),
                      subject.getValue().toString(),
                      noteArea.getValue().toString(),
                      emailAttachmentSource);
                  MailFormWindow.this.close();
                } else {
                  NotificationUtil.showErrorNotification(
                      "Your email is empty value, please fulfil it before sending email!");
                }
              }
            });
    sendBtn.setIcon(FontAwesome.SEND);
    sendBtn.setStyleName(UIConstants.BUTTON_ACTION);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 2);

    this.setContent(mainLayout);
  }
コード例 #8
0
    private void createAddMessageLayout() {
      this.messagePanelBody.removeAllComponents();

      final VerticalLayout addMessageWrapper = new VerticalLayout();
      addMessageWrapper.setSpacing(true);
      addMessageWrapper.setWidth("500px");

      final RichTextArea ckEditorTextField = new RichTextArea();
      final AttachmentPanel attachments = new AttachmentPanel();
      final TextField titleField = new TextField();

      final HorizontalLayout titleLayout = new HorizontalLayout();
      titleLayout.setSpacing(true);
      final Label titleLbl = new Label("Title: ");
      titleLbl.setWidth(SIZE_UNDEFINED, Sizeable.Unit.PIXELS);

      titleField.setWidth("100%");
      titleField.setNullRepresentation("");
      titleField.setRequired(true);
      titleField.setRequiredError("Please enter a Title");

      titleLayout.addComponent(titleLbl);
      titleLayout.addComponent(titleField);
      titleLayout.setExpandRatio(titleField, 1.0f);
      titleLayout.setWidth("100%");

      addMessageWrapper.addComponent(titleLayout);
      addMessageWrapper.setComponentAlignment(titleLayout, Alignment.MIDDLE_LEFT);

      ckEditorTextField.setWidth("100%");
      ckEditorTextField.setHeight("200px");
      addMessageWrapper.addComponent(ckEditorTextField);
      addMessageWrapper.setExpandRatio(ckEditorTextField, 1.0f);
      addMessageWrapper.addComponent(attachments);
      addMessageWrapper.setComponentAlignment(ckEditorTextField, Alignment.MIDDLE_CENTER);

      final HorizontalLayout controls = new HorizontalLayout();
      controls.setWidth("100%");
      controls.setSpacing(true);

      final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
      controls.addComponent(uploadExt);
      controls.setExpandRatio(uploadExt, 1.0f);
      controls.setComponentAlignment(uploadExt, Alignment.MIDDLE_LEFT);

      final CheckBox chkIsStick = new CheckBox("Is Stick");
      controls.addComponent(chkIsStick);
      controls.setComponentAlignment(chkIsStick, Alignment.MIDDLE_CENTER);

      final Button cancelBtn =
          new Button(
              LocalizationHelper.getMessage(GenericI18Enum.BUTTON_CANCEL_LABEL),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                  TopMessagePanel.this.createBasicLayout();
                }
              });
      cancelBtn.setStyleName("link");
      controls.addComponent(cancelBtn);
      controls.setComponentAlignment(cancelBtn, Alignment.MIDDLE_CENTER);

      final Button saveBtn =
          new Button(
              "Post",
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                  final Message message = new Message();
                  message.setProjectid(CurrentProjectVariables.getProjectId());
                  message.setPosteddate(new GregorianCalendar().getTime());
                  if (!titleField.getValue().toString().trim().equals("")) {
                    message.setTitle(titleField.getValue());
                    message.setMessage(ckEditorTextField.getValue());
                    message.setPosteduser(AppContext.getUsername());
                    message.setSaccountid(AppContext.getAccountId());
                    message.setIsstick(chkIsStick.getValue());
                    MessageListViewImpl.this.fireSaveItem(message);

                    String attachmentPath =
                        AttachmentUtils.getProjectEntityAttachmentPath(
                            AppContext.getAccountId(),
                            message.getProjectid(),
                            AttachmentType.PROJECT_MESSAGE,
                            message.getId());
                    attachments.saveContentsToRepo(attachmentPath);
                  } else {
                    titleField.addStyleName("errorField");
                    NotificationUtil.showErrorNotification("Title must be not null!");
                  }
                }
              });
      saveBtn.setStyleName(UIConstants.THEME_BLUE_LINK);
      controls.addComponent(saveBtn);
      controls.setComponentAlignment(saveBtn, Alignment.MIDDLE_CENTER);

      addMessageWrapper.addComponent(controls);
      addMessageWrapper.setComponentAlignment(controls, Alignment.MIDDLE_CENTER);
      this.messagePanelBody.addComponent(addMessageWrapper);
    }
コード例 #9
0
ファイル: PbFieldFactory.java プロジェクト: llyys/processbase
 public Field createField(Item item, Object propertyId, Component uiContext) {
   String pid = (String) propertyId;
   if (pid.equals("sectionName")) {
     TextField tf = new TextField(messages.getString("sectionName"));
     tf.setNullRepresentation("");
     tf.setWidth("300px");
     tf.setRequired(true);
     tf.setRequiredError(messages.getString("requiredField"));
     return tf;
   } else if (pid.equals("sectionDesc")) {
     TextField tf = new TextField(messages.getString("sectionDesc"));
     tf.setNullRepresentation("");
     tf.setWidth("150px");
     tf.setRequired(true);
     tf.setRequiredError(messages.getString("requiredField"));
     return tf;
   } else if (pid.equals("taskName") || pid.equals("name")) {
     TextField tf = new TextField(("taskName"));
     tf.setNullRepresentation("");
     tf.setSizeFull();
     tf.setRequired(true);
     tf.setRequiredError("Обязательное поле!");
     return tf;
   } else if (pid.equals("dataXml")) {
     RichTextArea ra = new RichTextArea();
     ra.setCaption(("taskText"));
     ra.setNullRepresentation("");
     ra.setRequired(true);
     ra.setRequiredError("Обязательное поле!");
     return ra;
   } else if (pid.equals("startDate") || pid.equals("expireDate") || pid.equals("endDate")) {
     PopupDateField df = new PopupDateField((pid));
     df.setResolution(DateField.RESOLUTION_MIN);
     df.setValue(new Date());
     df.setRequired(true);
     df.setRequiredError("Обязательное поле!");
     return df;
   } else if (pid.equals("nxuserId")) {
     TextField tf = new TextField(("author"));
     tf.setNullRepresentation("");
     tf.setSizeFull();
     tf.setRequired(true);
     tf.setReadOnly(true);
     return tf;
   } else if (pid.equals("assignedTo")) {
     TextField tf = new TextField(("assignedTo"));
     tf.setNullRepresentation("");
     tf.setSizeFull();
     tf.setRequired(true);
     tf.setReadOnly(true);
     return tf;
   } else if (pid.equals("status")) {
     TextField tf = new TextField(("status"));
     tf.setNullRepresentation("");
     tf.setReadOnly(true);
     return tf;
   } else if (pid.equals("id")) {
     TextField tf = new TextField("ID");
     tf.setNullRepresentation("");
     tf.setReadOnly(true);
     return tf;
   }
   return null;
 }