Java Code Examples for com.smartgwt.client.widgets.layout.VLayout#setWidth()

The following examples show how to use com.smartgwt.client.widgets.layout.VLayout#setWidth() . 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: LoginPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void prepareSwitchViewLink() {
	String url = "mobile".equals(Util.getJavascriptVariable("j_layout")) ? (Util.contextPath() + "login.jsp")
			: (Util.contextPath() + "login-mobile.jsp");
	url += "?tenant=" + Util.detectTenant();
	String label = "mobile".equals(Util.getJavascriptVariable("j_layout")) ? I18N.message("viewclassicweb")
			: I18N.message("viewmobileweb");

	/*
	 * A link to the alternative login page
	 */
	HTMLFlow switchLink = new HTMLFlow("<a href='" + url + "' class='login-switchview'>" + label + "</a>");
	switchLink.setHeight(16);
	switchLink.setWidth(COLUMN_WIDTH + 20);
	switchLink.setStyleName("login-switchview");

	HLayout spacer10 = new HLayout();
	spacer10.setHeight(10);
	spacer10.setWidth(10);

	VLayout link = new VLayout();
	link.setMembersMargin(0);
	link.setMargin(0);
	link.setStyleName("login-switchview");
	link.setMembers(spacer10, switchLink);
	link.setLayoutAlign(VerticalAlignment.TOP);
	link.setLayoutAlign(Alignment.CENTER);
	link.setWidth(COLUMN_WIDTH + 20);
	link.setHeight(18);

	mainPanel.addMember(link);
}
 
Example 2
Source File: UploadFile.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public void showWindow(DigitalObject dobj, BooleanCallback callback) {
    this.dobj = dobj;
    this.windowCallback = callback;
    form.setAutoHeight();

    window = new Window();
    window.setAutoSize(true);
    window.setAutoCenter(true);
    window.setIsModal(true);
    window.setTitle(i18n.DigitalObjectEditor_MediaEditor_Uploader_Title());
    window.setShowMinimizeButton(false);
    window.setShowModalMask(true);
    window.addCloseClickHandler(new CloseClickHandler() {

        @Override
        public void onCloseClick(CloseClickEvent event) {
            closeWindow();
        }
    });

    VLayout winContent = new VLayout(4);
    winContent.setWidth(400);
    winContent.setPadding(5);
    winContent.addMember(createBrowseCanvas());
    winContent.addMember(form);
    winContent.addMember(createProgressBar());
    winContent.addMember(createButtons());
    window.addItem(winContent);

    window.show();
}
 
Example 3
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 4
Source File: Setup.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void initGUI(final GUIInfo info) {
	WindowUtils.setTitle(info.getBranding().getProductName() + " " + info.getRelease()
			+ (info.getLicensee() != null ? " - " + I18N.message("licensedto") + ": " + info.getLicensee() : ""));
	WindowUtils.setFavicon(info);

	// Prepare a value manager that will include all forms spanned in each
	// tab
	vm = new ValuesManager();

	// Create all the tabs each one for a specific setup step
	tabs = new TabSet();
	tabs.setWidth(600);
	tabs.setHeight(250);

	Tab registrationTab = setupRegistration(vm);
	Tab repositoryTab = setupRepository(vm, info);
	Tab databaseTab = setupDatabase(vm, info);
	tabs.setTabs(registrationTab, repositoryTab, databaseTab);

	// This is the button used to confirm each step
	submit = new IButton();
	submit.setTitle(I18N.message("next"));
	submit.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			onSubmit(info);
		}
	});

	// Prepare the heading panel with Logo and Title
	// Prepare the logo image to be shown inside the login form
	Label header = new Label(I18N.message("setup"));
	header.setStyleName("setupHeader");
	header.setIcon(info.getBranding().getLogoSrc());
	header.setIconWidth(205);
	header.setIconHeight(40);
	header.setHeight(45);

	// Prepare a panel to layout setup components
	VLayout layout = new VLayout();
	layout.setHeight(500);
	layout.setWidth(400);
	layout.setMembersMargin(5);
	layout.addMember(header);
	layout.addMember(tabs);
	layout.addMember(submit);

	// Panel for horizontal centering
	VLayout vPanel = new VLayout();
	vPanel.setDefaultLayoutAlign(Alignment.CENTER);
	vPanel.setWidth100();
	vPanel.setHeight(300);
	vPanel.addMember(layout);

	RootPanel.get().add(vPanel);

	// Remove the loading frame
	RootPanel.getBodyElement().removeChild(RootPanel.get("loadingwrapper-setup").getElement());
}
 
Example 5
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 6
Source File: LoginPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Prepares the panel to show messages
 */
