public HighlightActionsPanel(String id, final IModel<Restaurant> restaurantModel) {
    super(id);
    setVisible(
        RestaurantWicketSession.get().isSignedIn()
            && RestaurantWicketSession.get().getUser().isAdmin());
    boolean state = restaurantModel.getObject().isHighlighted();

    Form<Void> highlightForm =
        new Form<Void>("highlightForm") {
          @Override
          protected void onSubmit() {
            Restaurant r = restaurantModel.getObject();
            r.highlight();
            setResponsePage(new RestaurantListPage());
          }
        };
    highlightForm.add(new Button("highlight", new ResourceModel("highlight")));
    add(highlightForm);

    Form<Void> unhighlightForm =
        new Form<Void>("unhighlightForm") {
          @Override
          protected void onSubmit() {
            Restaurant r = restaurantModel.getObject();
            r.unhighlight();
            setResponsePage(new RestaurantListPage());
          }
        };
    unhighlightForm.add(new Button("unhighlight", new ResourceModel("unhighlight")));
    add(unhighlightForm);
    unhighlightForm.setVisible(state);
    highlightForm.setVisible(!state);
  }
  private void addOptionalFormAttributes(ExtendedForm form) {
    final Form<?> optionalContainer = new Form<Object>("optional");
    optionalContainer.setOutputMarkupId(true);
    optionalContainer.setOutputMarkupPlaceholderTag(true);
    optionalContainer.setVisible(false);
    form.add(optionalContainer);
    addToggleOptionalCheckBox(form, optionalContainer);

    FormUtils.addGenericField(optionalContainer, "xdsRegistry", xdsRegistry, false, false);
    FormUtils.addGenericField(optionalContainer, "xdsRepository", xdsRepository, false, false);

    optionalContainer.add(
        new Label("xdsSourceUrl.label", new ResourceModel("dicom.edit.xds.xdsSourceUrl.label"))
            .setOutputMarkupPlaceholderTag(true));
    optionalContainer.add(
        new TextField<String>("xdsSourceUrl", xdsSourceUrlModel).setType(String.class));
  }
Esempio n. 3
0
  public MessageDetailPage(PageParameters params) {

    final String messageId = params.get("MSG_ID").toString();

    DetachableMessageModel msgModel = new DetachableMessageModel(messageId);
    CompoundPropertyModel<Message> msg = new CompoundPropertyModel<Message>(msgModel);

    Label title = new Label("title", msg.bind("subject"));
    add(title);

    Label sender = new Label("sender", msg.bind("sender"));
    add(sender);

    Date sentDate = (Date) msg.bind("sentTs").getObject();
    IModel<Date> sentDateModel = new Model<Date>(sentDate);
    DateLabel dateSent =
        new DateLabel("sentDate", sentDateModel, new PatternDateConverter("yyyy.MM.dd", true));

    add(dateSent);

    MultiLineLabel message = new MultiLineLabel("message", msg.bind("messageBody"));
    add(message);

    setDefaultModel(msg);

    final Form<String> replyForm = new Form<String>("replyForm", new Model<String>(messageId));
    replyForm.setOutputMarkupId(true);
    final TextArea<String> replyMessageText =
        new TextArea<String>("replyMessage", new PropertyModel<String>(this, "replyMessage"));

    replyForm.add(replyMessageText);

    replyForm.add(
        new CustomButton("send", new Model<String>("send")) {

          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            String replyMsg = replyMessageText.getDefaultModelObjectAsString();
            String messageId = replyForm.getDefaultModelObjectAsString();
            if (!StringUtils.isEmpty(replyMsg)) {
              Message msg = messageRepository.findOne(new ObjectId(messageId));
              String userId = ((EcomSession) Session.get()).getUserId();

              Message replyMessage = new Message();
              replyMessage.setMessageBody(replyMsg);
              replyMessage.setReceiver(msg.getSenderFirstname());
              replyMessage.setSenderFirstname(userId);
              replyMessage.setSentTs(new Date());
              messageRepository.save(replyMessage);
            }
          }
        });
    replyForm.setVisible(false);

    MiniButton<String> replyBtn =
        new MiniButton<String>("replyBtn", new Model<String>("Reply")) {

          private static final long serialVersionUID = 1L;

          @Override
          public void onClick() {
            replyForm.setVisible(true);
          }
        };

    add(replyForm);
    add(replyBtn);
  }
Esempio n. 4
0
 /** Turns filtering abilities on/off. */
 public void setFilterVisible(boolean filterVisible) {
   filterForm.setVisible(filterVisible);
 }
Esempio n. 5
0
 /**
  * Enables/disables filtering for this table. When no filtering is enabled, the top form with the
  * top pager and the search box will disappear. Returns self for chaining.
  */
 public GeoServerTablePanel<T> setFilterable(boolean filterable) {
   filterForm.setVisible(filterable);
   return this;
 }