com.smartgwt.client.widgets.layout.HLayout Java Examples

The following examples show how to use com.smartgwt.client.widgets.layout.HLayout. 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: LegendEntryTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createLegendTools() {
	HLayout tools = new HLayout();

	createColorChangeButton();
	tools.addMember(this.titleCol);

	if (ClientUtils.isSesEnabled()) {
		createSesCommunicatorButton();
		tools.addMember(this.sesComButton);
           if (isEventingEnabledFor(getTimeSeries().getProperties().getServiceUrl())) {
               createSesCommunicatorButton();
               tools.addMember(this.sesComButton);
           }
	}

	createInformationButton();
	tools.addMember(this.infoButton);

	createDeleteLegendEntryButton();
	tools.addMember(this.deleteButton);

	return tools;
}
 
Example #3
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 #4
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 #5
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 #6
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 #7
Source File: UpdatePanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void prepareTabs() {
	propertiesTab = new Tab(I18N.message("properties"));
	propertiesTabPanel = new HLayout();
	propertiesTabPanel.setWidth100();
	propertiesTabPanel.setHeight100();
	propertiesTab.setPane(propertiesTabPanel);

	extendedPropertiesTab = new Tab(I18N.message("propertiesext"));
	extendedPropertiesTabPanel = new HLayout();
	extendedPropertiesTabPanel.setWidth100();
	extendedPropertiesTabPanel.setHeight100();
	extendedPropertiesTab.setPane(extendedPropertiesTabPanel);

	ocrTab = new Tab(I18N.message("ocr"));
	ocrTabPanel = new HLayout();
	ocrTabPanel.setWidth100();
	ocrTabPanel.setHeight100();
	ocrTab.setPane(ocrTabPanel);

	retentionPoliciesTab = new Tab(I18N.message("publishing"));
	retentionPoliciesTabPanel = new HLayout();
	retentionPoliciesTabPanel.setWidth100();
	retentionPoliciesTabPanel.setHeight100();
	retentionPoliciesTab.setPane(retentionPoliciesTabPanel);

	notificationTab = new Tab(I18N.message("notifyusers"));
	notificationTabPanel = new HLayout();
	notificationTabPanel.setWidth100();
	notificationTabPanel.setHeight100();
	notificationTab.setPane(notificationTabPanel);
}
 
Example #8
Source File: ProfileWindow.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void loadWindowContent() {
    if (userDataLayout != null) {
        userDataLayout.clearValues();
    }
    content = new HLayout();
    content.addMember(createEditProfileLayout());
    content.addMember(createSubcriptionsLayout());
    content.setStyleName("n52_sensorweb_client_form_content");
    addItem(content);
    setTitle(i18n.editUserData());
    markForRedraw();
}
 
Example #9
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 #10
Source File: WorkflowTasksView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Canvas createTaskLayout() {
    VLayout left = new VLayout();
    left.addMember(createToolbar());
    left.addMember(createTaskList());
    HLayout l = new HLayout();
    l.addMember(left);
    l.addMember(createTaskFormLayout());
    return l;
}
 
Example #11
Source File: ArchiveDetailsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ArchiveDetailsPanel(ExportArchivesList list, long archiveId, boolean readonly) {
	super();

	this.archiveId = archiveId;
	this.readonly = readonly;
	this.archivesList = list;

	setHeight100();
	setWidth100();
	setMembersMargin(10);

	tabSet = new TabSet();
	tabSet.setTabBarPosition(Side.TOP);
	tabSet.setTabBarAlign(Side.LEFT);
	tabSet.setWidth100();
	tabSet.setHeight100();

	Tab versionsTab = new Tab(I18N.message("documents"));
	versionsTabPanel = new HLayout();
	versionsTabPanel.setWidth100();
	versionsTabPanel.setHeight100();
	versionsTab.setPane(versionsTabPanel);
	tabSet.addTab(versionsTab);

	addMember(tabSet);

	refresh();
}
 
Example #12
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 #13
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 #14
Source File: DigitalObjectEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public DigitalObjectEditor(ClientMessages i18n, PlaceController places, boolean embedded) {
    this.i18n = i18n;
    this.places = places;
    this.editorCache = new EnumMap<DatastreamEditorType, EditorDescriptor>(DatastreamEditorType.class);
    this.widget = new VLayout();
    this.lblHeader = new Label();
    lblHeader.setAutoHeight();
    lblHeader.setPadding(4);
    lblHeader.setStyleName(Editor.CSS_PANEL_DESCRIPTION_TITLE);
    this.actionSource = new ActionSource(this);
    this.embeddedView = embedded;
    this.toolbar = Actions.createToolStrip();
    this.editorContainer = new VLayout();
    editorContainer.setLayoutMargin(4);
    editorContainer.setWidth100();
    editorContainer.setHeight100();

    widget.addMember(lblHeader);
    widget.addMember(toolbar);

    if (embedded) {
        widget.addMember(editorContainer);
    } else {
        editorContainer.setResizeBarTarget("next");
        HLayout multiView = new HLayout();
        multiView.setWidth100();
        multiView.setHeight100();
        multiView.setLayoutMargin(4);
        multiView.addMember(editorContainer);
        initOptionalEditor(multiView);
        widget.addMember(multiView);
    }
}
 
