Java Code Examples for com.smartgwt.client.widgets.layout.HLayout#setMembers()

The following examples show how to use com.smartgwt.client.widgets.layout.HLayout#setMembers() . 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: 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 2
Source File: FillForm.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public FillForm(GUIDocument frm) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);

	setTitle(I18N.message("form") + " - " + Util.getBaseName(frm.getFileName()));
	setWidth(500);
	setHeight(400);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	
	IButton save = new IButton();
	save.setTitle(I18N.message("save"));
	save.setAutoFit(true);
	save.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
		@Override
		public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
			onSave();
		}
	});

	HLayout buttonsBar = new HLayout();
	buttonsBar.setWidth100();
	buttonsBar.setHeight(25);
	buttonsBar.setMembers(save);
	
	
	propertiesPanel = new ExtendedPropertiesPanel(frm, null, true, true, false);
	
	VLayout layout = new VLayout();
	layout.setMargin(3);
	layout.setMembersMargin(3);
	layout.setMembers(propertiesPanel, buttonsBar);
	
	addItem(layout);
}
 
Example 3
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 4
Source File: Editor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Canvas createGlobalMenuButton(final TreeGrid menu) {
        // Render the menu as HLayout instead of Window to get rid of edges introduced by SmartGWT 4.0
        final HLayout menuWindow = new HLayout();
        menuWindow.setID(GLOBAL_MENU_CONTAINER_ID);
        menuWindow.setShowShadow(true);
        menuWindow.setWidth(200);
        menuWindow.setMembers(menu);
        final IconMenuButton[] globalMenuButton = new IconMenuButton[1];
        globalMenuButton[0] = Actions.asIconMenuButton(new AbstractAction(
                i18n.MainMenu_Title(), null, null) {

            @Override
            public void performAction(ActionEvent event) {
                // canOcclude not fully supported in SmartGWT 4.0; introduce by patch 4.0-p; do not use yet
//                menuWindow.showNextTo(globalMenuButton[0], "bottom", true);
                menuWindow.showNextTo(globalMenuButton[0], "bottom");
                menuWindow.showClickMask(new Function() {

                    @Override
                    public void execute() {
                        menuWindow.hide();
                    }
                }, ClickMaskMode.SOFT, new Canvas[] {menuWindow});
                menu.focus();
            }
        }, new Object());
        globalMenuButton[0].setAutoWidth();
        globalMenuButton[0].setCanFocus(Boolean.FALSE);
        return globalMenuButton[0];
    }
 
Example 5
Source File: DeviceManager.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public DeviceManagerWidget(ClientMessages i18n) {
    this.i18n = i18n;
    actionSource = new ActionSource(this);
    widget = new VLayout();

    Label lblHeader = new Label();
    String title = ClientUtils.format("<b>%s</b>", i18n.DeviceManager_Title());
    lblHeader.setContents(title);
    lblHeader.setAutoHeight();
    lblHeader.setPadding(4);
    lblHeader.setStyleName(Editor.CSS_PANEL_DESCRIPTION_TITLE);

    ToolStrip toolbar = createToolbar(i18n);
    deviceList = createDeviceList(i18n);
    form = createForm();
    premisForm = createPremisForm();
    descriptionForm = createDescriptionForm();
    valuesManager = new ValuesManager();
    valuesManager.addMember(form);
    valuesManager.addMember(premisForm);
    valuesManager.addMember(descriptionForm);
    valuesManager.setDataSource(DeviceDataSource.getInstance());
    VLayout forms = new VLayout();
    forms.setOverflow(Overflow.AUTO);
    forms.setMembers(form, premisForm, descriptionForm);

    HLayout hLayout = new HLayout();
    deviceList.setWidth100();
    forms.setWidth100();
    hLayout.setMembers(deviceList, forms);

    widget.addMember(lblHeader);
    widget.addMember(toolbar);
    widget.addMember(hLayout);
}
 
Example 6
Source File: StatusView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private StatusView() {
    container = new HLayout();
    content = new Label();
    content.setIcon("[SKIN]/Dialog/say.png");
    content.setIconSize(20);
    content.setMargin(1);
    content.setPadding(1);

    content.setHeight(38);
    content.setValign(VerticalAlignment.CENTER);
    content.setAlign(Alignment.LEFT);
    content.setWrap(Boolean.FALSE);

    container.setMembers(content);
    container.setLeft(Page.getWidth() / 2 - 50);
    container.setTop(4);
    container.setLayoutLeftMargin(4);
    container.setLayoutRightMargin(4);
    container.setBorder("1px solid red");
    container.setBackgroundColor("white");
    container.setAutoHeight();
    container.setShowShadow(Boolean.TRUE);

    timer = new Timer() {

        @Override
        public void run() {
            container.animateHide(AnimationEffect.FADE);
        }
    };
}
 
