com.smartgwt.client.widgets.events.ClickHandler Java Examples

The following examples show how to use com.smartgwt.client.widgets.events.ClickHandler. 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: MenuRightsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Prepares the context menu
 * 
 * @return the context menu
 */
private Menu setupContextMenu() {
	Menu contextMenu = new Menu();

	MenuItem deleteItem = new MenuItem();
	deleteItem.setTitle(I18N.message("ddelete"));
	deleteItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			ListGridRecord[] selection = list.getSelectedRecords();
			if (selection == null || selection.length == 0)
				return;

			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						list.removeSelectedData();
					}
				}
			});
		}
	});

	contextMenu.setItems(deleteItem);
	return contextMenu;
}
 
Example #2
Source File: PreviewPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showReloadPanel() {
	IButton reloadButton = new IButton(I18N.message("reload"));
	reloadButton.setAutoFit(true);
	reloadButton.setSnapTo("C");
	reloadButton.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			redraw();
		}
	});

	reload = new Canvas();
	reload.setWidth100();
	reload.setHeight100();
	reload.setAlign(Alignment.CENTER);
	reload.addChild(reloadButton);

	addMember(reload);
}
 
Example #3
Source File: UserCalendarPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onDraw() {
	ToolStrip toolStrip = new ToolStrip();
	toolStrip.setHeight(20);
	toolStrip.setWidth100();
	toolStrip.addSpacer(2);

	ToolStripButton refresh = new ToolStripButton();
	refresh.setTitle(I18N.message("refresh"));
	toolStrip.addButton(refresh);
	refresh.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			refresh();
		}
	});
	toolStrip.addFill();
	addMember(toolStrip);

	initCalendar();
}
 
Example #4
Source File: PatchPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showContextMenu(ListGrid list) {
	ListGridRecord record = list.getSelectedRecord();
	final GUIPatch patch = new GUIPatch();
	patch.setId(record.getAttribute("id"));
	patch.setName(record.getAttribute("name"));
	patch.setFile(record.getAttribute("file"));
	patch.setDescription(record.getAttribute("description"));
	patch.setSize(record.getAttributeAsLong("size"));
	patch.setDate(record.getAttributeAsDate("date"));
	patch.setInstalled(record.getAttributeAsBoolean("installed"));

	Menu contextMenu = new Menu();

	MenuItem install = new MenuItem();
	install.setTitle(I18N.message("install"));
	install.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			switchDownloadView(patch);
		}
	});
	install.setEnabled(!patch.isInstalled());

	contextMenu.setItems(install);
	contextMenu.showContextMenu();
}
 
Example #5
Source File: BrandingPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void initGUI() {
	tenantBranding = new TenantBrandingPanel(tenant, new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {

		}
	});

	IButton save = new IButton(I18N.message("save"));
	save.setMinWidth(80);
	save.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			if (tenantBranding.validate())
				onSave();
		}
	});

	body.setMembers(tenantBranding);
	addMember(save);
}
 
Example #6
Source File: EmailAccountFiltersPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						list.removeSelectedData();
						changedHandler.onChanged(null);
					}
				}
			});
		}
	});

	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #7
Source File: SessionsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public SessionsPanel() {
	ToolStrip toolStrip = new ToolStrip();
	toolStrip.setHeight(20);
	toolStrip.setWidth100();
	toolStrip.addSpacer(2);
	ToolStripButton refresh = new ToolStripButton(I18N.message("refresh"));
	toolStrip.addButton(refresh);
	refresh.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			list.refresh(new SessionsDS());
		}
	});
	toolStrip.addFill();
	addMember(toolStrip);
}
 