protected void prepareAlerts() {
	List<MessageLabel> messages = new ArrayList<MessageLabel>();
	if (info.getAlerts() != null && info.getAlerts().length > 0) {
		for (GUIMessage alert : info.getAlerts()) {
			MessageLabel label = new MessageLabel(alert, info.getTenant().getId() == 1L);
			label.setStyleName("loginMemesage");
			if (alert.isShowInLogin()) {
				messages.add(label);
			}
		}
	}

	if (info.getRunLevel().equals("demo")) {
		GUIMessage demoRunLevelMessage = new GUIMessage();
		demoRunLevelMessage.setMessage(I18N.message("demomode"));
		demoRunLevelMessage.setPriority(GUIMessage.PRIO_INFO);
		MessageLabel demoRunLevel = new MessageLabel(demoRunLevelMessage, info.getTenant().getId() == 1L);
		messages.add(demoRunLevel);
	} else if (info.getRunLevel().equals("updated")) {
		GUIMessage confirmUpdateMessage = new GUIMessage();
		confirmUpdateMessage.setMessage(I18N.message("systemupdatedwarning", info.getRelease()));
		confirmUpdateMessage.setPriority(GUIMessage.PRIO_WARN);
		MessageLabel updatedRunLevel = new MessageLabel(confirmUpdateMessage, info.getTenant().getId() == 1L);
		messages.add(updatedRunLevel);
	}

	HLayout spacer15 = new HLayout();
	spacer15.setHeight(15);
	spacer15.setWidth(15);

	// The messages screen
	VLayout messagesScreen = new VLayout();
	messagesScreen.setMembersMargin(0);
	messagesScreen.setMargin(0);
	messagesScreen.setStyleName("login-screen");
	messagesScreen.setMembers(messages.toArray(new MessageLabel[0]));
	messagesScreen.setLayoutAlign(VerticalAlignment.TOP);
	messagesScreen.setLayoutAlign(Alignment.CENTER);
	messagesScreen.setWidth(COLUMN_WIDTH + 20);
	messagesScreen.setHeight(1);

	mainPanel.addMember(spacer15);

	if (!messages.isEmpty())
		mainPanel.addMember(messagesScreen);
}
 
Example 7
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);
                        }
                    });
                }
            }
        });
    }
 
Example 8
Source File: ImportBatchItemEditor.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ImportBatchItemEditor(ClientMessages i18n) {
        this.i18n = i18n;
        this.setHeight100();
        this.setWidth100();
        this.actionSource = new ActionSource(this);
        
        VLayout layout = new VLayout();
        layout.setShowResizeBar(true);
        layout.setResizeBarTarget("next");

        batchItemGrid = createItemList();
        layout.addMember(batchItemGrid);

        // child editors
        SimpleEventBus eventBus = new SimpleEventBus();
        childPlaces = new PlaceController(eventBus);
        childEditor = new DigitalObjectEditor(i18n, childPlaces, true);
        childDisplay = initDigitalObjectEditor(childEditor, eventBus);
        layout.addMember(childDisplay);

        HLayout editorThumbLayout = new HLayout();
        editorThumbLayout.setHeight100();
        editorThumbLayout.addMember(layout);

        thumbViewer = createThumbViewer();
        editorThumbLayout.addMember(thumbViewer);

        this.selectionCache = new SelectionCache<>(
                Optional.empty(),
                r -> batchItemGrid.getRecordIndex(r));

        VLayout editorThumbToolbarLayout = new VLayout();
        editorThumbToolbarLayout.setShowResizeBar(true);
        editorThumbToolbarLayout.setResizeBarTarget("next");

        createActions();
        ToolStrip editorToolStrip = createEditorToolBar(actionSource);
        editorThumbToolbarLayout.addMember(editorToolStrip);
        editorThumbToolbarLayout.addMember(editorThumbLayout);

        addMember(editorThumbToolbarLayout);

        digitalObjectPreview = new MediaEditor(i18n, MediaEditor.SOURCE_IMPORT_BATCH_ITEM_EDITOR);
        digitalObjectPreview.addBackgroundColorListeners(thumbViewer);
        digitalObjectPreview.setShowRefreshButton(true);
        ToolStrip previewToolbar = Actions.createToolStrip();
        previewToolbar.setMembers(digitalObjectPreview.getToolbarItems());
        VLayout previewLayout = new VLayout();
        previewLayout.setMembers(previewToolbar, digitalObjectPreview.getUI());
        previewLayout.setWidth("40%");
        previewLayout.setHeight100();
//        previewLayout.setShowResizeBar(true);
//        previewLayout.setResizeFrom("L");
        addMember(previewLayout);
        createEditorContextMenu(batchItemGrid.getContextMenu(), this);
        createEditorContextMenu(thumbViewer.getContextMenu(), this);
    }
 
Example 9
Source File: CreateComplexRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private void addSingle(String op, String ruleName){
    // get all members from mainLayout and clear the layout
    Canvas[] members = this.ruleBlockLayout.getMembers();
    this.ruleBlockLayout.removeMembers(this.ruleBlockLayout.getMembers());
    
    LinkedHashMap<String, String> operatorHashMap = getLogicalOperators();

    VLayout v2 = new VLayout();
    v2.setWidth("70%");
    v2.addMember(members[0]);
    v2.addMember(createSingle(ruleName));
    
    DynamicForm block1 = new DynamicForm();
    block1.setWidth("30%");
    block1.setNumCols(1);
    
    this.singleOperator = new SelectItem();
    this.singleOperator.setShowTitle(false);
    this.singleOperator.setWidth(this.operatorWidth);
    this.singleOperator.setValueMap(operatorHashMap);
    this.singleOperator.setTextAlign(Alignment.CENTER);
    if (op != null) {
        this.singleOperator.setValue(op);
    } else {
        this.singleOperator.setValue(LogicalOperator.AND.toString());
    }
    
    SpacerItem spacerItem = new SpacerItem();
    spacerItem.setShowTitle(false);
    spacerItem.setHeight(20);
    
    block1.setFields(spacerItem, spacerItem, this.singleOperator);

    HLayout layout = new HLayout();
    layout.setWidth(200);
    layout.setHeight(25);
    layout.setEdgeMarginSize(1);
    layout.setEdgeSize(2);
    layout.setShowEdges(true);
    layout.addMember(block1);
    layout.addMember(v2);

    this.ruleBlockLayout.addMember(layout);
}