Example 7
Source File: GoogleAuthenticatorSetup.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void init(String account, String key, String qrUrl) {
	// Prepare the form with account informations
	StaticTextItem accountItem = ItemFactory.newStaticTextItem("account", I18N.message("account"), account);
	accountItem.setWrap(false);
	accountItem.setWrapTitle(false);

	StaticTextItem keyItem = ItemFactory.newStaticTextItem("key", I18N.message("key"), key);
	keyItem.setWrap(false);
	keyItem.setWrapTitle(false);

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.LEFT);
	form.setItems(accountItem, keyItem);

	Label formTitle = new Label("<b>" + I18N.message(Constants.TWOFA_GOOGLE_AUTHENTICATOR+".hint1") + "</b>");
	formTitle.setWrap(true);
	formTitle.setMinWidth(250);

	VLayout formLayout = new VLayout();
	formLayout.setMembersMargin(2);
	formLayout.setMembers(formTitle, form);
	formLayout.setAlign(VerticalAlignment.TOP);

	// Prepare the QR Code
	HTMLFlow qrCode = new HTMLFlow("<img width='200' height='200' src='" + qrUrl + "'/>");
	qrCode.setOverflow(Overflow.VISIBLE);

	Label qrCodeTitle = new Label("<b>" + I18N.message(Constants.TWOFA_GOOGLE_AUTHENTICATOR+".hint2") + "</b>");
	qrCodeTitle.setWrap(true);
	qrCodeTitle.setMinWidth(250);

	VLayout qrCodeLayout = new VLayout();
	qrCodeLayout.setWidth100();
	qrCodeLayout.setHeight100();
	qrCodeLayout.setMembers(qrCodeTitle, qrCode);

	VLayout separator = new VLayout();
	separator.setWidth(20);

	HLayout body = new HLayout();
	body.setMembersMargin(2);
	body.setMembers(formLayout, separator, qrCodeLayout);

	setMembers(body);
}
 
Example 8
Source File: SearchPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDraw() {
	if (drawn)
		return;
	drawn = true;

	// Prepare the collapsable menu
	SearchMenu searchMenu = SearchMenu.get();
	searchMenu.setWidth(350);
	searchMenu.setShowResizeBar(true);

	// Initialize the listing panel as placeholder
	listingPanel = new HitsListPanel();
	listing.setAlign(Alignment.CENTER);
	listing.setHeight("51%");
	listing.setShowResizeBar(true);
	listing.addMember(listingPanel);

	// Add a details panel under the listing one
	detailPanel = new Label("&nbsp;" + I18N.message("selectahit"));
	details.setAlign(Alignment.CENTER);
	details.addMember(detailPanel);

	// The two rows: listing and details
	VLayout listingAndDetails = new VLayout();
	listingAndDetails.setMembers(listing, details);
	listingAndDetails.setShowResizeBar(true);
	listingAndDetails.setResizeBarTarget("next");

	previewPanel = new SearchPreviewPanel();
	previewPanel.addVisibilityChangedHandler(new VisibilityChangedHandler() {

		@Override
		public void onVisibilityChanged(VisibilityChangedEvent event) {
			if (detailPanel instanceof DocumentDetailsPanel)
				previewPanel.setDocument(((DocumentDetailsPanel) detailPanel).getDocument());
		}
	});

	// The listing plus the preview
	HLayout bodyPanel = new HLayout();
	bodyPanel.setWidth100();
	bodyPanel.setMembers(listingAndDetails, previewPanel);

	body.setMembers(new SearchToolbar(listingPanel), bodyPanel);

	setMembers(searchMenu, body);
}
 
Example 9
Source File: TaskDetailsDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TaskDetailsDialog(final WorkflowDashboard dashboard, GUIWorkflow wfl, boolean readOnly) {
	this.workflow = wfl;
	this.workflowDashboard = dashboard;
	this.readOnly = readOnly;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);

	setTitle(I18N.message("workflow"));
	setWidth(700);
	setHeight(420);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	addCloseClickHandler(new CloseClickHandler() {
		@Override
		public void onCloseClick(CloseClickEvent event) {
			workflowDashboard.refresh();
			destroy();
		}
	});

	tabs = new TabSet();
	tabs.setWidth100();
	tabs.setHeight100();

	workflowTab = new Tab(I18N.message("workflow"));
	tabs.addTab(workflowTab, 0);

	buttonsPanel = new VLayout();

	mainPanel = new HLayout();
	mainPanel.setMembersMargin(5);
	mainPanel.setMembers(tabs, buttonsPanel);

	addItem(mainPanel);

	form = new HLayout(25);
	form.setMargin(20);
	form.setWidth100();
	form.setHeight100();

	sxLayout = new VLayout(10);
	appendedDocsPanel = new VLayout(5);
	appendedDocsPanel.setMargin(5);
	notesPanel = new VLayout(5);
	notesPanel.setMargin(5);

	reload(wfl);
}
 
