Java Code Examples for com.google.gwt.i18n.client.DateTimeFormat#getFormat()

The following examples show how to use com.google.gwt.i18n.client.DateTimeFormat#getFormat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Application.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private static void fireNewTimeRangeEvent(TimeRange timeRange) {
    try {
        DateTimeFormat formatter = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.ISO_8601);
        long begin = formatter.parseStrict(timeRange.getStart()).getTime();
        long end = formatter.parseStrict(timeRange.getEnd()).getTime();
        Toaster.getToasterInstance().addMessage("Begin: " + timeRange.getStart());
        Toaster.getToasterInstance().addMessage("End: " + timeRange.getEnd());
        EventBus.getMainEventBus().fireEvent(new DatesChangedEvent(begin, end, true));
    }
    catch (Exception e) {
        if ( !GWT.isProdMode()) {
            GWT.log("Unparsable TimeRange: " + timeRange, e);
        }
    }
}
 
Example 2
Source File: ISO8601.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Format date with format "yyyyMMddHHmmss"
 */
public static String formatBasic(Date value) {
	if (value == null) {
		return null;
	} else {
		DateTimeFormat dtf = DateTimeFormat.getFormat(BASIC_PATTER);
		return dtf.format(value);
	}
}
 
Example 3
Source File: DateTimePickerBase.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
private void setDateTimeFormat(final String format) {
    final StringBuilder fb = new StringBuilder(format);
    for (int i = 0; i < fb.length(); i++) {
        if (DATE_TIME_FORMAT_MAP.containsKey(fb.charAt(i))) {
            fb.setCharAt(i, DATE_TIME_FORMAT_MAP.get(fb.charAt(i)));
        }
    }

    this.dateTimeFormat = DateTimeFormat.getFormat(fb.toString());
}
 
Example 4
Source File: DateTimePickerBase.java    From gwtbootstrap3-extras with Apache License 2.0 5 votes vote down vote up
/**
 * Sets format of the date using GWT notation
 *
 * @param format date time format in GWT notation
 */
public void setGWTFormat(final String format) {
    this.format = toBootstrapDateFormat(format);

    // Get the old value
    final Date oldValue = getValue();

    // Make the new DateTimeFormat
    this.dateTimeFormat = DateTimeFormat.getFormat(format);

    if (oldValue != null) {
        setValue(oldValue);
    }
}
 
Example 5
Source File: MsgPopup.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Add message notification.
 */
public void add(GWTUINotification uin) {
	int row = table.getRowCount();
	DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
	table.setHTML(row, 0, "<b>" + dtf.format(uin.getDate()) + "</b>");
	table.setHTML(row, 1, uin.getMessage());
	table.getCellFormatter().setWidth(row, 1, "100%");
	table.getCellFormatter().setVerticalAlignment(row, 0, HasAlignment.ALIGN_TOP);
	table.getCellFormatter().setVerticalAlignment(row, 1, HasAlignment.ALIGN_TOP);
	table.getCellFormatter().setStyleName(row, 0, "okm-NoWrap");
	if (uin.getId() > lastId) {
		if (uin.getAction() == GWTUINotification.ACTION_LOGOUT) {
			row++;
			int seconds = 240;
			HTML countDown = new HTML(Main.i18n("ui.logout") + " " + secondsToHTML(seconds));
			table.setWidget(row, 0, countDown);
			table.getFlexCellFormatter().setColSpan(row, 0, 2);
			table.getCellFormatter().setHorizontalAlignment(row, 0, HasAlignment.ALIGN_CENTER);
			logout(countDown, seconds);
			show();
		}
		if (uin.isShow()) {
			show();
		}
	}
	evaluateButtons();
}
 
Example 6
Source File: WorkflowDetailTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * addRow
 *
 * @param instanceLogEntry
 */
