Java Code Examples for com.google.gwt.user.client.ui.Anchor#setStyleName()

The following examples show how to use com.google.gwt.user.client.ui.Anchor#setStyleName() . 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: UniTimeDialogBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
public UniTimeDialogBox(boolean autoHide, boolean modal) {
      super(autoHide, modal);
      
setAnimationEnabled(true);
setGlassEnabled(true);
	
      iContainer = new FlowPanel();
      iContainer.addStyleName("dialogContainer");
      
      iClose = new Anchor();
  	iClose.setTitle(MESSAGES.hintCloseDialog());
      iClose.setStyleName("close");
      iClose.addClickHandler(new ClickHandler() {
      	@Override
          public void onClick(ClickEvent event) {
              onCloseClick(event);
          }
      });
      iClose.setVisible(autoHide);

      iControls = new FlowPanel();
      iControls.setStyleName("dialogControls");        
      iControls.add(iClose);
  }
 
Example 2
Source File: TractionDialogBox.java    From gwt-traction with Apache License 2.0 6 votes vote down vote up
public TractionDialogBox(boolean autoHide, boolean modal, boolean showCloseIcon) {
super(autoHide, modal, new TractionCaption());

container = new SimplePanel();
container.addStyleName("dialogContainer");

close = new Anchor();
close.setStyleName("x");
close.addClickHandler(new ClickHandler() {
           @Override
           public void onClick(ClickEvent event) {
               onCloseClick(event);
           }
});
setCloseIconVisible(showCloseIcon);

controls = new FlowPanel();
controls.setStyleName("dialogControls");
controls.add(close);

// add the controls to the end of the caption
TractionCaption caption = (TractionCaption) getCaption();
caption.add(controls);
   }
 
Example 3
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Refresh proposed query row
 *
 * @param propose
 */
private void refreshProposedQueryRow(final GWTProposedQueryReceived propose, int row) {
	boolean seen = (propose.getSeenDate() == null);
	// Sets folder object
	data.put(new Integer(dataTable.getHTML(row, 5)), propose);

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

	dataTable.setHTML(row, 1, UtilComunicator.getTextAsBoldHTML(propose.getFrom(), seen));
	String queryType = "";

	if (!propose.getParams().isDashboard()) {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.query");
	} else {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.user.query");
	}

	dataTable.setHTML(row, 2, UtilComunicator.getTextAsBoldHTML(queryType, seen));
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	dataTable.setHTML(row, 3, UtilComunicator.getTextAsBoldHTML(dtf.format(propose.getSentDate()), seen));
	Anchor anchor = new Anchor();
	String queryName = propose.getParams().getQueryName();
	anchor.setHTML(UtilComunicator.getTextAsBoldHTML(queryName, seen));
	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");
	dataTable.setWidget(row, 4, anchor);
}
 
Example 4
Source File: WebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public InstructorCell(ArrayList<String> names, ArrayList<String> emails, String separator) {
	super(null, separator);
	if (names != null && !names.isEmpty()) {
		separator = separator.replace(" ", "&nbsp;");
		for (int i = 0; i < names.size(); i++) {
			String text = names.get(i) + (i + 1 < names.size() ? separator : "");
			String email = (emails != null && i < emails.size() ? emails.get(i) : null);
			if (email != null && !email.isEmpty()) {
				iText += text;
				HorizontalPanel p = new HorizontalPanel();
				p.setStyleName("instructor");
				Anchor a = new Anchor();
				a.setHref("mailto:" + email);
				a.setHTML(new Image(RESOURCES.email()).getElement().getString());
				a.setTitle(MESSAGES.sendEmail(names.get(i)));
				a.setStyleName("unitime-SimpleLink");
				a.addClickHandler(new ClickHandler() {
					public void onClick(ClickEvent event) {
						event.stopPropagation();
					}
				});
				p.add(a);
				p.setCellVerticalAlignment(a, HasVerticalAlignment.ALIGN_MIDDLE);
				HTML h = new HTML(text, false);
				h.getElement().getStyle().setMarginLeft(2, Unit.PX);
				p.add(h);
				iPanel.add(p);
				iContent.add(h);
			} else
				add(text);
		}
	} else {
		add("&nbsp;");
	}
}
 
Example 5
Source File: GwtHyperlinkImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public GwtHyperlinkImpl() {
  setStyleName("ui-hyperlink-root");

  myAnchor = new Anchor();
  myAnchor.setStyleName("ui-hyperlink");

  rebuild();
}
 
Example 6
Source File: StapleTableManager.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * addDocument
 */