Example 10
Source File: ZoneEditor.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ZoneEditor(GUIZone zone) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("zone") + " - " + zone.getName());
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);

	this.zone = zone;

	IButton save = new IButton(I18N.message("save"));
	save.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {

		@Override
		public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
			onSave();
		}
	});

	prepareForm();

	ImageWithCanvases sample = new ImageWithCanvases(zone.getSampleUrl(), 300, null, null);

	HLayout body = new HLayout();
	body.setMembers(form, sample);

	VLayout layout = new VLayout();
	layout.setMembersMargin(5);
	layout.setWidth100();
	layout.setMembers(body, save);

	addItem(layout);

	// Just to clean the upload folder
	DocumentService.Instance.get().cleanUploadedFileFolder(new AsyncCallback<Void>() {

		@Override
		public void onFailure(Throwable caught) {
		}

		@Override
		public void onSuccess(Void result) {
		}
	});
}
 
Example 11
Source File: CreateAliasDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CreateAliasDialog() {
	super();
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createalias"));
	setWidth(470);
	setHeight(280);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(3);

	VLayout content = new VLayout();
	content.setTop(10);
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(3);

	final TreeGrid folders = new FolderTree();
	folders.setWidth100();
	folders.setHeight100();

	HLayout buttons = new HLayout();
	buttons.setWidth100();
	buttons.setHeight(30);

	Button create = new Button(I18N.message("create"));
	create.setAutoFit(true);
	create.setMargin(1);
	create.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			FolderNavigator.get().createAlias(
					Long.parseLong(folders.getSelectedRecord().getAttributeAsString("folderId")));
			destroy();
		}
	});

	buttons.setMembers(create);
	content.setMembers(folders, buttons);
	addItem(content);
}
 
Example 12
Source File: DocumentsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDraw() {
	if (initialized)
		return;

	// Register to folders events
	FolderController.get().addObserver(this);

	// Register to documents events
	DocumentController.get().addObserver(this);

	// Initialize the listing panel as placeholder
	listingPanel = new Label("&nbsp;" + I18N.message("selectfolder"));
	listing.setAlign(Alignment.CENTER);
	listing.setHeight("51%");
	listing.setShowResizeBar(true);
	listing.addMember(listingPanel);

	// Add a details panel under the listing one
	detailPanel = new Label("&nbsp;" + I18N.message("selectfolderordoc"));
	details.setAlign(Alignment.CENTER);
	details.addMember(detailPanel);

	// The two rows: listing and details
	VLayout listingAndDetails = new VLayout();
	listingAndDetails.setMembers(listing, details);
	listingAndDetails.setShowResizeBar(true);
	listingAndDetails.setResizeBarTarget("next");

	previewPanel = new DocumentsPreviewPanel();

	// The listing plus the preview
	HLayout bodyPanel = new HLayout();
	bodyPanel.setWidth100();
	bodyPanel.setMembers(listingAndDetails, previewPanel);

	body.setMembers(DocumentToolbar.get(), bodyPanel);

	documentsMenu = new DocumentsMenu();

	setMembers(documentsMenu, body);

	previewPanel.addVisibilityChangedHandler(new VisibilityChangedHandler() {

		@Override
		public void onVisibilityChanged(VisibilityChangedEvent event) {
			if (detailPanel instanceof DocumentDetailsPanel)
				previewPanel.setDocument(((DocumentDetailsPanel) detailPanel).getDocument());
		}
	});

	initialized = true;
}
 
