com.smartgwt.client.types.Alignment Java Examples

The following examples show how to use com.smartgwt.client.types.Alignment. 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: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets widget to zoom image in the preview panel.
 * @return
 */
public Canvas getPreviewZoomer() {
    SelectItem zoomItem = createZoomForm();
    zoomItem.addChangedHandler(new ChangedHandler() {

        @Override
        public void onChanged(ChangedEvent event) {
            onZoomChange(event);
        }
    });
    DynamicForm form = new DynamicForm();
    form.setValuesManager(zoomValues);
    form.setFields(zoomItem);
    form.setLayoutAlign(Alignment.CENTER);
    return form;
}
 
Example #2
Source File: CreateSimpleRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private void setEntryOperatorRuleItem() {
    this.entryOperatorItem = new SelectItem();
    this.entryOperatorItem.setWidth(this.entryItemWidth);
    this.entryOperatorItem.setTitle(i18n.operator());
    this.entryOperatorItem.setTitleOrientation(TitleOrientation.TOP);
    this.entryOperatorItem.setValueMap(getMathSymbols());
    this.entryOperatorItem.setDefaultValue(">");
    this.entryOperatorItem.setTextAlign(Alignment.CENTER);
    this.entryOperatorItem.addChangedHandler(new ChangedHandler() {
        public void onChanged(ChangedEvent event) {
            if (exitOperatorItem != null) {
                TextItem exitOperatorTextItem = (TextItem) event.getSource();
                exitOperatorItem.setValue(getInverse(exitOperatorTextItem.getValueAsString()));
            }
        }
    });
}
 
Example #3
Source File: StationSelector.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createInfoWindow() {
	VLayout layout = new VLayout();
	layout.addMember(createInformationFieldForSelectedStation());
	HLayout buttons = new HLayout();
	buttons.setAutoHeight();
	buttons.setAlign(Alignment.RIGHT);
       buttons.addMember(createApplyCancelCanvas());
       layout.addMember(buttons);

	infoWindow = new InteractionWindow(layout);
	infoWindow.setZIndex(1000000);
	infoWindow.setWidth(300);
	infoWindow.setHeight(300);
	setInfoWindowPosition();
	infoWindow.hide();
	return infoWindow;
}
 
Example #4
Source File: OwnRulesListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createEditRuleButton(final ListGridRecord ruleRecord) {
    // subscribe button
    IButton editButton = new IButton(i18n.edit());
    editButton.setShowDown(false);
    editButton.setShowRollOver(false);
    editButton.setLayoutAlign(Alignment.CENTER);
    editButton.setPrompt(i18n.editThisRule());
    editButton.setHeight(16);
    editButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String name = ruleRecord.getAttribute(NAME);
            EventBus.getMainEventBus().fireEvent(new GetAllPublishedRulesEvent(currentSession(), 1));
            EventBus.getMainEventBus().fireEvent(new EditRuleEvent(name));
        }
    });

    return editButton;
}
 
Example #5
Source File: OwnRulesListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createDeleteRuleButtonm(final ListGridRecord ruleRecord) {
    IButton deleteButton = new IButton(i18n.delete());
    deleteButton.setShowDown(false);
    deleteButton.setShowRollOver(false);
    deleteButton.setLayoutAlign(Alignment.CENTER);
    deleteButton.setPrompt(i18n.deleteThisRule());
    deleteButton.setHeight(16);
    deleteButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            SC.ask(i18n.reallyDeleteRule(), new BooleanCallback() {
                public void execute(Boolean value) {
                    if (value) {
                        String uuid = ruleRecord.getAttribute(UUID);
                        String userRole = getLoggedInUserRole();
                        EventBus.getMainEventBus().fireEvent(new DeleteRuleEvent(currentSession(), uuid, userRole));
                    }
                }
            });
        }
    });
    return deleteButton;
}
 