public static void addDocument(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
	int row = table.getRowCount();
	final GWTDocument doc = staple.getDoc();

	if (doc.isCheckedOut()) {
		table.setHTML(row, 0, Util.imageItemHTML("img/icon/edit.png"));
	} else if (doc.isLocked()) {
		table.setHTML(row, 0, Util.imageItemHTML("img/icon/lock.gif"));
	} else {
		table.setHTML(row, 0, "&nbsp;");
	}

	// Subscribed is a special case, must add icon with others
	if (doc.isSubscribed()) {
		table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/subscribed.gif"));
	}

	if (doc.isHasNotes()) {
		table.setHTML(row, 0, table.getHTML(row, 0) + Util.imageItemHTML("img/icon/note.gif"));
	}

	table.setHTML(row, 1, Util.mimeImageHTML(doc.getMimeType()));
	Anchor anchor = new Anchor();
	anchor.setHTML(doc.getName());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			String docPath = doc.getPath();
			String path = docPath.substring(0, docPath.lastIndexOf("/"));
			GeneralComunicator.openPath(path, doc.getPath());
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	table.setWidget(row, 2, anchor);
	table.setHTML(row, 3, Util.formatSize(doc.getActualVersion().getSize()));

	if (enableDelete) {
		Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
		delete.setStyleName("okm-KeyMap-ImageHover");
		delete.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
					@Override
					public void onSuccess(Object result) {
						if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
							Stapling.get().refreshFolder(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
							Stapling.get().refreshDocument(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
							Stapling.get().refreshMail(uuid);
						}
					}

					@Override
					public void onFailure(Throwable caught) {
						GeneralComunicator.showError("remove", caught);
					}
				});
			}
		});

		table.setWidget(row, 4, delete);
	} else {
		table.setHTML(row, 4, "");
	}

	table.getCellFormatter().setWidth(row, 0, "60px");
	table.getCellFormatter().setWidth(row, 1, "25px");
	table.getCellFormatter().setWidth(row, 4, "25px");

	table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
	table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
	table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
 
Example 7
Source File: StapleTableManager.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * addFolder
 */
public static void addFolder(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
	int row = table.getRowCount();
	final GWTFolder folder = staple.getFolder();

	// Subscribed is a special case, must add icon with others
	if (folder.isSubscribed()) {
		table.setHTML(row, 0, Util.imageItemHTML("img/icon/subscribed.gif"));
	} else {
		table.setHTML(row, 0, "&nbsp;");
	}

	// Looks if must change icon on parent if now has no childs and properties with user security atention
	if ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) {
		if (folder.isHasChildren()) {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_childs.gif"));
		} else {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_empty.gif"));
		}
	} else {
		if (folder.isHasChildren()) {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_childs_ro.gif"));
		} else {
			table.setHTML(row, 1, Util.imageItemHTML("img/menuitem_empty_ro.gif"));
		}
	}

	Anchor anchor = new Anchor();
	anchor.setHTML(folder.getName());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			GeneralComunicator.openPath(folder.getPath(), null);
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	table.setWidget(row, 2, anchor);
	table.setHTML(row, 3, "&nbsp;");

	if (enableDelete) {
		Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
		delete.setStyleName("okm-KeyMap-ImageHover");
		delete.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
					@Override
					public void onSuccess(Object result) {
						if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
							Stapling.get().refreshFolder(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
							Stapling.get().refreshDocument(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
							Stapling.get().refreshMail(uuid);
						}
					}

					@Override
					public void onFailure(Throwable caught) {
						GeneralComunicator.showError("remove", caught);
					}
				});
			}
		});

		table.setWidget(row, 4, delete);
	} else {
		table.setHTML(row, 4, "");
	}

	table.getCellFormatter().setWidth(row, 0, "60px");
	table.getCellFormatter().setWidth(row, 1, "25px");
	table.getCellFormatter().setWidth(row, 4, "25px");

	table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
	table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
	table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
 
Example 8
Source File: StapleTableManager.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * addMail
 */
