Package org.rhq.coregui.client.components.form

Examples of org.rhq.coregui.client.components.form.DurationItem


        String cronExpression = this.triggerEditor.getCronExpression();
        jobTriggerRecord.setAttribute(Field.CRON_EXPRESSION, cronExpression);

        form.setValue(Field.JOB_TRIGGER, jobTriggerRecord);

        DurationItem timeoutItem = (DurationItem) this.notesForm.getItem(Field.TIMEOUT);
        Long timeout = timeoutItem.getValueAsLong();
        if (timeout != null) {
            form.setValue(Field.TIMEOUT, timeout);
        } else {
            form.setValue(Field.TIMEOUT, (String) null);
        }
View Full Code Here


        formItems.add(selection);

        TreeSet<TimeUnit> supportedTimeUnits = new TreeSet<TimeUnit>();
        supportedTimeUnits.add(TimeUnit.MINUTES);
        supportedTimeUnits.add(TimeUnit.HOURS);
        DurationItem durationValue = new DurationItem(AVAILABILITY_DURATION_VAL_ITEMNAME, MSG.common_title_duration(),
            TimeUnit.SECONDS, supportedTimeUnits, false, false);
        durationValue.setWrapTitle(false);
        durationValue.setRequired(true);
        durationValue.setTooltip(MSG.view_alert_definition_condition_editor_availabilityDuration_tooltip_duration());
        durationValue.setHoverWidth(200);
        if (editMode) {
            durationValue.setAndFormatValue(Integer.parseInt(existingCondition.getOption()) * 1000L);
        }
        durationValue.setShowIfCondition(ifFunc);
        formItems.add(durationValue);

        return formItems;
    }