Example #8
Source File: Actions.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
public static ToolStripButton asToolStripButton(final Action action, final Object source) {
    ToolStripButton tsb = new ToolStripButton();
    String title = action.getTitle();
    if (title != null) {
        tsb.setTitle(title);
    }
    String icon = action.getIcon();
    if (icon != null) {
        tsb.setIcon(icon);
    }
    String tooltip = action.getTooltip();
    if (tooltip != null) {
        tsb.setTooltip(tooltip);
    }
    tsb.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            ActionEvent aEvent = new ActionEvent(source);
            action.performAction(aEvent);
        }
    });
    return tsb;
}
 
Example #9
Source File: BarcodeTemplatesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	MenuItem clean = new MenuItem();
	clean.setTitle(I18N.message("ddelete"));
	clean.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						patternsGrid.removeData(patternsGrid.getSelectedRecord());
					}
				}
			});
		}
	});

	contextMenu.setItems(clean);
	contextMenu.showContextMenu();
}
 
Example #10
Source File: MessageLabel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public MessageLabel(final GUIMessage message, boolean showLinks) {
	if (message.getUrl() == null || message.getUrl().isEmpty() || !showLinks)
		setContents("<span>" + message.getMessage() + "</span>");
	else
		setContents("<span style='text-decoration: underline'>" + message.getMessage() + "</span>");
	setHeight(25);
	setWrap(true);
	if (message.getPriority() == GUIMessage.PRIO_INFO)
		setIcon("[SKIN]/Dialog/notify.png");
	else if (message.getPriority() == GUIMessage.PRIO_WARN)
		setIcon("[SKIN]/Dialog/warn.png");
	if (showLinks && message.getUrl() != null && !message.getUrl().isEmpty()) {
		setCursor(Cursor.HAND);
		addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				Window.open(message.getUrl(), "_self", "");
			}
		});
	}
}
 
Example #11
Source File: EventPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private EventPanel() {
	setHeight(20);
	setWidth100();
	setAlign(Alignment.LEFT);
	setMargin(2);
	setMembersMargin(2);

	ToolStripButton log = AwesomeFactory.newIconButton("clipboard-list", "lastevents");
	log.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			EventsWindow.get().show();
			if (statusLabel != null)
				statusLabel.setContents("");
		}
	});

	addMember(log);
}
 
Example #12
Source File: GUIGridsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onDraw() {
	ToolStrip toolbar = new ToolStrip();
	toolbar.setWidth100();
	ToolStripButton save = new ToolStripButton(I18N.message("save"));
	save.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			onSave();
		}
	});
	toolbar.addButton(save);

	SectionStack documentsStack = prepareDocumentsGrid();
	SectionStack searchStack = prepareSearchGrid();
	
	HLayout body = new HLayout();
	body.setMembersMargin(3);
	body.setWidth100();
	body.setHeight100();
	body.setMembers(documentsStack, searchStack);

	setMembers(toolbar, body);
}
 
Example #13
Source File: LoginWindow.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private Canvas createButtons() {
    IButton btnSubmit = new IButton(i18nSgwt.dialog_LoginButtonTitle(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            submitCredentials();
        }
    });

    HStack btnLayout = new HStack(5);
    btnLayout.setAutoHeight();
    btnLayout.setLayoutTopMargin(20);
    btnLayout.setLayoutAlign(Alignment.CENTER);
    btnLayout.setMembers(btnSubmit);
    return btnLayout;
}
 
Example #14
Source File: DigitalObjectSearchView.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private ToolStrip createToolbar() {
    ToolStrip toolbar = Actions.createToolStrip();
    
    IconButton btnFilter = new IconButton();
    btnFilter.setActionType(SelectionType.CHECKBOX);
    btnFilter.setIcon("[SKIN]/actions/filter.png");
    btnFilter.setTitle(i18n.DigitalObjectSearchView_FilterButton_Title());
    btnFilter.setTooltip(i18n.DigitalObjectSearchView_FilterButton_Hint());
    btnFilter.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (filters.isVisible()) {
                filters.hide();
            } else {
                filters.show();
            }
        }
    });
    btnFilter.setSelected(filters.isVisible());

    toolbar.addMember(btnFilter);
    return toolbar;
}
 
