com.smartgwt.client.widgets.Canvas Java Examples

The following examples show how to use com.smartgwt.client.widgets.Canvas. 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: UsersView.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private ListGrid createUserList(ToolStrip gridEditControls) {
    final ListGrid grid = new ListGrid() {

        @Override
        protected Canvas getExpansionComponent(ListGridRecord record) {
            return getRowProfileEditor(record);
        }

    };
    grid.setDataSource(UserDataSource.getInstance());
    grid.setUseAllDataSourceFields(true);
    grid.setSelectionType(SelectionStyle.SINGLE);
    grid.setCanExpandRecords(true);
    grid.setCanExpandMultipleRecords(false);
    grid.setGridComponents(gridEditControls, ListGridComponent.HEADER, ListGridComponent.BODY);
    // Since SmartGWT 4.0; disable auto-save to post updates of nested forms just on the submit actions.
    grid.setAutoSaveEdits(false);
    grid.setShowClippedValuesOnHover(true);
    ListGridPersistance gridPersistence = new ListGridPersistance("UsersView.userList", grid);
    grid.setViewState(gridPersistence.getViewState());
    return grid;
}
 
Example #2
Source File: ImportBatchItemEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private Canvas initDigitalObjectEditor(DigitalObjectEditor childEditor, SimpleEventBus eventBus) {
    childEditor.setImportView(true);
    RelationDataSource relationDataSource = RelationDataSource.getInstance();
    relationDataSource.addRelationChangeHandler(new RelationChangeHandler() {

        @Override
        public void onRelationChange(RelationChangeEvent event) {
            // issue 262: isVisible seems to be always true and isAttached is always null.
            // Add test isDrawn that seems to change for dettached widgets.
            if (batchItemGrid.isVisible() && batchItemGrid.isDrawn()) {
                updateCache();
            }
        }
    });
    ActivityManager activityManager = new ActivityManager(
            new ChildActivities(childEditor), eventBus);

    VLayout editorsLayout = new VLayout();
    editorsLayout.addStyleName("defaultBorder");
    activityManager.setDisplay(new ChildEditorDisplay(editorsLayout));
    return editorsLayout;
}
 
Example #3
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 #4
Source File: ImportParentChooser.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
SelectionView(ClientMessages i18n) {
    this.i18n = i18n;
    setAutoHeight();
    setIsGroup(true);
    setGroupTitle(i18n.ImportParentChooser_SelectionForm_Title());
    setLayoutMargin(4);
    selection = new Canvas();
    selection.setWidth100();
    selection.setAutoHeight();
    selection.setMargin(4);
    selection.setCanSelectText(Boolean.TRUE);
    clear = new IButton(i18n.ImportParentChooser_SelectionForm_Clear_Title());
    clear.setTooltip(i18n.ImportParentChooser_SelectionForm_Clear_Hint());
    clear.setAutoFit(Boolean.TRUE);
    setMembers(selection, clear);
}
 
Example #5
Source File: RepeatableForm.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private void onAddRowClick(int eventRowIndex) {
    if (activeRows.size() >= formItem.getMaxOccurrences()) {
        return ;
    }
    Row row = getRow();
    Canvas newListItem = row.getView();
    // 1. member is formError
    RepeatableForm.this.addMember(newListItem, eventRowIndex + 2);
    Record newRecord = new Record();
    dataModel.addAt(newRecord, eventRowIndex + 1);
    activeRows.add(eventRowIndex + 1, row);
    // disable Add buttons
    if (activeRows.size() >= formItem.getMaxOccurrences()) {
        setAddDisabled(true);
    }
    RepeatableForm.this.fireEvent(new ListChangedEvent());
}
 