View Full Code Here

                TreeSet<TimeUnit> timeUnits = new TreeSet<TimeUnit>();
                timeUnits.add(TimeUnit.SECONDS);
                timeUnits.add(TimeUnit.MINUTES);
                timeUnits.add(TimeUnit.HOURS);
                timeUnits.add(TimeUnit.DAYS);
                final DurationItem startDelay = new DurationItem("duration", "", timeUnits, false, false);

                delayForm.setFields(startDelay);

                DynamicForm scheduleForm = new DynamicForm();

                final DateTimeItem schedule = new DateTimeItem("schedule");
                schedule.setEnforceDate(true);
                schedule.setCenturyThreshold(99);
                schedule.setShowTitle(false);
                schedule.setStartDate(new Date());
                schedule.setUseMask(true);
                schedule.setShowHint(true);

                scheduleForm.setFields(schedule);


                LinkedHashMap<String, Canvas> items = new LinkedHashMap<String, Canvas>();
                items.put(MSG.view_admin_plugins_update_on_agents_now(), nowCanvas);
                items.put(MSG.view_admin_plugins_update_on_agents_delayed(), delayForm);
                items.put(MSG.view_admin_plugins_update_on_agents_scheduled(), scheduleForm);

                DynamicForm form = new DynamicForm();
                form.setWidth(300);
                final RadioGroupWithComponentsItem scheduling = new RadioGroupWithComponentsItem("scheduling", "", items, form);

                form.setFields(scheduling);

                layout.addMember(form);

                ButtonItem ok = new ButtonItem("ok", MSG.common_button_ok());
                ok.setEndRow(false);
                ok.setAlign(Alignment.RIGHT);
                ButtonItem cancel = new ButtonItem("cancel", MSG.common_button_cancel());
                cancel.setStartRow(false);
                cancel.setAlign(Alignment.LEFT);

                DynamicForm buttons = new DynamicForm();
                buttons.setNumCols(2);
                buttons.setFields(ok, cancel);

                layout.addMember(buttons);

                ok.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
                    @Override
                    public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
                        long delay;
                        if (MSG.view_admin_plugins_update_on_agents_now().equals(scheduling.getSelected())) {
                            delay = 0;
                        } else if (MSG.view_admin_plugins_update_on_agents_delayed().equals(scheduling.getSelected())) {
                            Integer value = (Integer) startDelay.getValue();
                            TimeUnit u = startDelay.getValueUnit();

                            if (value == null) {
                                CoreGUI.getErrorHandler()
                                    .handleError(MSG.view_admin_plugins_update_on_agents_no_time_specified());
                                w.hide();
View Full Code Here

        TreeSet<TimeUnit> supportedUnits = new TreeSet<TimeUnit>();
        supportedUnits.add(TimeUnit.SECONDS);
        supportedUnits.add(TimeUnit.MINUTES);
        supportedUnits.add(TimeUnit.HOURS);
        DurationItem timeoutItem = new DurationItem(Field.TIMEOUT, MSG.view_operationScheduleDetails_field_timeout(),
            supportedUnits, false, isReadOnly());
        ProductInfo productInfo = CoreGUI.get().getProductInfo();
        timeoutItem.setContextualHelp(MSG.view_operationScheduleDetails_fieldHelp_timeout(productInfo.getShortName()));
        notesFields.add(timeoutItem);

        if (!isNewRecord()) {
            StaticTextItem nextFireTimeItem = new StaticTextItem(Field.NEXT_FIRE_TIME,
                MSG.dataSource_operationSchedule_field_nextFireTime());
View Full Code Here

        this.triggerEditor.setJobTrigger(jobTrigger);

        FormItem nextFireTimeItem = this.notesForm.getField(Field.NEXT_FIRE_TIME);
        nextFireTimeItem.setValue(getForm().getValue(Field.NEXT_FIRE_TIME));

        DurationItem timeoutItem = (DurationItem) this.notesForm.getField(Field.TIMEOUT);
        Object value = getForm().getValue(Field.TIMEOUT);
        Integer integerValue = TypeConversionUtility.toInteger(value);
        timeoutItem.setValue(integerValue, UnitType.TIME);

        StaticTextItem notesItem = (StaticTextItem) this.notesForm.getField(Field.DESCRIPTION);
        // Notes field is user-editable, so escape HTML to prevent an XSS attack. Unless empty, then don't to prevent
        // displaying &nbsp; as the value.
        String notesValue = getForm().getValueAsString(Field.DESCRIPTION);
View Full Code Here

            // only create the timeout member 1 time, even if we end up recreating the config editor
            TreeSet<TimeUnit> supportedUnits = new TreeSet<TimeUnit>();
            supportedUnits.add(TimeUnit.SECONDS);
            supportedUnits.add(TimeUnit.MINUTES);
            timeoutItem = new DurationItem(AbstractOperationScheduleDataSource.Field.TIMEOUT,
                MSG.view_operationScheduleDetails_field_timeout(), TimeUnit.MILLISECONDS, supportedUnits, false, false);
            ProductInfo productInfo = CoreGUI.get().getProductInfo();
            timeoutItem.setContextualHelp(MSG.widget_resourceFactoryWizard_timeoutHelp(productInfo.getShortName()));

            DynamicForm timeoutForm = new DynamicForm();
View Full Code Here

                this.calendarTypeForm.hide();
                changeMode("calendar");

                FormItem startTypeItem = this.laterForm.getItem(FIELD_START_TYPE);
                startTypeItem.setValue("on");
                DurationItem startDelayItem = (DurationItem) this.laterForm.getItem(FIELD_START_DELAY);
                FormItem startTimeItem = this.laterForm.getField(FIELD_START_TIME);
                changeStartType("on", startDelayItem, startTimeItem);
                startTimeItem.setValue(this.jobTrigger.getStartDate());

                FormItem calendarTypeItem = this.calendarTypeForm.getField("calendarType");
                if (this.jobTrigger.getRecurrenceType() == JobTrigger.RecurrenceType.REPEAT_INTERVAL) {
                    calendarTypeItem.setValue("laterAndRepeat");
                    changeCalendarType("laterAndRepeat");

                    DurationItem repeatIntervalItem = (DurationItem) this.repeatForm.getItem(FIELD_REPEAT_INTERVAL);
                    repeatIntervalItem.setAndFormatValue(this.jobTrigger.getRepeatInterval());

                    FormItem endTimeItem = this.repeatForm.getField(FIELD_END_TIME);
                    DurationItem repeatDurationItem = (DurationItem) this.repeatForm.getItem(FIELD_REPEAT_DURATION);
                    FormItem recurrenceTypeItem = this.repeatForm.getField(FIELD_RECURRENCE_TYPE);
                    if (this.jobTrigger.getRepeatCount() != null) {
                        recurrenceTypeItem.setValue("for");
                        changeRecurrenceType("for", endTimeItem, repeatDurationItem);
                        repeatDurationItem.setValue(this.jobTrigger.getRepeatCount(), UnitType.ITERATIONS);
                    } else if (this.jobTrigger.getEndDate() != null) {
                        recurrenceTypeItem.setValue("until");
                        changeRecurrenceType("until", endTimeItem, repeatDurationItem);
                        endTimeItem.setValue(this.jobTrigger.getEndDate());
                    } else {
View Full Code Here

        supportedUnits.add(TimeUnit.HOURS);
        supportedUnits.add(TimeUnit.DAYS);
        supportedUnits.add(TimeUnit.WEEKS);
        supportedUnits.add(TimeUnit.MONTHS);
        supportedUnits.add(TimeUnit.YEARS);
        DurationItem repeatIntervalItem = new DurationItem(FIELD_REPEAT_INTERVAL,
            MSG.widget_jobTriggerEditor_field_repeatInterval_now(), supportedUnits, false, this.isReadOnly);
        repeatIntervalItem.setRequired(true);
        repeatIntervalItem.setContextualHelp(MSG.widget_jobTriggerEditor_fieldHelp_repeatInterval());

        RadioGroupItem recurrenceTypeItem = new RadioGroupItem(FIELD_RECURRENCE_TYPE);
        recurrenceTypeItem.setRequired(true);
        recurrenceTypeItem.setShowTitle(false);
        LinkedHashMap<String, String> recurrenceTypeValueMap = new LinkedHashMap<String, String>();
        recurrenceTypeValueMap.put("for", MSG.widget_jobTriggerEditor_value_for());
        recurrenceTypeValueMap.put("until", MSG.widget_jobTriggerEditor_value_until());
        recurrenceTypeValueMap.put("indefinitely", MSG.widget_jobTriggerEditor_value_indefinitely());
        recurrenceTypeItem.setValueMap(recurrenceTypeValueMap);

        supportedUnits = new TreeSet<TimeUnit>();
        supportedUnits.add(TimeUnit.SECONDS);
        supportedUnits.add(TimeUnit.MINUTES);
        supportedUnits.add(TimeUnit.HOURS);
        supportedUnits.add(TimeUnit.DAYS);
        supportedUnits.add(TimeUnit.WEEKS);
        supportedUnits.add(TimeUnit.MONTHS);
        supportedUnits.add(TimeUnit.YEARS);
        final DurationItem repeatDurationItem = new DurationItem(FIELD_REPEAT_DURATION, null, supportedUnits, true,
            this.isReadOnly);
        repeatDurationItem.setShowTitle(false);
        repeatDurationItem.setVisible(false);
        repeatDurationItem.setContextualHelp(MSG.widget_jobTriggerEditor_fieldHelp_repeatDuration());

        final DateTimeItem endTimeItem = createDateTimeItem(FIELD_END_TIME);
        endTimeItem.setShowTitle(false);
        endTimeItem.setVisible(false);
View Full Code Here

        supportedUnits.add(TimeUnit.HOURS);
        supportedUnits.add(TimeUnit.DAYS);
        supportedUnits.add(TimeUnit.WEEKS);
        supportedUnits.add(TimeUnit.MONTHS);
        supportedUnits.add(TimeUnit.YEARS);
        final DurationItem startDelayItem = new DurationItem(FIELD_START_DELAY, null, supportedUnits, false,
            this.isReadOnly);
        startDelayItem.setShowTitle(false);
        startDelayItem.setVisible(false);
        startDelayItem.setContextualHelp(MSG.widget_jobTriggerEditor_fieldHelp_startDelay());

        SpacerItem spacerItem = new SpacerItem();

        startTypeItem.addChangedHandler(new ChangedHandler() {
            public void onChanged(ChangedEvent event) {
View Full Code Here

            return null;
        }
        Date startTime;
        if (this.isStartDelay) {
            // start delay - compute start time
            DurationItem startDelayItem = (DurationItem) this.laterForm.getItem(FIELD_START_DELAY);
            long delay = startDelayItem.getValueAsLong() * 1000;
            long startTimestamp = System.currentTimeMillis() + delay;
            startTime = new Date(startTimestamp);
        } else {
            // start time
            DateTimeItem startTimeItem = (DateTimeItem) this.laterForm.getField(FIELD_START_TIME);
View Full Code Here

TOP

Related Classes of org.rhq.coregui.client.components.form.DurationItem

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.