public void addRow(GWTProcessInstanceLogEntry instanceLogEntry) {
	int rows = dataTable.getRowCount();
	dataTable.insertRow(rows);
	dataTable.setHTML(rows, 0, String.valueOf(instanceLogEntry.getProcessDefinitionId()));
	dataTable.setHTML(rows, 1, instanceLogEntry.getProcessDefinitionName());
	dataTable.setHTML(rows, 2, instanceLogEntry.getToken());
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18n("general.date.pattern"));
	dataTable.setHTML(rows, 3, dtf.format(instanceLogEntry.getDate()));
	dataTable.setHTML(rows, 4, instanceLogEntry.getType());
	dataTable.setHTML(rows, 5, instanceLogEntry.getInfo());
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasAlignment.ALIGN_CENTER);
}
 
Example 7
Source File: MessageReceivedDetail.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * set
 *
 * @param messageReceived
 */
public void set(final GWTMessageReceived messageReceived) {
	from.setHTML(messageReceived.getFrom());
	to.setHTML(messageReceived.getTo());
	docType.setHTML(GeneralComunicator.i18nExtension("messaging.message.type.message.sent"));
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	date.setHTML(dtf.format(messageReceived.getSentDate()));
	table.setHTML(2, 1, messageReceived.getSubject());
	content.setHTML(messageReceived.getContent().replaceAll("\n", "</br>"));
}
 
Example 8
Source File: ProposedQuerySentDetail.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * set
 *
 * @param propose
 */
public void set(final GWTProposedQuerySent propose) {
	from.setHTML(propose.getFrom());
	to.setHTML(propose.getTo());
	String queryType = "";
	if (!propose.getParams().isDashboard()) {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.query");
	} else {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.user.query");
	}
	docType.setHTML(queryType);
	table.setHTML(2, 0, "<b>" + GeneralComunicator.i18nExtension("messaging.detail.query") + "</b>");
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	date.setHTML(dtf.format(propose.getSentDate()));

	Anchor anchor = new Anchor();
	String queryName = propose.getParams().getQueryName();
	anchor.setHTML(queryName);
	anchor.setTitle(queryName);
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			WorkspaceComunicator.changeSelectedTab(UIDockPanelConstants.SEARCH);
			SearchComunicator.setSavedSearch(propose.getParams());
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	Image runImage = new Image(OKMBundleResources.INSTANCE.run());
	HorizontalPanel hPanel = new HorizontalPanel();
	hPanel.add(runImage);
	hPanel.add(anchor);
	hPanel.setCellVerticalAlignment(anchor, HasAlignment.ALIGN_MIDDLE);
	table.setWidget(2, 1, hPanel);

	content.setHTML(propose.getComment().replaceAll("\n", "</br>"));
}
 
Example 9
Source File: MailViewer.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the mail values
 *
 * @param mail The document object
 */
public void set(GWTMail mail) {
	this.mail = mail;

	Anchor hFrom = new Anchor();
	final String mailFrom = mail.getFrom().contains("<") ? mail.getFrom().substring(mail.getFrom().indexOf("<") + 1, mail.getFrom().indexOf(">")) : mail.getFrom();
	hFrom.setHTML(mail.getFrom().replace("<", "&lt;").replace(">", "&gt;"));
	hFrom.setTitle("mailto:" + mailFrom);
	hFrom.setStyleName("okm-Mail-Link");
	hFrom.addStyleName("okm-NoWrap");
	hFrom.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			Window.open("mailto:" + mailFrom, "_blank", "");
		}
	});
	dataTable.setWidget(rowFrom, 1, hFrom);

	dataTable.setHTML(rowSubject, 1, mail.getSubject());
	mailPreview.showContent(mail);

	toPanel.clear();
	for (String mailTo : mail.getTo()) {
		toPanel.add(getMailWidget(mailTo, toPanel));
	}

	ccPanel.clear();
	for (String mailCC : mail.getCc()) {
		ccPanel.add(getMailWidget(mailCC, ccPanel));
	}

	bccPanel.clear();
	for (String mailBCC : mail.getBcc()) {
		bccPanel.add(getMailWidget(mailBCC, bccPanel));
	}

	replyPanel.clear();
	for (String mailReply : mail.getReply()) {
		replyPanel.add(getMailWidget(mailReply, replyPanel));
	}

	sizeValue.setHTML(Util.formatSize(mail.getSize()));
	mimeTypeValue.setHTML(mail.getMimeType());
	DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
	sendValue.setHTML(mail.getSentDate() != null ? dtf.format(mail.getSentDate()) : "");
	sendReceivedValue.setHTML(mail.getReceivedDate() != null ? dtf.format(mail.getReceivedDate()) : "");

	// Enable select
	dataTable.getFlexCellFormatter().setStyleName(rowFrom, 1, "okm-EnableSelect");
	dataTable.getFlexCellFormatter().setStyleName(rowSubject, 1, "okm-EnableSelect");
	dataTable.getFlexCellFormatter().setStyleName(rowTo, 1, "okm-EnableSelect");
	dataTable.getFlexCellFormatter().setStyleName(rowCC, 1, "okm-EnableSelect");
	dataTable.getFlexCellFormatter().setStyleName(rowBCC, 1, "okm-EnableSelect");
	dataTable.getFlexCellFormatter().setStyleName(rowExtra, 1, "okm-EnableSelect");
	dataTable.getFlexCellFormatter().setStyleName(rowReply, 1, "okm-EnableSelect");

	attachmentsList = new HashMap<Integer, GWTDocument>();
	int count = 0;

	attachmentsPanel.clear();
	for (Iterator<GWTDocument> it = mail.getAttachments().iterator(); it.hasNext(); ) {
		final GWTDocument attach = it.next();
		attachmentsList.put(new Integer(count), attach);
		count++;
		attachmentsPanel.add(getAttachmentWidget(attach));
	}
}
 