Example #6
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 #7
Source File: Editor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private Canvas createLangMenu() {
    String activeLocale = LanguagesDataSource.activeLocale();
    IconMenuButton langMenuButton = Actions.asIconMenuButton(Actions.emptyAction(activeLocale, null, null), this);
    langMenuButton.setCanFocus(Boolean.FALSE);
    Menu m = new Menu();
    m.setShowShadow(Boolean.TRUE);
    m.addItem(createLangItem("cs", "Česky", activeLocale));
    m.addItem(createLangItem("en", "English", activeLocale));
    langMenuButton.setMenu(m);
    m.addItemClickHandler(new ItemClickHandler() {

        @Override
        public void onItemClick(ItemClickEvent event) {
            MenuItem item = event.getItem();
            if (!Boolean.TRUE.equals(item.getChecked())) {
                switchLocale(item.getAttribute(LOCALE_ATTRIBUTE));
            }
        }
    });

    Record rec = m.getDataAsRecordList().find(LOCALE_ATTRIBUTE, activeLocale);
    langMenuButton.setTitle(rec.getAttribute("title"));
    return langMenuButton;
}
 
Example #8
Source File: LegendEntryTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onDraw() {
	super.onDraw();
	if (this.wasDragged) {

		// members are updated earlier than children!!
		Canvas[] members = View.getView().getLegend().getLegendStack()
				.getMembers();
		for (int entryIndex = 0; entryIndex < members.length; entryIndex++) {
			Canvas canvas = members[entryIndex];
			if (canvas instanceof LegendElement) {
				LegendElement element = (LegendElement) canvas;
				element.setOrdering(entryIndex);
				TimeseriesDataStore dataStore = TimeseriesDataStore
						.getTimeSeriesDataStore();
				dataStore.getDataItem(element.getElemId()).setOrdering(
						entryIndex);
			}
		}
		this.wasDragged = false;
		EventBus.getMainEventBus().fireEvent(new LoadImageDataEvent());
	}
}
 
Example #9
Source File: AllRulesListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {
    if (record != null) {
        String fieldName = getFieldName(colNum);
        if (fieldName.equals(PUBLISHED_RULE_FIELD)) {
            return createPublishRuleButton(record);
        } else if (fieldName.equals(EDIT_RULE_FIELD)) {
            return createEditRuleButton(record);
        } else if (fieldName.equals(DELETE_RULE_FIELD)) {
            return createDeleteRuleButton(record);
        } else {
            return null;
        }
    }
    return null;
}
 
Example #10
Source File: ModsMultiEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private void setActiveEditor(DatastreamEditor newEditor) {
    if (newEditor != activeEditor) {
        if (newEditor != null) {
            uiContainer.setMembers(newEditor.getUI());
        } else {
            uiContainer.setMembers(new Canvas[0]);
        }
        if (submitCustomValuesRegistration != null) {
            submitCustomValuesRegistration.removeHandler();
        }
        if (newEditor instanceof HasSubmitValuesHandlers) {
            submitCustomValuesRegistration = ((HasSubmitValuesHandlers) newEditor)
                    .addSubmitValuesHandler(submitCustomValuesHandler);
        }
        activeEditor = newEditor;
    }
}
 
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: 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 #13
Source File: DataControlsTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createAutoScaleButton() {
	Layout layout = new Layout();
	layout.setStyleName("n52_sensorweb_client_scaleButtonLayout");
	autoScaleButton = new Label(i18n.resetScale());
	autoScaleButton.setStyleName("n52_sensorweb_client_scaleButton");
    autoScaleButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            EventBus.getMainEventBus().fireEvent(new SwitchAutoscaleEvent(true), new EventCallback() {
                public void onEventFired() {
                    EventBus.getMainEventBus().fireEvent(new RequestDataEvent());
                }
            });
        }
    });
    autoScaleButton.setWidth(80);
    autoScaleButton.setWrap(false);
    return autoScaleButton;
}
 