Example #6
Source File: UserHistoryPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onDraw() {
	ListGridField event = new ListGridField("event", I18N.message("event"), 200);
	ListGridField date = new ListGridField("date", I18N.message("date"), 110);
	date.setAlign(Alignment.CENTER);
	date.setType(ListGridFieldType.DATE);
	date.setCellFormatter(new DateCellFormatter(false));
	date.setCanFilter(false);
	ListGridField comment = new ListGridField("comment", I18N.message("comment"));
	ListGridField sid = new ListGridField("sid", I18N.message("sid"), 200);
	ListGridField ip = new ListGridField("ip", I18N.message("ip"), 100);

	ListGrid listGrid = new ListGrid();
	listGrid.setEmptyMessage(I18N.message("notitemstoshow"));
	listGrid.setCanFreezeFields(true);
	listGrid.setAutoFetchData(true);
	listGrid.setDataSource(new UserHistoryDS(userId));
	listGrid.setFields(event, date, ip, sid, comment);
	addMember(listGrid);
}
 
Example #7
Source File: OwnRulesListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createPublishRuleButton(final ListGridRecord ruleRecord) {
    IButton publishButton = new IButton(i18n.publishButton());
    publishButton.setShowDown(false);
    publishButton.setShowRollOver(false);
    publishButton.setLayoutAlign(Alignment.CENTER);
    publishButton.setHeight(16);
    publishButton.setAutoFit(true);

    final boolean published = ruleRecord.getAttributeAsBoolean(PUBLISHED);
    if (published) {
        publishButton.setTitle(i18n.unpublishButton());
        publishButton.setPrompt(i18n.cancelPublication());
    } else {
        publishButton.setTitle(i18n.publishButton());
        publishButton.setPrompt(i18n.publishThisRule());
    }

    publishButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String ruleName = ruleRecord.getAttribute(NAME);
            EventBus.getMainEventBus().fireEvent(new PublishRuleEvent(currentSession(), ruleName, !published, "USER"));
        }
    });

    return publishButton;
}
 
Example #8
Source File: KeystoreUploader.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void prepareForm() {
	form = new DynamicForm();
	form.setWidth100();
	form.setAlign(Alignment.LEFT);
	form.setColWidths("1px, 100%");
	vm = new ValuesManager();
	form.setValuesManager(vm);

	TextItem localCAalias = ItemFactory.newSimpleTextItem("localCAalias", "localcaalias",
			keystorePanel.getKeystore() != null ? keystorePanel.getKeystore().getOrganizationAlias() : null);
	localCAalias.setRequired(true);
	localCAalias.setSelectOnFocus(true);
	localCAalias.setWrapTitle(false);

	TextItem password = ItemFactory.newPasswordItem("password", "keystorepasswd",
			keystorePanel.getKeystore() != null ? keystorePanel.getKeystore().getPassword() : null);
	password.setRequired(false);
	password.setWrapTitle(false);

	form.setItems(localCAalias, password);
}
 
Example #9
Source File: AllRulesListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
protected Canvas createEditRuleButton(final ListGridRecord ruleRecord) {
    String userID = getLoggedInUser();
    String ruleOwnerID = ruleRecord.getAttribute(OWNERID);
    if (ruleOwnerID.equals(userID)) {
        IButton editButton = new IButton(i18n.edit());
        editButton.setShowDown(false);
        editButton.setShowRollOver(false);
        editButton.setLayoutAlign(Alignment.CENTER);
        editButton.setPrompt(i18n.editThisRule());
        editButton.setHeight(16);
        editButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String name = ruleRecord.getAttribute(NAME);
                EventBus.getMainEventBus().fireEvent(new EditRuleEvent(name));
            }
        });
        return editButton;
    } else {
        return null;
    }
}
 
Example #10
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
         * Shows a resource as the {@code <img>} element.
         */
        public void loadImage(String url) {
            ClientUtils.setMembers(display, imgContainer);
            image = new Image();
            image.addLoadHandler(this);
            image.addErrorHandler(this);
            image.setUrl(url);
            drawHandler = imgContainer.addDrawHandler(this);
            resizedHandler = imgContainer.addResizedHandler(this);
            ClientUtils.fine(LOG, "loadImage url: %s, width: %s", url, image.getWidth());
            if (image.getWidth() == 0) {
                WidgetCanvas widgetCanvas = new WidgetCanvas(image);
                widgetCanvas.setVisible(false);
                widgetCanvas.setWidth(1);
                widgetCanvas.setHeight(1);
                widgetCanvas.draw();
                Img loadingImg = new Img("[SKIN]/loadingSmall.gif", 16, 16);
//                Img loadingImg = new Img("[SKIN]/shared/progressCursorTracker.gif", 16, 16);
                loadingImg.setAltText(i18n.ImportBatchDataSource_State_LOADING());
                loadingImg.setPrompt(i18n.ImportBatchDataSource_State_LOADING());
                loadingImg.setLayoutAlign(Alignment.CENTER);
                imgContainer.setMembers(loadingImg, widgetCanvas);
            }
            scheduleForRender();
        }
 