Example #15
Source File: FolderTemplatesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	MenuItem clean = new MenuItem();
	clean.setTitle(I18N.message("ddelete"));
	clean.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						grid.removeData(grid.getSelectedRecord());
					}
				}
			});
		}
	});

	contextMenu.setItems(clean);
	contextMenu.showContextMenu();
}
 
Example #16
Source File: Options.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						onDelete();
					}
				}
			});
		}
	});

	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #17
Source File: FolderSecurityPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Prepares the context menu
 * 
 * @return the context menu
 */
private Menu setupContextMenu() {
	Menu contextMenu = new Menu();

	MenuItem deleteItem = new MenuItem();
	deleteItem.setTitle(I18N.message("ddelete"));
	deleteItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			onDeleteItem();
		}
	});

	contextMenu.setItems(deleteItem);
	return contextMenu;
}
 
Example #18
Source File: Dashlet.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Dashlet(GUIDashlet guiDashlet) {
	super();
	this.guiDashlet = guiDashlet;

	setMinHeight(150);
	setMinWidth(100);

	// enable predefined component animation
	setAnimateMinimize(true);

	// Window is draggable with "outline" appearance by default.
	// "target" is the solid appearance.
	setDragAppearance(DragAppearance.OUTLINE);
	setCanDrop(true);

	// show either a shadow, or translucency, when dragging a portlet
	// (could do both at the same time, but these are not visually
	// compatible effects)
	// setShowDragShadow(true);
	setDragOpacity(30);

	setCloseConfirmationMessage(I18N.message("closedashletconfirm"));

	refreshControl = new HeaderControl(HeaderControl.REFRESH, new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			refresh();
		}
	});

	setHeaderControls(HeaderControls.HEADER_LABEL, refreshControl, HeaderControls.MINIMIZE_BUTTON,
			HeaderControls.MAXIMIZE_BUTTON, HeaderControls.CLOSE_BUTTON);

	if (guiDashlet.getTitle() != null && !guiDashlet.getTitle().isEmpty())
		setTitle(AwesomeFactory.getIconHtml("cube", I18N.message(guiDashlet.getTitle())));
	else
		setTitle(AwesomeFactory.getIconHtml("cube", I18N.message(guiDashlet.getName())));
}
 
Example #19
Source File: TemplatesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	final ListGridRecord record = list.getSelectedRecord();
	final long id = Long.parseLong(record.getAttributeAsString("id"));

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						TemplateService.Instance.get().delete(id, new AsyncCallback<Void>() {
							@Override
							public void onFailure(Throwable caught) {
								Log.serverError(caught);
							}

							@Override
							public void onSuccess(Void result) {
								list.removeSelectedData();
								list.deselectAllRecords();
								showTemplateDetails(null);
							}
						});
					}
				}
			});
		}
	});

	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #20
Source File: EditingTabSet.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public EditingTabSet(ClickHandler saveHandler, ClickHandler cancelHandler) {
	saveButton = new Button(I18N.message("save"));
	saveButton.setAutoFit(true);
	saveButton.setMargin(2);
	saveButton.addClickHandler(saveHandler);
	saveButton.setLayoutAlign(VerticalAlignment.CENTER);

	cancelButton = new Button(I18N.message("cancel"));
	cancelButton.setAutoFit(true);
	cancelButton.setMargin(2);
	cancelButton.setLayoutAlign(VerticalAlignment.CENTER);
	cancelButton.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			hideSave();
		}
	});
	if (cancelHandler != null)
		cancelButton.addClickHandler(cancelHandler);

	savePanel = new HLayout();
	savePanel.setHeight(20);
	savePanel.setMembersMargin(5);
	savePanel.setStyleName("warn");
	savePanel.setMembers(saveButton, cancelButton);

	savePanel.hide();

	setTabBarControls(savePanel, TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER);
}
 