Example 10
Source File: DateUtils.java    From swellrt with Apache License 2.0 4 votes vote down vote up
private static DateTimeFormat getMonthDayFormat() {
  if (monthDayFormat == null) {
    monthDayFormat = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.MONTH_ABBR_DAY);
  }
  return monthDayFormat;
}
 
Example 11
Source File: TimePickersView.java    From gwt-material-demo with Apache License 2.0 4 votes vote down vote up
@UiHandler("tpValue")
void onTimePickerValue(ValueChangeEvent<Date> e) {
    DateTimeFormat dtf = DateTimeFormat.getFormat("hh:mm a");
    Date time = e.getValue();
    MaterialToast.fireToast("Value : " + dtf.format(time));
}
 
Example 12
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
@Test
@SuppressWarnings("deprecation")
public void shouldBeAbleToFormatDatesWithAmPm() {
  DateTimeFormat formatter = DateTimeFormat.getFormat("yyyy/MM/dd hh:mm:ss a");
  assertEquals("1992/11/09 12:34:56 PM", formatter.format(new Date(92, 10, 9, 12, 34, 56)));
}
 
Example 13
Source File: DashboardWidget.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Setting documents
 *
 * @param docList document list
 */
public void setDocuments(List<GWTDashboardDocumentResult> docList) {
	int documentsNotViewed = 0;
	removeAllRows();

	for (ListIterator<GWTDashboardDocumentResult> it = docList.listIterator(); it.hasNext(); ) {
		int row = table.getRowCount();
		final GWTDashboardDocumentResult dsDocumentResult = it.next();
		final GWTDocument doc = dsDocumentResult.getDocument();
		Anchor docName = new Anchor();
		docName.setText(doc.getName());
		docName.setTitle(doc.getPath());
		docName.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (!dsDocumentResult.isVisited()) {
					markPathAsViewed(doc.getPath());
				}

				visiteNode(source, doc.getUuid(), dsDocumentResult.getDate());
				String docPath = doc.getPath();
				CommonUI.openPath(Util.getParent(docPath), docPath);
			}
		});

		docName.setStyleName("okm-Hyperlink");
		table.setHTML(row, 0, Util.mimeImageHTML(doc.getMimeType()));
		table.setWidget(row, 1, docName);
		DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
		table.setHTML(row, 2, dtf.format(dsDocumentResult.getDate()));
		table.getCellFormatter().setWidth(row, 0, "20px");
		table.getCellFormatter().setWidth(row, 1, "100%"); // Table sets de 100% of space
		table.getCellFormatter().setHorizontalAlignment(row, 2, HasAlignment.ALIGN_RIGHT);
		table.getCellFormatter().setStyleName(row, 2, "okm-NoWrap");

		if (!dsDocumentResult.isVisited()) {
			documentsNotViewed++;
			table.getRowFormatter().setStyleName(row, "okm-NotViewed");
		}
	}

	header.setHeaderNotViewedResults(documentsNotViewed);
	lastDocList = docList; // Saves actual list
}
 