Example #14
Source File: LegendEntryTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createValueIntervalLabel() {
	Layout interval = new HLayout();
	interval.setAutoWidth();
	interval.setStyleName("n52_sensorweb_client_legendInfoRow");
	this.firstValueInterval.setAutoWidth();
	this.firstValueInterval.setWrap(false);
	this.firstValueInterval.setStyleName("n52_sensorweb_client_legendlink");
	this.lastValueInterval.setAutoWidth();
	this.lastValueInterval.setWrap(false);
	this.lastValueInterval.setStyleName("n52_sensorweb_client_legendlink");
	Label separator = new Label(i18n.to());
	separator.setAlign(Alignment.CENTER);
	separator.setWidth(20);
	interval.addMember(this.firstValueInterval);
	interval.addMember(separator);
	interval.addMember(this.lastValueInterval);
	return interval;
}
 
Example #15
Source File: StationSelector.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private Canvas createSelectionMenuWindow() {
	Layout layout = new Layout();
       layout.addMember(createExpandableSelectionGrid());
	selectionMenu = new InteractionWindow(layout);
	selectionMenu.setZIndex(1000000);
	selectionMenu.setWidth(250);
	selectionMenu.setHeight(290);
	selectionMenu.setWindowTitle(i18n.dataprovider());
	setSelectionMenuWindowPosition();
	return selectionMenu;
}
 
Example #16
Source File: CatalogBrowser.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Canvas getUI() {
    if (widget == null) {
        widget = createAdvancedOptions();
    }
    return widget;
}
 
Example #17
Source File: RepeatableForm.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Canvas createRowWidget(Row row) {
    HLayout hLayout = new HLayout();
    Canvas buttons = createItemButtons(row);
    buttons.setLayoutAlign(VerticalAlignment.BOTTOM);
    hLayout.addMember(row.getFormWidget().getWidget());
    hLayout.addMember(buttons);
    return hLayout;
}
 
Example #18
Source File: ImageWithCanvases.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Adds a new canvas
 * 
 * @param canvas the canvas to add
 */
public void addCanvas(Canvas canvas) {
	canvases.add(canvas);
	canvas.setOverflow(Overflow.HIDDEN);
	canvas.setSmoothFade(true);
	canvas.addResizedHandler(new CanvasResizedHandler(canvas));
	canvas.addMovedHandler(new CamvasMovedHandler(canvas));
	addChild(canvas);
}
 
Example #19
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Window createFullImageWindow(Canvas content) {
    final Window window = new Window();
    window.setWidth(Page.getWidth() - 200);
    window.setHeight(Page.getHeight() - 40);
    window.setAutoCenter(true);
    window.setMaximized(true);
    window.setCanDragResize(true);
    window.setCanDragReposition(true);
    window.setIsModal(true);
    window.setDismissOnEscape(true);
    window.setDismissOnOutsideClick(true);
    window.setKeepInParentRect(true);
    window.setShowMaximizeButton(true);
    window.setShowMinimizeButton(false);

    window.setModalMaskOpacity(10);
    window.setShowModalMask(true);

    window.setShowResizer(true);
    window.setTitle(i18n.DigitalObjectPreview_Window_Title());
    window.setBodyColor(BACKGROUND_COLOR);
    window.setCanFocus(true);
    window.addItem(content);

    window.setHeaderControls(HeaderControls.HEADER_ICON, HeaderControls.HEADER_LABEL,
            getWindowZoomer(), HeaderControls.MAXIMIZE_BUTTON, HeaderControls.CLOSE_BUTTON);

    window.addCloseClickHandler(new CloseClickHandler() {

        @Override
        public void onCloseClick(CloseClickEvent event) {
            event.cancel();
            window.close();
            onWindowClose();
        }
    });

    return window;
}
 
Example #20
Source File: WorkflowJobsEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public Canvas getUI() {
    if (view == null) {
        view = new WorkflowJobView(i18n);
        view.setHandler(this);
    }
    return view.getWidget();
}
 
Example #21
Source File: ModsBatchEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Canvas getFormPanel() {
    if (panel == null) {
        panel = editor.getFormPanel();
        panel.setWidth100();
        panel.setHeight100();
        panel.setOverflow(Overflow.AUTO);
    }
    return panel;
}
 