public static void addMail(FlexTable table, final GWTStaple staple, final String uuid, boolean enableDelete) {
	int row = table.getRowCount();
	final GWTMail mail = staple.getMail();

	// Mail is never checkout or subscribed ( because can not be changed )
	table.setHTML(row, 0, "&nbsp;");

	if (mail.getAttachments().size() > 0) {
		table.setHTML(row, 1, Util.imageItemHTML("img/email_attach.gif"));
	} else {
		table.setHTML(row, 1, Util.imageItemHTML("img/email.gif"));
	}

	Anchor anchor = new Anchor();
	anchor.setHTML(mail.getSubject());
	anchor.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent arg0) {
			String docPath = mail.getPath();
			String path = docPath.substring(0, docPath.lastIndexOf("/"));
			GeneralComunicator.openPath(path, docPath);
		}
	});
	anchor.setStyleName("okm-KeyMap-ImageHover");
	table.setWidget(row, 2, anchor);
	table.setHTML(row, 3, Util.formatSize(mail.getSize()));


	if (enableDelete) {
		Image delete = new Image(OKMBundleResources.INSTANCE.deleteIcon());
		delete.setStyleName("okm-KeyMap-ImageHover");
		delete.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				staplingService.removeStaple(String.valueOf(staple.getId()), new AsyncCallback<Object>() {
					@Override
					public void onSuccess(Object result) {
						if (staple.getType().equals(GWTStaple.STAPLE_FOLDER)) {
							Stapling.get().refreshFolder(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_DOCUMENT)) {
							Stapling.get().refreshDocument(uuid);
						} else if (staple.getType().equals(GWTStaple.STAPLE_MAIL)) {
							Stapling.get().refreshMail(uuid);
						}
					}

					@Override
					public void onFailure(Throwable caught) {
						GeneralComunicator.showError("remove", caught);
					}
				});
			}
		});

		table.setWidget(row, 4, delete);
	} else {
		table.setHTML(row, 4, "");
	}

	table.getCellFormatter().setWidth(row, 0, "60px");
	table.getCellFormatter().setWidth(row, 1, "25px");
	table.getCellFormatter().setWidth(row, 4, "25px");

	table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT);
	table.getCellFormatter().setHorizontalAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 2, HasHorizontalAlignment.ALIGN_LEFT);
	table.getCellFormatter().setHorizontalAlignment(row, 3, HasHorizontalAlignment.ALIGN_CENTER);
	table.getCellFormatter().setHorizontalAlignment(row, 4, HasHorizontalAlignment.ALIGN_CENTER);
}
 
Example 9
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 10
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Adding proposed subscription sent row
 *
 * @param propose
 */
private void addProposedSubscriptionSentRow(final GWTProposedSubscriptionSent propose) {
	int rows = dataTable.getRowCount();
	dataTable.insertRow(rows);
	// Sets folder object
	data.put(new Integer(dataIndexValue), propose);

	dataTable.setHTML(rows, 0, "");
	dataTable.setHTML(rows, 1, propose.getFrom());
	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, docType);
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	dataTable.setHTML(rows, 3, dtf.format(propose.getSentDate()));

	Anchor anchor = new Anchor();
	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());
			}
		}
	});

	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 11
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Refresh proposed subscription row
 *
 * @param propose
 */
private void refreshProposedSubscriptionRow(final GWTProposedSubscriptionReceived propose, int row) {
	boolean seen = (propose.getSeenDate() == null);
	// Sets folder object
	data.put(new Integer(dataTable.getHTML(row, 5)), propose);

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

	dataTable.setHTML(row, 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(row, 2, UtilComunicator.getTextAsBoldHTML(docType, seen));
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	dataTable.setHTML(row, 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(row, 4, anchor);
}
 
Example 12
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Adding proposed query row
 *
 * @param propose
 */
private void addProposedQueryReceivedRow(final GWTProposedQueryReceived 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 queryType = "";

	if (!propose.getParams().isDashboard()) {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.query");
	} else {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.user.query");
	}

	dataTable.setHTML(rows, 2, UtilComunicator.getTextAsBoldHTML(queryType, 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 queryName = propose.getParams().getQueryName();
	anchor.setHTML(UtilComunicator.getTextAsBoldHTML(queryName, seen));
	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");
	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 13
Source File: ExtendedScrollTable.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Adding proposed query sent row
 *
 * @param propose
 */
private void addProposedQuerySentRow(final GWTProposedQuerySent propose) {
	int rows = dataTable.getRowCount();
	dataTable.insertRow(rows);
	// Sets folder object
	data.put(new Integer(dataIndexValue), propose);

	dataTable.setHTML(rows, 0, "");
	dataTable.setHTML(rows, 1, propose.getFrom());
	String queryType = "";

	if (!propose.getParams().isDashboard()) {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.query");
	} else {
		queryType = GeneralComunicator.i18nExtension("messaging.message.type.propose.user.query");
	}

	dataTable.setHTML(rows, 2, queryType);
	DateTimeFormat dtf = DateTimeFormat.getFormat(GeneralComunicator.i18nExtension("general.date.pattern"));
	dataTable.setHTML(rows, 3, 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");
	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");
	}
}