Search in sources :

Example 11 with DateTimeFormat

use of com.google.gwt.i18n.client.DateTimeFormat in project pentaho-platform by pentaho.

the class GeneralPanel method init.

/**
 */
public void init() {
    nameLabel.setText(fileSummary.getTitle());
    typeLabel.setText(fileSummary.isFolder() ? Messages.getString("folder") : // $NON-NLS-1$//$NON-NLS-2$
    fileSummary.getName().substring(fileSummary.getName().lastIndexOf(".")));
    // $NON-NLS-1$//$NON-NLS-2$
    sourceLabel.setText(isInTrash ? Messages.getString("recycleBin") : fileSummary.getPath());
    locationLabel.setText(isInTrash ? Messages.getString("recycleBin") : // $NON-NLS-1$//$NON-NLS-2$
    fileSummary.getPath().substring(0, fileSummary.getPath().lastIndexOf("/")));
    sizeLabel.setText(NumberFormat.getDecimalFormat().format(fileSummary.getFileSize() / 1000.00) + " " + // $NON-NLS-1$ //$NON-NLS-2$\
    Messages.getString("kiloBytes"));
    DateTimeFormat df = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_FULL);
    createdLabel.setText(df.format(fileSummary.getCreatedDate()));
    lastModifiedDateLabel.setText(fileSummary.getLastModifiedDate() == null ? df.format(fileSummary.getCreatedDate()) : df.format(fileSummary.getLastModifiedDate()));
    // $NON-NLS-1$
    deletedDateLabel.setText(fileSummary.getDeletedDate() == null ? "" : fileSummary.getDeletedDate().toString());
    originalLocationLabel.setText(fileSummary.getOriginalParentFolderPath());
}
Also used : DateTimeFormat(com.google.gwt.i18n.client.DateTimeFormat)

Example 12 with DateTimeFormat

use of com.google.gwt.i18n.client.DateTimeFormat in project ovirt-engine by oVirt.

the class MainSessionView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<UserSession> sessionDbIdColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return Long.toString(session.getId());
        }
    };
    sessionDbIdColumn.makeSortable(SessionConditionFieldAutoCompleter.SESSION_DB_ID);
    // $NON-NLS-1$
    getTable().addColumn(sessionDbIdColumn, constants.sessionDbId(), "100px");
    AbstractTextColumn<UserSession> userNameColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getUserName();
        }
    };
    userNameColumn.makeSortable(SessionConditionFieldAutoCompleter.USER_NAME);
    // $NON-NLS-1$
    getTable().addColumn(userNameColumn, constants.userNameUser(), "200px");
    AbstractTextColumn<UserSession> authzNameColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getAuthzName();
        }
    };
    authzNameColumn.makeSortable(SessionConditionFieldAutoCompleter.AUTHZ_NAME);
    // $NON-NLS-1$
    getTable().addColumn(authzNameColumn, constants.authorizationProvider(), "300px");
    AbstractTextColumn<UserSession> userIdColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getUserId().toString();
        }
    };
    userIdColumn.makeSortable(SessionConditionFieldAutoCompleter.USER_ID);
    // $NON-NLS-1$
    getTable().addColumn(userIdColumn, constants.userId(), "200px");
    AbstractTextColumn<UserSession> sourceIpColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getSourceIp();
        }
    };
    sourceIpColumn.makeSortable(SessionConditionFieldAutoCompleter.SOURCE_IP);
    // $NON-NLS-1$
    getTable().addColumn(sourceIpColumn, constants.sourceIp(), "200px");
    final DateTimeFormat dateFormat = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM);
    AbstractTextColumn<UserSession> sessionStartColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getSessionStartTime() == null ? // $NON-NLS-1$
            "" : dateFormat.format(session.getSessionStartTime());
        }
    };
    sessionStartColumn.makeSortable(Comparator.comparing(UserSession::getSessionStartTime));
    // $NON-NLS-1$
    getTable().addColumn(sessionStartColumn, constants.sessionStartTime(), "200px");
    AbstractTextColumn<UserSession> sessionLastActiveColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getSessionLastActiveTime() == null ? // $NON-NLS-1$
            "" : dateFormat.format(session.getSessionLastActiveTime());
        }
    };
    sessionLastActiveColumn.makeSortable(Comparator.comparing(UserSession::getSessionLastActiveTime));
    // $NON-NLS-1$
    getTable().addColumn(sessionLastActiveColumn, constants.sessionLastActiveTime(), "200px");
}
Also used : UserSession(org.ovirt.engine.core.common.businessentities.UserSession) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DateTimeFormat(com.google.gwt.i18n.client.DateTimeFormat)

Aggregations

DateTimeFormat (com.google.gwt.i18n.client.DateTimeFormat)12 Date (java.util.Date)6 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)2 FieldEvent (com.extjs.gxt.ui.client.event.FieldEvent)1 DateWrapper (com.extjs.gxt.ui.client.util.DateWrapper)1 LabelToolItem (com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem)1 RangeInfo (com.google.gerrit.client.RangeInfo)1 BlameInfo (com.google.gerrit.client.blame.BlameInfo)1 JsArrayString (com.google.gwt.core.client.JsArrayString)1 TableCellElement (com.google.gwt.dom.client.TableCellElement)1 Request (com.google.gwt.http.client.Request)1 RequestBuilder (com.google.gwt.http.client.RequestBuilder)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 JSONObject (com.google.gwt.json.client.JSONObject)1 JSONString (com.google.gwt.json.client.JSONString)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1 AbstractHeaderOrFooterBuilder (com.google.gwt.user.cellview.client.AbstractHeaderOrFooterBuilder)1