Example #21
Source File: RunLevelPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onDraw() {
	ToolStrip toolbar = new ToolStrip();
	toolbar.setWidth100();
	ToolStripButton save = new ToolStripButton(I18N.message("save"));
	save.setDisabled("demo".equals(Session.get().getConfig("runlevel")));
	save.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			onSave();
		}
	});
	currentRunlevel = ItemFactory.newRunlevelSelector();

	toolbar.addFormItem(currentRunlevel);
	toolbar.addSeparator();
	toolbar.addButton(save);

	Layout layout = new VLayout();
	layout.setWidth100();
	layout.setHeight100();
	layout.addMember(toolbar);
	layout.addMember(prepareAspectsTable());

	Tab tab = new Tab();
	tab.setTitle(I18N.message("runlevel"));
	tab.setPane(layout);

	TabSet tabs = new TabSet();
	tabs.setTabs(tab);

	setMembers(tabs);
}
 
Example #22
Source File: WebcontentEditor.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Prepares the popup body
 */
private void prepareBody() {
	editorPanel = new HTMLPane();
	editorPanel.setShowEdges(false);
	editorPanel.setContentsURL(Util.webEditorUrl(document.getId(), document.getFileName(), getHeight() - 230));
	editorPanel.setContentsType(ContentsType.PAGE);

	layout.addMember(editorPanel);

	ToolStrip toolStrip = new ToolStrip();
	toolStrip.setWidth100();
	toolStrip.setAlign(Alignment.RIGHT);
	toolStrip.addFill();

	ToolStripButton close = new ToolStripButton();
	close.setTitle(I18N.message("close"));
	toolStrip.addButton(close);
	toolStrip.addSeparator();
	close.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			unlockAndClose();
		}
	});

	layout.setMembers(toolStrip, editorPanel);
}
 
Example #23
Source File: ChannelsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onDraw() {
	ToolStrip toolStrip = new ToolStrip();
	toolStrip.setHeight(20);
	toolStrip.setWidth100();
	toolStrip.addSpacer(2);
	ToolStripButton refresh = new ToolStripButton();
	refresh.setTitle(I18N.message("refresh"));
	toolStrip.addButton(refresh);
	refresh.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			list.refresh(new ChannelsDS());
		}
	});
	toolStrip.addFill();

	Layout listing = new VLayout();
	setMembers(toolStrip, listing);

	ListGridField name = new ListGridField("name", I18N.message("channel"), 150);
	name.setCanEdit(false);

	ListGridField members = new ListGridField("members", I18N.message("members"));
	members.setCanEdit(false);
	members.setWidth("*");

	list = new RefreshableListGrid();
	list.setEmptyMessage(I18N.message("notitemstoshow"));
	list.setCanEdit(false);
	list.setWidth100();
	list.setHeight100();
	list.setAutoFetchData(true);
	list.setSelectionType(SelectionStyle.SINGLE);
	list.setFields(name, members);
	list.setDataSource(new ChannelsDS());

	listing.addMember(list);
}
 
Example #24
Source File: AutomationRoutinesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	final ListGridRecord record = list.getSelectedRecord();
	final long id = Long.parseLong(record.getAttributeAsString("id"));

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						AutomationService.Instance.get().deleteRoutines(new long[] { id },
								new AsyncCallback<Void>() {
									@Override
									public void onFailure(Throwable caught) {
										Log.serverError(caught);
									}

									@Override
									public void onSuccess(Void result) {
										list.removeSelectedData();
										list.deselectAllRecords();
										showRoutineDetails(null);
									}
								});
					}
				}
			});
		}
	});

	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #25
Source File: AutomationTriggersPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	final ListGridRecord record = list.getSelectedRecord();
	final long id = Long.parseLong(record.getAttributeAsString("id"));

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						AutomationService.Instance.get().deleteTriggers(new long[] { id },
								new AsyncCallback<Void>() {
									@Override
									public void onFailure(Throwable caught) {
										Log.serverError(caught);
									}

									@Override
									public void onSuccess(Void result) {
										list.removeSelectedData();
										list.deselectAllRecords();
										showTriggerDetails(null);
									}
								});
					}
				}
			});
		}
	});

	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #26
