Package org.libreplan.web.common.components

Examples of org.libreplan.web.common.components.NewDataSortableColumn


        columns.setSizable(true);

        // Add static headers
        if (getWorkReport() != null) {
            if (!getWorkReport().getWorkReportType().getDateIsSharedByLines()) {
                NewDataSortableColumn columnDate = new NewDataSortableColumn();
                columnDate.setLabel(_("Date"));
                columnDate.setSclass("date-column");
                Util.setSort(columnDate, "auto=(date)");
                columnDate.setSortDirection("ascending");

                columnDate.addEventListener("onSort", new EventListener() {
                    @Override
                    public void onEvent(Event event) {
                        sortWorkReportLines();
                    }
                });
                columns.appendChild(columnDate);
            }
            if (!getWorkReport().getWorkReportType()
                    .getResourceIsSharedInLines()) {
                NewDataSortableColumn columnResource = new NewDataSortableColumn();
                columnResource.setLabel(_("Resource"));
                columnResource.setSclass("resource-column");
                // columnResource.setWidth("75px");
                columns.appendChild(columnResource);
            }
            if (!getWorkReport().getWorkReportType()
                    .getOrderElementIsSharedInLines()) {
                NewDataSortableColumn columnCode = new NewDataSortableColumn();
                columnCode.setLabel(_("Task"));
                columnCode.setSclass("order-code-column");
                columnCode.setHflex("min");
                columns.appendChild(columnCode);
            }

            for (Object fieldOrLabel : workReportModel
                    .getFieldsAndLabelsLineByDefault()) {
                String columnName;
                int width = EXTRA_FIELD_MIN_WIDTH;
                if (fieldOrLabel instanceof DescriptionField) {
                    columnName = ((DescriptionField) fieldOrLabel)
                            .getFieldName();
                    width = Math.max(((DescriptionField) fieldOrLabel)
                            .getLength()
                            * EXTRA_FIELD_PX_PER_CHAR, EXTRA_FIELD_MIN_WIDTH);
                    width = Math.min(width, EXTRA_FIELD_MAX_WIDTH);

                } else {
                    columnName = ((WorkReportLabelTypeAssigment) fieldOrLabel)
                            .getLabelType().getName();
                }
                NewDataSortableColumn columnFieldOrLabel = new NewDataSortableColumn();
                columnFieldOrLabel.setLabel(_(columnName));
                columnFieldOrLabel.setSclass("columnFieldOrLabel");
                columnFieldOrLabel.setWidth(width + "px");
                columns.appendChild(columnFieldOrLabel);
            }

            if (!getWorkReport().getWorkReportType().getHoursManagement()
                    .equals(HoursManagementEnum.NUMBER_OF_HOURS)) {
                NewDataSortableColumn columnHourStart = new NewDataSortableColumn();
                columnHourStart.setLabel(_("Start hour"));
                columnHourStart.setSclass("column-hour-start");
                columns.appendChild(columnHourStart);
                NewDataSortableColumn columnHourFinish = new NewDataSortableColumn();
                columnHourFinish.setLabel(_("Finish Hour"));
                columnHourStart.setSclass("column-hour-finish");
                columns.appendChild(columnHourFinish);
            }
        }
        NewDataSortableColumn columnNumHours = new NewDataSortableColumn();
        columnNumHours.setLabel(_("Hours"));
        columnNumHours.setSclass("hours-column");
        columns.appendChild(columnNumHours);
        NewDataSortableColumn columnHoursType = new NewDataSortableColumn();
        columnHoursType.setLabel(_("Hours type"));
        columnHoursType.setSclass("hours-type-column");
        columns.appendChild(columnHoursType);
        NewDataSortableColumn columnFinsihed = new NewDataSortableColumn();
        columnFinsihed.setLabel(_("Done"));
        columnFinsihed.setSclass("finished-column");
        columnFinsihed.setTooltiptext(_("Task finished"));
        NewDataSortableColumn columnCode = new NewDataSortableColumn();
        columns.appendChild(columnFinsihed);
        columnCode.setLabel(_("Code"));
        columnCode.setSclass("code-column");
        columns.appendChild(columnCode);
        NewDataSortableColumn columnOperations = new NewDataSortableColumn();
        columnOperations.setLabel(_("Op."));
        columnOperations.setSclass("operations-column");
        columnOperations.setTooltiptext(_("Operations"));
        columns.appendChild(columnOperations);

        columns.setParent(grid);

    }
View Full Code Here

TOP

Related Classes of org.libreplan.web.common.components.NewDataSortableColumn

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.