Example #11
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets widget to zoom image in the window.
 * @return
 */
public Canvas getWindowZoomer() {
    SelectItem zoomItem = createZoomForm();
    zoomItem.setHeight(15);
    zoomItem.setPickerIconSrc("[SKIN]/headerIcons/zoom.png");
    zoomItem.setPickerIconHeight(15);
    zoomItem.setPickerIconWidth(15);
    zoomItem.addChangedHandler(new ChangedHandler() {

        @Override
        public void onChanged(ChangedEvent event) {
            onZoomChange(event);
        }
    });
    DynamicForm form = new DynamicForm();
    form.setValuesManager(zoomValues);
    form.setFields(zoomItem);
    form.setLayoutAlign(Alignment.CENTER);
    return form;
}
 
Example #12
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
public DigitalObjectPreview(ClientMessages i18n) {
    this.i18n = i18n;
    zoomValues = new ValuesManager();
    zoomValues.setValue(FIELD_ZOOM, Zoom.FIT_PANEL);
    VLayout imgContainer = new VLayout();
    imgContainer.setAlign(Alignment.CENTER);

    windowContainer = new VLayout();
    windowContainer.setAlign(Alignment.CENTER);
    windowContainer.setWidth100();
    windowContainer.setHeight100();
    imageWindow = createFullImageWindow(windowContainer);

    previewLayout = new VLayout();
    previewLayout.setBackgroundColor(BACKGROUND_COLOR);
    previewLayout.addMember(imgContainer);
    previewLoadTask = new ImageLoadTask(imgContainer,
            new Zoom(zoomValues.getValueAsString(FIELD_ZOOM)), false, i18n);
}
 
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: DocumentsPreviewPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public DocumentsPreviewPanel() {
	setAlign(Alignment.CENTER);
	selectLabel = new Label("&nbsp;" + selectLabelString);
	selectLabel.setOverflow(Overflow.HIDDEN);
	
	setInitialSize();
	reset();
	
	addResizedHandler(new ResizedHandler() {
		@Override
		public void onResized(ResizedEvent event) {
			if ("true".equals(Session.get().getConfig("gui.preview.openpanel")))
				Offline.put(widthCookieName, getWidthAsString());
		}
	});
}
 
Example #15
Source File: ExportAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private final DynamicForm createOptionsForm() {
    DynamicForm f = new DynamicForm();
    f.setAutoHeight();
    f.setLayoutAlign(Alignment.CENTER);
    f.setWidth(350);

    formItems = createExportFormOptions();

    if (formItems == null || formItems.isEmpty()) {
        return null;
    }

    FormItem fields[] = new FormItem[formItems.size()];

    for (int i = 0; i < formItems.size(); i++) {
        fields[i] = formItems.get(i);
        formItems.get(i);
    }

    f.setFields(fields);

    return f;
}
 
Example #16
Source File: SessionTimeout.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private SessionTimeout() {
	setShowEdges(false);
	setShowHeader(false);
	centerInPage();
	setIsModal(true);
	setVertical(true);
	setAlign(Alignment.CENTER);
	setMargin(2);
	setMembersMargin(0);
	setBodyColor("white");
	setBackgroundColor("white");
	setOverflow(Overflow.HIDDEN);
	setHeight100();
	setWidth100();

	Label message = new Label(I18N.message("sessiontimeout"));
	message.setWrap(false);
	message.setAlign(Alignment.CENTER);
	message.setStyleName("sessiontimeout");
	message.setLayoutAlign(Alignment.CENTER);
	message.setLayoutAlign(VerticalAlignment.CENTER);
	message.setHeight(50);
	message.setBackgroundColor("white");

	addMember(message);
}
 