Example #15
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 #16
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 #17
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 #18
Source File: EventSubscriptionWindow.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void loadWindowContent() {
    content = new HLayout();
    content.setStyleName("n52_sensorweb_client_create_abo_window_content");
    content.addMember(createSubscribeAndHelpContent());
    setTitle(i18n.createAboWindowTitle());
    addItem(content);
    markForRedraw();
}
 
Example #19
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 #20
Source File: CreateComplexRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private HLayout createSingle(String ruleName){
    this.singleCount++;
    
    DynamicForm block1 = new DynamicForm();
    block1.setWidth("50%");
    block1.setNumCols(1);
    
    DynamicForm block2 = new DynamicForm();
    block2.setWidth("50%");
    block2.setNumCols(1);
    
    SelectItem rule1Item = new SelectItem();
    rule1Item.setShowTitle(false);
    rule1Item.setValueMap(this.rulesHashMap);
    rule1Item.setWidth(this.selectItemWidth);
    if (ruleName != null) {
        rule1Item.setValue(ruleName);
    }
    
    SpacerItem spacerItem = new SpacerItem();
    spacerItem.setShowTitle(false);
    spacerItem.setHeight(20);
    
    block2.setFields(rule1Item);

    HLayout layout = new HLayout();
    layout.setWidth(200);
    layout.setHeight(25);
    layout.addMember(block1);
    layout.addMember(block2);

    // save tree
    this.tempTree = this.rootTree;
    Tree right = new Tree(rule1Item, null, null);

    this.rootTree = new Tree(this.singleOperator, this.tempTree, right);

    return layout;
}
 
Example #21
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 #22
Source File: StatusBar.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public StatusBar(boolean includeIcons) {
	setHeight(20);
	setWidth100();
	setMembersMargin(2);
	setStyleName("footer");

	HLayout events = EventPanel.get();
	events.setWidth100();

	addMember(events);

	if (includeIcons)
		addMember(StatusBarIcons.get());
}
 
Example #23
Source File: Header.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void generateHeader(){

        setStyleName("n52_sensorweb_client_headerContainer");
        setBackgroundImage("../img/52n_bg.png");
        setAutoHeight();

        addMember(getHomeLabel());

        Layout rightLayout = new VLayout();
        Layout linkLayout = new HLayout();
        linkLayout.setStyleName("n52_sensorweb_client_linkBlock");
        linkLayout.setAlign(Alignment.RIGHT);

//        linkLayout.addMember(getVersionInfo());
//        linkLayout.addMember(getSeparator());
        
        // temporary button for metadata reset
        //linkLayout.addMember(getMetadatareset());
        //linkLayout.addMember(getSeparator());
        
        linkLayout.addMember(getPermalinkLink());
        linkLayout.addMember(getSeparator());
        linkLayout.addMember(getHelpLink());
        linkLayout.addMember(getSeparator());
        linkLayout.addMember(getAddBookmarkLink());
        linkLayout.addMember(getSeparator());
        linkLayout.addMember(getImprintLink());
        linkLayout.addMember(getSeparator());
        linkLayout.addMember(getCopyrightLink());
        rightLayout.addMember(linkLayout);
        
        if (ClientUtils.isSesEnabled()) {
        	rightLayout.addMember(createLoginInfo());
        }
        
        addMember(rightLayout);
    }
 
Example #24
Source File: View.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private Layout getDataViewAndLegendPanel() {
    HLayout hLayout = new HLayout();
    hLayout.setOverflow(Overflow.HIDDEN);
    hLayout.addMember(getLegend());
    hLayout.addMember(getLegendHider());
    hLayout.addMember(getDataPanel());
    hLayout.setTabIndex( -1);
    return hLayout;
}
 
Example #25
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);
}
 
Example #26
Source File: DataControlsTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public HLayout getBootomLayout() {
    return this.bottomLayout;
}
 
Example #27
Source File: DataControlsTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public HLayout getTopLayout() {
    return this.topLayout;
}
 
Example #28
Source File: DataControlsTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public HLayout getButtonLayout() {
	return buttonLayout;
}
 
Example #29
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 #30
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);
                        }
                    });
                }
            }
        });
    }