Package org.projectforge.web.wicket.flowlayout

Examples of org.projectforge.web.wicket.flowlayout.IconButtonPanel


  @Override
  protected void init()
  {
    super.init();
    {
      final IconButtonPanel icsExportButtonPanel = new IconButtonPanel(buttonGroupPanel.newChildId(), IconType.LIST, new ResourceModel(
          "plugins.teamcal.calendar.listAndIcsExport.tooltip")) {
        /**
         * @see org.projectforge.web.wicket.flowlayout.IconButtonPanel#onSubmit()
         */
        @Override
        protected void onSubmit()
        {
          setResponsePage(TeamCalListPage.class);
        }
      };
      icsExportButtonPanel.setDefaultFormProcessing(false);
      buttonGroupPanel.addButton(icsExportButtonPanel);
    }
    {
      final IconButtonPanel searchButtonPanel = new IconButtonPanel(buttonGroupPanel.newChildId(), IconType.SEARCH, new ResourceModel(
          "search")) {
        /**
         * @see org.projectforge.web.wicket.flowlayout.IconButtonPanel#onSubmit()
         */
        @Override
        protected void onSubmit()
        {
          final Set<Integer> visibleCalsSet = ((TeamCalCalendarFilter) filter).getActiveVisibleCalendarIds();
          final String calendars = StringHelper.objectColToString(visibleCalsSet, ",");
          final TeamEventListPage teamEventListPage = new TeamEventListPage(new PageParameters().add(TeamEventListPage.PARAM_CALENDARS,
              calendars));
          setResponsePage(teamEventListPage);
        }
      };
      searchButtonPanel.setDefaultFormProcessing(false);
      buttonGroupPanel.addButton(searchButtonPanel);
    }

    final TeamCalFilterDialog dialog = new TeamCalFilterDialog(parentPage.newModalDialogId(), (TeamCalCalendarFilter) filter) {
      /**
       * @see org.projectforge.plugins.teamcal.dialog.TeamCalFilterDialog#onClose(org.apache.wicket.ajax.AjaxRequestTarget)
       */
      @Override
      protected void onClose(final AjaxRequestTarget target)
      {
        activeTemplate = ((TeamCalCalendarFilter) filter).getActiveTemplateEntry();
        target.add(templateChoice.getDropDownChoice());
      }
    };
    parentPage.add(dialog);
    dialog.init();
    final List<TemplateEntry> values = ((TeamCalCalendarFilter) filter).getTemplateEntries();
    final LabelValueChoiceRenderer<TemplateEntry> templateNamesChoiceRenderer = new LabelValueChoiceRenderer<TemplateEntry>();
    for (final TemplateEntry entry : values) {
      templateNamesChoiceRenderer.addValue(entry, entry.getName());
    }
    templateNamesChoiceRenderer.addValue(new TemplateEntry().setName(MAGIC_FILTER_ENTRY),
        getString("plugins.teamcal.calendar.filter.newEntry"));
    final IModel<TemplateEntry> activeModel = new PropertyModel<TemplateEntry>(this, "activeTemplate");
    this.activeTemplate = ((TeamCalCalendarFilter) filter).getActiveTemplateEntry();
    templateChoice = new DropDownChoicePanel<TemplateEntry>(fieldset.newChildId(), activeModel, templateNamesChoiceRenderer.getValues(),
        templateNamesChoiceRenderer, false);
    fieldset.add(templateChoice);
    templateChoice.setTooltip(getString("plugins.teamcal.calendar.filter.choose"));
    templateChoice.getDropDownChoice().setOutputMarkupId(true);

    templateChoice.getDropDownChoice().add(new AjaxFormComponentUpdatingBehavior("onChange") {
      private static final long serialVersionUID = 8999698636114154230L;

      /**
       * @see org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior#onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)
       */
      @Override
      protected void onUpdate(final AjaxRequestTarget target)
      {
        final TemplateEntry selectedEntry = activeModel.getObject();
        if (MAGIC_FILTER_ENTRY.equals(selectedEntry.getName()) == false) {
          ((TeamCalCalendarFilter) filter).setActiveTemplateEntry(selectedEntry);
          filter.setSelectedCalendar(TemplateEntry.calcCalendarStringForCalendar(selectedEntry.getDefaultCalendarId()));
          setResponsePage(getParentPage().getClass());
        } else {
          final String newTemplateName = ((TeamCalCalendarFilter) filter)
              .getNewTemplateName(getString("plugins.teamcal.calendar.filterDialog.newTemplateName"));
          if (newTemplateName == null) {
            // New filter 9 is already reached.
            activeTemplate = ((TeamCalCalendarFilter) filter).getActiveTemplateEntry();
            target.add(templateChoice.getDropDownChoice());
            return;
          }
          dialog.openNew(target, newTemplateName);
          // Redraw the content:
          dialog.redraw().addContent(target);
        }
      }
    });

    final IconButtonPanel calendarButtonPanel = new AjaxIconButtonPanel(buttonGroupPanel.newChildId(), IconType.EDIT, new ResourceModel(
        "plugins.teamcal.calendar.filter.edit")) {
      /**
       * @see org.projectforge.web.wicket.flowlayout.AjaxIconButtonPanel#onSubmit(org.apache.wicket.ajax.AjaxRequestTarget)
       */
      @Override
      protected void onSubmit(final AjaxRequestTarget target)
      {
        dialog.open(target);
        // Redraw the content:
        dialog.redraw().addContent(target);
      }
    };
    calendarButtonPanel.setDefaultFormProcessing(false);
    buttonGroupPanel.addButton(calendarButtonPanel);

    fieldset.add(new DropIcsPanel(fieldset.newChildId()) {

      @Override
View Full Code Here


        getString("calendar.option.slot30"), true).setTooltip(getString("calendar.option.slot30.tooltip")));

    buttonGroupPanel = new ButtonGroupPanel(fieldset.newChildId());
    fieldset.add(buttonGroupPanel);
    {
      final IconButtonPanel refreshButtonPanel = new IconButtonPanel(buttonGroupPanel.newChildId(), IconType.REFRESH,
          getRefreshIconTooltip()) {
        /**
         * @see org.projectforge.web.wicket.flowlayout.IconButtonPanel#onSubmit()
         */
        @Override
        protected void onSubmit()
        {
          parentPage.refresh();
          setResponsePage(getPage().getClass(), getPage().getPageParameters());
        }
      };
      buttonGroupPanel.addButton(refreshButtonPanel);
      setDefaultButton(refreshButtonPanel.getButton());
    }
    gridBuilder.newSplitPanel(GridSize.SPAN4);
    final FieldsetPanel fs = gridBuilder.newFieldset(getString("timesheet.duration")).suppressLabelForWarning();
    final DivTextPanel durationPanel = new DivTextPanel(fs.newChildId(), new Label(DivTextPanel.WICKET_ID, new Model<String>() {
      @Override
View Full Code Here

      FieldsetPanel fs = gridBuilder.newFieldset(gridBuilder.getString("plugins.licensemanagement.file1"));
      fileUploadPanel1 = new FileUploadPanel(fs.newChildId(), fs, this, true, new PropertyModel<String>(data, "filename1"),
          new PropertyModel<byte[]>(data, "file1"));
      if (isNew() == false && (data.getFile1() != null || data.getFile2() != null)) {
        // Swap files:
        fs.add(new IconButtonPanel(fs.newChildId(), IconType.SWAP, getString("plugins.licensemanagement.swapFiles")) {
          /**
           * @see org.projectforge.web.wicket.flowlayout.IconButtonPanel#onSubmit()
           */
          @Override
          protected void onSubmit()
View Full Code Here

        {
          target.add(feedbackPanel.setVisible(true));
        }
      };
      deleteRowButton.setDefaultFormProcessing(false);
      row.add(new IconButtonPanel("deleteEntry", deleteRowButton, IconType.TRASH, null).setLight());
    } else {
      // Don't show a delete button.
      row.add(new Label("deleteEntry", "&nbsp;").setEscapeModelStrings(false).setRenderBodyOnly(true));
    }
    return row;
View Full Code Here

TOP

Related Classes of org.projectforge.web.wicket.flowlayout.IconButtonPanel

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.