Example 14
Source File: DashboardWidget.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Setting mails
 *
 * @param mailList mail list
 */
public void setMails(List<GWTDashboardMailResult> mailList) {
	int documentsNotViewed = 0;
	removeAllRows();

	for (ListIterator<GWTDashboardMailResult> it = mailList.listIterator(); it.hasNext(); ) {
		int row = table.getRowCount();
		final GWTDashboardMailResult dsMailResult = it.next();
		final GWTMail mail = dsMailResult.getMail();
		Anchor mailName = new Anchor();
		mailName.setText(mail.getSubject());
		mailName.setTitle(mail.getPath());
		mailName.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (!dsMailResult.isVisited()) {
					markPathAsViewed(mail.getPath());
				}

				visiteNode(source, mail.getUuid(), dsMailResult.getDate());
				String mailPath = mail.getPath();
				CommonUI.openPath(Util.getParent(mailPath), mailPath);
			}
		});

		mailName.setStyleName("okm-Hyperlink");
		table.setHTML(row, 0, Util.mimeImageHTML(mail.getMimeType()));
		table.setWidget(row, 1, mailName);
		DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
		table.setHTML(row, 2, dtf.format(dsMailResult.getDate()));
		table.getCellFormatter().setWidth(row, 0, "20px");
		table.getCellFormatter().setWidth(row, 1, "100%"); // Table sets de 100% of space
		table.getCellFormatter().setHorizontalAlignment(row, 2, HasAlignment.ALIGN_RIGHT);
		table.getCellFormatter().setStyleName(row, 2, "okm-NoWrap");

		if (!dsMailResult.isVisited()) {
			documentsNotViewed++;
			table.getRowFormatter().setStyleName(row, "okm-NotViewed");
		}
	}

	header.setHeaderNotViewedResults(documentsNotViewed);
	lastMailList = mailList; // Saves actual list
}
 
Example 15
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Adding proposed subscription received row
 *
 * @param propose
 */
private void addProposedSubscriptionReceivedRow(final GWTProposedSubscriptionReceived propose) {
	int rows = dataTable.getRowCount();
	boolean seen = (propose.getSeenDate() == null);
	dataTable.insertRow(rows);

	// Sets folder object
	data.put(new Integer(dataIndexValue), propose);

	if (propose.isAccepted()) {
		dataTable.setWidget(rows, 0, new Image(OKMBundleResources.INSTANCE.yes()));
	} else {
		dataTable.setHTML(rows, 0, "");
	}

	dataTable.setHTML(rows, 1, UtilComunicator.getTextAsBoldHTML(propose.getFrom(), seen));
	String docType = "";
	if (propose.getType().equals(GWTFolder.TYPE)) {

		docType = GeneralComunicator.i18nExtension("messaging.message.type.propose.folder");
	} else {
		docType = GeneralComunicator.i18nExtension("messaging.message.type.propose.document");
	}
	dataTable.setHTML(rows, 2, UtilComunicator.getTextAsBoldHTML(docType, seen));
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	dataTable.setHTML(rows, 3, UtilComunicator.getTextAsBoldHTML(dtf.format(propose.getSentDate()), seen));

	Anchor anchor = new Anchor();
	String path = propose.getPath().substring(propose.getPath().lastIndexOf("/") + 1);
	anchor.setHTML(UtilComunicator.getTextAsBoldHTML(path, seen));
	anchor.setTitle(propose.getPath());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			if (propose.getType().equals(GWTFolder.TYPE)) {
				GeneralComunicator.openPath(propose.getPath(), null);
			} else if (propose.getType().equals(GWTDocument.TYPE)) {
				String fldPath = propose.getPath().substring(0, propose.getPath().lastIndexOf("/"));
				GeneralComunicator.openPath(fldPath, propose.getPath());
			}
		}
	});

	anchor.setStyleName("okm-KeyMap-ImageHover");
	dataTable.setWidget(rows, 4, anchor);
	dataTable.setHTML(rows, 5, "" + (dataIndexValue++));

	// Format
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_CENTER);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER);
	dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_LEFT);
	dataTable.getCellFormatter().setVisible(rows, 5, false);

	for (int i = 0; i < 5; i++) {
		dataTable.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect");
	}
}
 