Example #22
Source File: WorkflowJobView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Canvas createJobLayout() {
    VLayout left = new VLayout();
    left.addMember(createJobsToolbar());
    left.addMember(createJobList());
    left.addMember(createSubjobList());
    left.setShowResizeBar(true);

    CanvasSizePersistence sizePersistence = new CanvasSizePersistence("WorkflowJobFormView.jobLayout", left);
    left.setWidth(sizePersistence.getWidth());

    HLayout l = new HLayout();
    l.addMember(left);
    l.addMember(createJobFormLayout());
    return l;
}
 
Example #23
Source File: LegendEntryTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private Canvas createRefValueLayout() {
	this.refvalLayout = new VLayout();
	this.refvalLayout.setTabIndex(-1);
	this.refvalLayout.setHeight("*");
	this.refvalLayout.setOverflow(Overflow.VISIBLE);
	this.refvalLayout.setStyleName("n52_sensorweb_client_refValLayout");

	return this.refvalLayout;
}
 
Example #24
Source File: UploadFile.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Canvas createProgressBar() {
    progressbar.setVertical(false);
    progressbar.setWidth100();
    progressbar.setHeight(24);
    progressbar.setBreadth(1);
    VLayout vLayout = new VLayout();
    vLayout.addMember(progressbar);
    return vLayout;
}
 
Example #25
Source File: UploadFile.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Canvas createBrowseCanvas() {
    UploadHandler uploadHandler = new UploadHandler();
    uploader = new Uploader() {

        @Override
        protected void onLoad() {
            super.onLoad();
            openFileDialog(uploader);
        }

    };
    uploader.setUploadURL(RestConfig.URL_DIGOBJECT_DISSEMINATION)
            .setButtonImageURL(Page.getSkinImgDir() + "MultiUploadItem/icon_add_files.png")
            .setButtonWidth(16)
            .setButtonHeight(16)
            .setButtonCursor(Cursor.HAND)
            .setButtonAction(ButtonAction.SELECT_FILE)
            .setFileSizeLimit("1 GB")
            .setFilePostName(FIELD_FILE)
            .setFileUploadLimit(0)
            .setFileQueuedHandler(uploadHandler)
            .setFileQueueErrorHandler(uploadHandler)
            .setUploadCompleteHandler(uploadHandler)
            .setUploadErrorHandler(uploadHandler)
            .setUploadProgressHandler(uploadHandler)
            .setUploadSuccessHandler(uploadHandler)
            ;
    HStack hStack = new HStack(4);
    Label label = new Label(i18n.DigitalObjectEditor_MediaEditor_Uploader_Browse_Title() + ": ");
    label.setAutoFit(true);
    label.setWrap(false);
    hStack.addMember(label);
    hStack.addMember(uploader);
    return hStack;
}
 
Example #26
Source File: ImportPresenter.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Canvas asWidget() {
    if (widget == null) {
        widget = new ImportBatchItemEditor(i18n);
    }
    return widget;
}
 
Example #27
Source File: ImportPresenter.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Canvas asWidget() {
    if (widget == null) {
        widget = new ImportParentChooser(i18n);
        widget.setParentOwnerCheck(true);
        widget.getUI().setMargin(4);

        container = new VLayout();
        container.setMembers(buildToolbar(), widget.getUI());
    }
    return container;
}
 
Example #28
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 #29
Source File: EventSubscriptionWindow.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private Canvas createSubscribeAndHelpContent() {
    Layout layout = new HLayout();
    layout.addMember(createNewEventAbonnementCanvas());
    layout.addMember(createContextWindowHelp());
    layout.setOverflow(VISIBLE);
    return layout;
}
 
Example #30
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets preview container and put it to window. On close it returns the container back.
 */
public void showInWindow(String title) {
    // put focus inside window to enable Window.setDismissOnEscape
    Canvas[] members = previewLayout.getMembers();
    windowContainer.setMembers(members);
    imageWindow.setTitle(title);
    imageWindow.show();
    imageWindow.focus();
}