Example #17
Source File: FeatureDisabled.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public FeatureDisabled(Integer feature) {
	Label label = null;
	if (feature == null)
		label = new MessageLabel(new GUIMessage("<b>" + I18N.message("featuredisabled") + "</b>",
				GUIMessage.PRIO_WARN), false);
	else
		label = new MessageLabel(new GUIMessage("<b>" + I18N.message("feature_" + feature) + " "
				+ I18N.message("disabled") + "</b>", GUIMessage.PRIO_WARN), false);
	new Label();
	label.setHeight(30);
	label.setPadding(10);
	label.setAlign(Alignment.CENTER);
	label.setValign(VerticalAlignment.CENTER);
	label.setShowEdges(false);

	addMember(label);
}
 
Example #18
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 #19
Source File: StatsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onDraw() {
	SystemService.Instance.get().getStatistics(I18N.getLocale(), new AsyncCallback<GUIParameter[][]>() {

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

		@Override
		public void onSuccess(GUIParameter[][] parameters) {
			Label lastUpdateLabel = new Label("<b>" + I18N.message("lastupdate") + ": "
					+ parameters[3][0].getValue() + "</b>");
			lastUpdateLabel.setHeight(30);
			lastUpdateLabel.setAlign(Alignment.RIGHT);

			StatsPie charts = new StatsPie(parameters);

			setMembers(lastUpdateLabel, charts);
		}
	});
}
 
Example #20
Source File: PopupMessage.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public PopupMessage(String title, String messageText) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(title);
	setAlign(Alignment.CENTER);
	setAutoSize(true);
	centerInPage();
	
	Label label=new Label(messageText);
	label.setMinWidth(350);
	
	VLayout layout= new VLayout();
	layout.setMembersMargin(2);
	layout.setMembers(label);
	
	addItem(layout);
	
	Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

		@Override
		public boolean execute() {
			PopupMessage.this.destroy();
			return false;
		}
	}, Session.get().getConfigAsInt("gui.popup.timeout") * 1000);
}
 
Example #21
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 #22
Source File: Legend.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void createExportLoadingSpinner() {
    this.exportLoadingSpinner = new HLayout();
    Img spinner = new Img("../img/mini_loader_bright.gif", 43, 11);
    // this.exportLoadingSpinner.setWidth100();
    // this.exportLoadingSpinner.setHeight100();
    this.exportLoadingSpinner.setAlign(Alignment.CENTER);
    this.exportLoadingSpinner.addMember(spinner);
    this.exportLoadingSpinner.hide();
}
 
Example #23
Source File: PreviewTile.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public PreviewTile(final long docId, final String title) {
	this.docId = docId;
	this.title = title;
	setMembersMargin(1);
	setAlign(Alignment.RIGHT);
	setOverflow(Overflow.HIDDEN);

	init();
}
 
Example #24
Source File: HtmlItemEditor.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() {
	setSavedHtmlContent(item.getValue() != null ? item.getValue().toString() : "");

	editorPanel = new HTMLPane();
	editorPanel.setID("htmlEditorPanel");
	editorPanel.setShowEdges(false);
	editorPanel.setContentsURL(Util.webEditorUrl(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);
	close.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onClose();
		}
	});

	layout.setMembers(toolStrip, editorPanel);
}
 
Example #25
Source File: StationSelector.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private ApplyCancelButtonLayout createApplyCancelCanvas() {
    if (applyCancel == null) {
        applyCancel = new ApplyCancelButtonLayout();
        applyCancel.createApplyButton(i18n.addNewTimeseries(), i18n.addNewTimeseriesExt(), createApplyHandler());
        applyCancel.createCancelButton(i18n.cancel(), i18n.cancel(), createCancelHandler());
        applyCancel.setAlign(Alignment.RIGHT);
    }
    return applyCancel;
}
 