Example 16
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public DateEditorValue(PredefinedFormat displayFormat) {
    this.displayFormat = DateTimeFormat.getFormat(displayFormat);
}
 
Example 17
Source File: DashboardWidget.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Setting folders
 *
 * @param folderList folder list
 */
public void setFolders(List<GWTDashboardFolderResult> folderList) {
	int folderNotViewed = 0;
	removeAllRows();
	for (ListIterator<GWTDashboardFolderResult> it = folderList.listIterator(); it.hasNext(); ) {
		int row = table.getRowCount();
		final GWTDashboardFolderResult folderResult = it.next();
		final GWTFolder folder = folderResult.getFolder();

		if ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) {
			if (folder.isHasChildren()) {
				table.setHTML(row, 0, Util.imageItemHTML("img/menuitem_childs.gif"));
			} else {
				table.setHTML(row, 0, Util.imageItemHTML("img/menuitem_empty.gif"));
			}
		} else {
			if (folder.isHasChildren()) {
				table.setHTML(row, 0, Util.imageItemHTML("img/menuitem_childs_ro.gif"));
			} else {
				table.setHTML(row, 0, Util.imageItemHTML("img/menuitem_empty_ro.gif"));
			}
		}

		Anchor folderName = new Anchor();
		folderName.setText(folder.getName());
		folderName.setTitle(folder.getPath());
		folderName.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (!folderResult.isVisited()) {
					markPathAsViewed(folder.getPath());
					visiteNode(source, folder.getUuid(), folderResult.getDate());
				}

				CommonUI.openPath(folder.getPath(), "");
			}
		});

		folderName.setStyleName("okm-Hyperlink");
		table.setWidget(row, 1, folderName);
		DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
		table.setHTML(row, 2, dtf.format(folder.getCreated()));
		table.getCellFormatter().setWidth(row, 0, "20px");
		table.getCellFormatter().setWidth(row, 1, "100%"); // Table sets de 100% of space
		table.getCellFormatter().setHorizontalAlignment(row, 2, HasAlignment.ALIGN_RIGHT);
		table.getCellFormatter().setStyleName(row, 2, "okm-NoWrap");
		if (!folderResult.isVisited()) {
			folderNotViewed++;
			table.getRowFormatter().setStyleName(row, "okm-NotViewed");
		}
	}

	header.setHeaderNotViewedResults(folderNotViewed);
	lastFolderList = folderList;
}
 
Example 18
Source File: Header.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private TimeRange createTimeRange() {
    Date start = new Date(TimeManager.getInst().getBegin());
    Date end = new Date(TimeManager.getInst().getEnd());
    DateTimeFormat format = DateTimeFormat.getFormat(ISO_8601);
    return TimeRange.createTimeRange(format.format(start), format.format(end));
}
 
Example 19
Source File: ProposedSubscriptionReceivedDetail.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * set
 *
 * @param propose
 */