Source File: QuotaPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void initGUI() {
	tenantQuota = new TenantQuotaPanel(tenant, new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {

		}
	});

	IButton save = new IButton(I18N.message("save"));
	save.setMinWidth(80);
	save.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			if (tenantQuota.validate())
				TenantService.Instance.get().save(tenant, new AsyncCallback<GUITenant>() {

					@Override
					public void onFailure(Throwable caught) {
						Log.serverError(caught);
					}

					@Override
					public void onSuccess(GUITenant ten) {
						QuotaPanel.this.tenant = ten;
						Log.info(I18N.message("settingssaved"), null);
					}
				});
		}
	});

	body.setMembers(tenantQuota);
	addMember(save);
}
 
Example #27
Source File: DashletsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			DashletService.Instance.get().delete(grid.getSelectedRecord().getAttributeAsLong("id"),
					new AsyncCallback<Void>() {
						@Override
						public void onFailure(Throwable caught) {
							Log.serverError(caught);
						}

						@Override
						public void onSuccess(Void arg) {
							reload();
						}
					});
		}
	});

	delete.setEnabled(!systemDashlets.contains(grid.getSelectedRecord().getAttributeAsString("name")));

	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #28
Source File: ImportArchivesList.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	final ListGridRecord record = list.getSelectedRecord();
	final long id = Long.parseLong(record.getAttributeAsString("id"));

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						ImpexService.Instance.get().delete(id, new AsyncCallback<Void>() {
							@Override
							public void onFailure(Throwable caught) {
								Log.serverError(caught);
							}

							@Override
							public void onSuccess(Void result) {
								list.removeSelectedData();
								list.deselectAllRecords();
								showDetails(null);
							}
						});
					}
				}
			});
		}
	});

	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #29
Source File: IncrementalArchivesList.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void showContextMenu() {
	Menu contextMenu = new Menu();

	final ListGridRecord record = list.getSelectedRecord();
	final long id = Long.parseLong(record.getAttributeAsString("id"));

	MenuItem delete = new MenuItem();
	delete.setTitle(I18N.message("ddelete"));
	delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						ImpexService.Instance.get().deleteIncremental(id, new AsyncCallback<Void>() {
							@Override
							public void onFailure(Throwable caught) {
								Log.serverError(caught);
							}

							@Override
							public void onSuccess(Void result) {
								list.removeSelectedData();
								list.deselectAllRecords();
								showDetails(null);
							}
						});
					}
				}
			});
		}
	});
	contextMenu.setItems(delete);
	contextMenu.showContextMenu();
}
 
Example #30
Source File: VersionsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public VersionsPanel(ExportArchivesList list, final Long archiveId, final boolean readonly) {
	this.archivesList = list;

	final IntegerItem maxItem = ItemFactory.newValidateIntegerItem("max", "", null, 1, null);
	maxItem.setHint(I18N.message("elements"));
	maxItem.setShowTitle(false);
	maxItem.setDefaultValue(100);
	maxItem.setWidth(40);

	toolbar.setWidth100();

	ToolStripButton display = new ToolStripButton();
	display.setTitle(I18N.message("display"));
	toolbar.addButton(display);
	toolbar.addFormItem(maxItem);
	display.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			if (maxItem.validate() && maxItem.getValue() != null) {
				if (maxItem.getValue() instanceof Integer)
					max = (Integer) maxItem.getValue();
				else
					max = Integer.parseInt(maxItem.getValue().toString());
				initListGrid(archiveId, readonly);
			}
		}
	});
	toolbar.addFill();

	addMember(toolbar);
	initListGrid(archiveId, readonly);
}