Example #26
Source File: ContactingServer.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ContactingServer() {
	setHeaderControls(HeaderControls.HEADER_LABEL);
	setTitle(" ");
	setCanDragResize(false);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);
	setShowStatusBar(false);
	setBodyColor("white");
	setMembersMargin(0);

	HTMLFlow message = new HTMLFlow(AwesomeFactory.getSpinnerIconHtml("pulse", I18N.message("contactingserver")));
	message.setAlign(Alignment.CENTER);
	message.setStyleName("contactingserver");
	message.setLayoutAlign(Alignment.CENTER);
	message.setLayoutAlign(VerticalAlignment.CENTER);
	message.setBackgroundColor("white");
	message.setHeight(50);
	
	
	VLayout container = new VLayout();
	container.setWidth100();
	container.setMembersMargin(5);
	container.setMargin(3);
	container.setAlign(Alignment.CENTER);
	container.setDefaultLayoutAlign(Alignment.CENTER);
	container.setMembers(message);
	
	addItem(container);
}
 
Example #27
Source File: ApplicationRestarting.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ApplicationRestarting() {
	setHeaderControls(HeaderControls.HEADER_LABEL);
	setTitle(" ");
	setCanDragResize(false);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);
	setShowStatusBar(false);
	setBodyColor("white");
	setMembersMargin(0);

	messageFlow = new HTMLFlow();
	messageFlow.setAlign(Alignment.CENTER);
	messageFlow.setStyleName("contactingserver");
	messageFlow.setLayoutAlign(Alignment.CENTER);
	messageFlow.setLayoutAlign(VerticalAlignment.CENTER);
	messageFlow.setBackgroundColor("white");
	messageFlow.setHeight(50);

	VLayout container = new VLayout();
	container.setWidth100();
	container.setMembersMargin(5);
	container.setMargin(3);
	container.setAlign(Alignment.CENTER);
	container.setDefaultLayoutAlign(Alignment.CENTER);
	container.setMembers(messageFlow);

	addItem(container);
}
 
Example #28
Source File: ToastNotification.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ToastNotification(String messageText) {
	setShowEdges(false);
	setShowHeader(false);
	setShowHeaderBackground(false);
	setShowHeaderIcon(false);
	setShowResizer(false);
	setShowFooter(false);
	setShowTitle(false);
	setAlign(Alignment.CENTER);
	setMargin(0);
	setMembersMargin(3);
	setPadding(0);
	setBodyColor("white");
	setBackgroundColor("white");
	setBorder("1px solid DarkBlue");
	setOverflow(Overflow.HIDDEN);
	setAutoSize(true);
	centerInPage();
	setVertical(true);

	HTMLFlow message = new HTMLFlow(AwesomeFactory.getIconHtml("info-circle", messageText));
	message.setAlign(Alignment.CENTER);
	message.setStyleName("contactingserver");
	message.setLayoutAlign(Alignment.CENTER);
	message.setLayoutAlign(VerticalAlignment.CENTER);
	message.setBackgroundColor("white");
	message.setHeight(50);

	addItem(message);

	Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

		@Override
		public boolean execute() {
			ToastNotification.this.destroy();
			return false;
		}
	}, Session.get().getConfigAsInt("gui.popup.timeout") * 1000);
}
 
Example #29
Source File: OtherUserRulesListGrid.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {

    if (record != null) {
        String fieldName = this.getFieldName(colNum);

       if (fieldName.equals(EditRulesLayout.EDIT_RULES_COPY)) {
            // Copy button
            IButton copyButton = new IButton(i18n.copy());
            copyButton.setShowDown(false);
            copyButton.setShowRollOver(false);
            copyButton.setHeight(17);
            copyButton.setLayoutAlign(Alignment.CENTER);
            copyButton.setAlign(Alignment.CENTER);
            copyButton.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    System.out.println("copy " + record.getAttribute("name"));
                    String userID = getLoggedInUserId();
                    EventBus.getMainEventBus().fireEvent(new CopyEvent(userID, record.getAttribute("name")));
                }
            });
            return copyButton;
        }
    return null;
    }
    return null;
}
 
Example #30
Source File: DiagramTab.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public DragLabel() {
    setAlign(Alignment.CENTER);
    setPadding(4);
    setShowEdges(true);
    setMinWidth(70);
    setMinHeight(70);
    setMaxWidth(300);
    setMaxHeight(200);
    setKeepInParentRect(true);
    setCanDragReposition(true);
    setDragAppearance(DragAppearance.TARGET);
}