Java Code Examples for com.smartgwt.client.widgets.Label#setCanSelectText()

The following examples show how to use com.smartgwt.client.widgets.Label#setCanSelectText() . 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: Toaster.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void addMessage(String msg) {

        Date d = new Date();
        String timeStamp = DateTimeFormat.getFormat("dd.MM.yyyy HH:mm").format(d);

        Label l = new Label(timeStamp + " " + msg);
        l.setCanSelectText(true);
        l.setStyleName("n52_sensorweb_client_toasterMsg");
        l.setAutoHeight();

        this.messages.add(l);

        for (int i = 0; i < this.messages.size(); i++) {
            if (this.layout.hasMember(this.messages.get(i))) {
                this.layout.removeMember(this.messages.get(i));
            }
        }
        for (int i = this.messages.size() - 1; i >= 0; i--) {
            this.layout.addMember(this.messages.get(i));
        }

//        this.left = this.toasterWindow.getParentElement().getWidth().intValue() - this.width - 10;
//        this.top = this.toasterWindow.getParentElement().getHeight().intValue() - this.height - 30;
//
//        this.toasterWindow.setLeft(this.left);
//        this.toasterWindow.setTop(this.top);

        animateToaster();
    }
 
Example 2
Source File: Toaster.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
public void addErrorMessage(String error) {

        Date d = new Date();
        String timeStamp = DateTimeFormat.getFormat("dd.MM.yyyy HH:mm").format(d);

        Label l = new Label(timeStamp + " " + error);
        l.setCanSelectText(true);
        l.setStyleName("n52_sensorweb_client_toasterErrorMsg");
        l.setAutoHeight();

        for (int i = 0; i < this.messages.size(); i++) {
            this.layout.removeMember(this.messages.get(i));

        }
        this.messages.add(l);
        for (int i = this.messages.size() - 1; i >= 0; i--) {
            this.layout.addMember(this.messages.get(i));
        }

        this.left = this.toasterWindow.getParentElement().getWidth().intValue() - this.width - 10;
        this.top = this.toasterWindow.getParentElement().getHeight().intValue() - this.height - 30;

        this.toasterWindow.setLeft(this.left);
        this.toasterWindow.setTop(this.top);

        animateToaster();
    }
 
Example 3
Source File: ImportSourceChooser.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ImportSourceChooser(ClientMessages i18n) {
    this.i18n = i18n;
    VLayout layout = this;
    setWidth100();
    setHeight100();
    VLayout innerLayout = new VLayout();
    innerLayout.setLayoutMargin(4);

    lblCurrSelection = new Label(i18n.ImportSourceChooser_NothingSelected_Title());
    lblCurrSelection.setWidth100();
    lblCurrSelection.setAutoFit(true);
    lblCurrSelection.setMargin(4);
    lblCurrSelection.setCanSelectText(true);

    treeGrid = new TreeGrid();
    treeGrid.setHeight100();
    treeGrid.setDataSource(dataSource);
    TreeGridField stateField = new TreeGridField(
            ImportTreeDataSource.FIELD_STATE,
            i18n.ImportSourceChooser_TreeHeaderImportState_Title());
    stateField.setWidth(100);
    treeGrid.setFields(
            new TreeGridField(ImportTreeDataSource.FIELD_NAME, i18n.ImportSourceChooser_TreeHeaderFolderName_Title()),
            stateField);
    treeGrid.setShowConnectors(true);
    treeGrid.setEmptyMessage(i18n.ImportSourceChooser_NoDataOnServer_Title());
    treeGrid.setAlternateRecordStyles(true);
    treeGrid.setSelectionType(SelectionStyle.SINGLE);
    ListGridPersistance treeGridPersistence = new ListGridPersistance("ImportSourceChooser.directoryList", treeGrid);
    treeGrid.setViewState(treeGridPersistence.getViewState());

    treeGrid.addFolderClickHandler(new FolderClickHandler() {

        @Override
        public void onFolderClick(FolderClickEvent event) {
            updateOnSelection();
            // issue 41: open node on single click
            TreeNode folder = event.getFolder();
            event.getViewer().getTree().openFolder(folder);
        }
    });

    ToolStrip toolbar = createToolbar();

    optionsForm = createOptionsForm();

    innerLayout.setMembers(optionsForm, lblCurrSelection, treeGrid);
    layout.setMembers(toolbar, innerLayout);
}