Example 13
Source File: Editor.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public void onModuleLoad() {
        INSTANCE = this;
        initLogging();
        
        ClientUtils.info(LOG, "onModuleLoad:\n module page: %s\n host page: %s"
                + "\n getModuleName: %s\n getPermutationStrongName: %s\n version: %s"
                + "\n Page.getAppDir: %s, \n Locale: %s",
                GWT.getModuleBaseURL(), GWT.getHostPageBaseURL(),
                GWT.getModuleName(), GWT.getPermutationStrongName(), GWT.getVersion(),
                Page.getAppDir(), LanguagesDataSource.activeLocale()
                );

        // remove the loading wrapper. See index.html
        DOM.getElementById("loadingWrapper").removeFromParent();

        I18nUtil.initMessages(ClientUtils.createSmartGwtMessages());
        i18n = GWT.create(ClientMessages.class);

        errorHandler = new ErrorHandler();
        errorHandler.initTransportErrorHandler();

        LoginWindow.login();

        presenterFactory = new PresenterFactory(i18n);

        editorWorkFlow = new EditorWorkFlow(getDisplay(), presenterFactory, i18n);
        presenterFactory.setPlaceController(editorWorkFlow.getPlaceController());

        final TreeGrid menu = createMenu();

        sweepTask = new SweepTask() {

            @Override
            public void processing() {
                SC.clearPrompt();
                TreeNode[] menuContent = createMenuContent();
                Tree tree = menu.getTree();
                TreeNode root = tree.getRoot();
                tree.addList(menuContent, root);
                tree.openAll();
                editorWorkFlow.init();
            }
        };

        final HLayout mainLayout = new HLayout();
//        mainLayout.setLayoutMargin(5);
        mainLayout.setWidth100();
        mainLayout.setHeight100();
        mainLayout.setMembers(getDisplay());

        Canvas mainHeader = createMainHeader(menu);

        VLayout desktop = new VLayout(0);
        desktop.setWidth100();
        desktop.setHeight100();
        desktop.setMembers(mainHeader, mainLayout);
        desktop.draw();

        SC.showPrompt(i18n.Editor_InitialLoading_Msg());
        LocalizationDataSource.getInstance().initOnStart(sweepTask.expect());
        ValueMapDataSource.getInstance().initOnStart(sweepTask.expect());
        loadPermissions();
    }
 
Example 14
Source File: DigitalObjectChildrenEditor.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public DigitalObjectChildrenEditor(ClientMessages i18n, PlaceController places, OptionalEditor preview) {
        this.i18n = i18n;
        this.places = places;
        this.preview = preview;
        this.actionSource = new ActionSource(this);
        this.goDownAction = DigitalObjectNavigateAction.child(i18n, places);
        relationDataSource = RelationDataSource.getInstance();
        childrenListGrid = initChildrenListGrid();
        this.selectionCache = SelectionCache.selector(childrenListGrid);
        VLayout childrenLayout = new VLayout();
        childrenLayout.setMembers(childrenListGrid);
        childrenLayout.setWidth("40%");
        childrenLayout.setShowResizeBar(true);

        SimpleEventBus eventBus = new SimpleEventBus();
        childPlaces = new PlaceController(eventBus);
        childEditor = new DigitalObjectEditor(i18n, childPlaces, true);
        ActivityManager activityManager = new ActivityManager(
                new ChildActivities(childEditor), eventBus);

        VLayout editorsLayout = new VLayout();
        VLayout editorsOuterLayout = new VLayout();
//        editorsLayout.setBorder("1px solid grey");
        editorsLayout.addStyleName("defaultBorder");
        editorsOuterLayout.setLayoutLeftMargin(4);
        editorsOuterLayout.setMembers(editorsLayout);
        activityManager.setDisplay(new ChildEditorDisplay(editorsLayout));

        widget = new HLayout();
        widget.setMembers(childrenLayout, editorsOuterLayout);
        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 (digitalObject != null && childrenListGrid.isVisible() && childrenListGrid.isDrawn()) {
                    String changedPid = event.getPid();
                    if (changedPid != null) {
                        Record changedRecord = childrenListGrid.getDataAsRecordList()
                                .find(RelationDataSource.FIELD_PID, changedPid);
                        if (changedRecord == null) {
                            // moved object(s)
                            // ListGrid does not remove selection of removed/moved rows
                            // and it does not fire selection change
                            // issue 246: clear selection of moved row
                            childrenListGrid.deselectAllRecords();
                            DigitalObjectCopyMetadataAction.resetSelection();
                            showCopySelection(new Record[0]);
                            return ;
                        }
                    }
                    final ListGridRecord[] selection = childrenListGrid.getSelectedRecords();
                    relationDataSource.updateCaches(digitalObject.getPid(), new BooleanCallback() {

                        @Override
                        public void execute(Boolean value) {
                            // refresh the copy selection as updated records are missing the copy attribute
                            showCopySelection(DigitalObjectCopyMetadataAction.getSelection());
                            // refresh the list selection
                            selectChildren(selection);
                        }
                    });
                }
            }
        });
    }