public void set(final GWTProposedSubscriptionReceived propose) {
	this.propose = propose;
	from.setHTML(propose.getFrom());
	to.setHTML(propose.getTo());

	if (propose.getType().equals(GWTFolder.TYPE)) {
		docType.setHTML(GeneralComunicator.i18nExtension("messaging.message.type.propose.folder"));
		table.setHTML(2, 0, "<b>" + GeneralComunicator.i18nExtension("messaging.detail.folder") + "</b>");
	} else {
		docType.setHTML(GeneralComunicator.i18nExtension("messaging.message.type.propose.document"));
		table.setHTML(2, 0, "<b>" + GeneralComunicator.i18nExtension("messaging.detail.document") + "</b>");
	}

	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	date.setHTML(dtf.format(propose.getSentDate()));
	String path = propose.getPath().substring(propose.getPath().lastIndexOf("/") + 1);
	anchor.setHTML(path);
	anchor.setTitle(propose.getPath());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			if (propose.getType().equals(GWTFolder.TYPE)) {
				GeneralComunicator.openPath(propose.getPath(), null);
			} else if (propose.getType().equals(GWTDocument.TYPE)) {
				String fldPath = propose.getPath().substring(0, propose.getPath().lastIndexOf("/"));
				GeneralComunicator.openPath(fldPath, propose.getPath());
			}
		}
	});

	content.setHTML(propose.getComment().replaceAll("\n", "</br>"));
	button.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			MessagingToolBarBox.get().messageDashboard.messageBrowser.messageDetail.status.setFlag_addSubscription();
			notifyService.subscribe(propose.getPath(), callbackAddSubscription);
		}
	});

	button.setVisible(!propose.isAccepted());
	subscribed.setVisible(propose.isAccepted());
}
 
Example 20
Source File: Mail.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * set
 *
 * @param mail
 */
public void set(GWTMail mail) {
	this.mail = mail;

	HorizontalPanel hPanel = new HorizontalPanel();
	hPanel.add(new HTML(mail.getUuid()));
	hPanel.add(Util.hSpace("3px"));
	hPanel.add(new Clipboard(mail.getUuid()));

	tableProperties.setWidget(0, 1, hPanel);
	tableProperties.setHTML(1, 1, mail.getSubject());
	tableProperties.setHTML(2, 1, mail.getParentPath());
	tableProperties.setHTML(3, 1, Util.formatSize(mail.getSize()));
	DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
	tableProperties.setHTML(4, 1, dtf.format(mail.getCreated()) + " " + Main.i18n("mail.by") + " " + mail.getAuthor());
	tableProperties.setHTML(6, 1, mail.getMimeType());
	tableProperties.setWidget(7, 1, keywordManager.getKeywordPanel());

	// Enable select
	tableProperties.getFlexCellFormatter().setStyleName(0, 1, "okm-EnableSelect");
	tableProperties.getFlexCellFormatter().setStyleName(1, 1, "okm-EnableSelect");
	tableProperties.getFlexCellFormatter().setStyleName(2, 1, "okm-EnableSelect");

	// URL clipboard button
	String url = Main.get().workspaceUserProperties.getApplicationURL();
	url += "?uuid=" + URL.encodeQueryString(URL.encodeQueryString(mail.getUuid()));
	tableProperties.setWidget(8, 1, new Clipboard(url));

	// Webdav button
	String webdavUrl = Main.get().workspaceUserProperties.getApplicationURL();
	String webdavPath = mail.getPath();

	// Replace only in case webdav fix is enabled
	if (Main.get().workspaceUserProperties.getWorkspace() != null && Main.get().workspaceUserProperties.getWorkspace().isWebdavFix()) {
		webdavPath = webdavPath.replace("okm:", "okm_");
	}

	// Login case write empty folder
	if (!webdavUrl.isEmpty()) {
		webdavPath = Util.encodePathElements(webdavPath);
		webdavUrl = webdavUrl.substring(0, webdavUrl.lastIndexOf('/')) + "/webdav" + webdavPath;
	}

	tableProperties.setWidget(9, 1, new Clipboard(webdavUrl));

	remove = ((mail.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE);

	// Enables or disables change keywords with user permissions and document is not check-out or locked
	if (remove) {
		keywordManager.setVisible(true);
		categoryManager.setVisible(true);
	} else {
		keywordManager.setVisible(false);
		categoryManager.setVisible(false);
	}

	// Sets wordWrap for al rows
	for (int i = 0; i < 8; i++) {
		setRowWordWarp(i, 1, true, tableProperties);
	}

	// keywords
	keywordManager.reset();
	keywordManager.setObject(mail, remove);
	keywordManager.drawAll();

	// Categories
	categoryManager.removeAllRows();
	categoryManager.setObject(mail, remove);
	categoryManager.drawAll();
}