Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package org.litesoft.datt.client.ui.views.stories;

import org.litesoft.GWT.client.view.*;
import org.litesoft.GWT.client.widgets.*;
import org.litesoft.GWT.client.widgets.datatables.*;
import org.litesoft.GWT.forms.client.*;
import org.litesoft.bo.views.*;
import org.litesoft.datt.client.*;
import org.litesoft.datt.client.boviews.*;
import org.litesoft.datt.client.support.*;
import org.litesoft.datt.client.ui.widgets.*;
import org.litesoft.uispecification.*;

import com.google.gwt.user.client.ui.*;

import static org.litesoft.uispecification.FormWidgetCtrl.*;

public class MergeStoriesStepTwo extends ScreenView implements StoryFindable,
                                                               StoryViewNames,
                                                               TableClickCommand<StoryView>,
                                                               ViewUpdatable<StoryView> {
    private QBE_FormEngine mFE;

    private StoryViewDataProvider mDataProvider = StoryViewDataProvider.getInstance();
    private FormBinder<StoryView> mFormBinder0, mFormBinder1;

    private ObjectURL mStory0 = null;
    private ObjectURL mStory1 = null;

    @Override
    protected UriFragmentIdParams createRefreshParams() {
        return MergeStoriesStepTwoFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) );
    }

    public MergeStoriesStepTwo( String pSection, ViewDef pViewDef, TwoStoryURLs pTwoStoryURLs ) {
        super( title( pSection, pViewDef ) );

        if ( pTwoStoryURLs != null ) {
            mStory0 = pTwoStoryURLs.getStory0();
            mStory1 = pTwoStoryURLs.getStory1();
        }
        //todo: if no mStory0 show error and go back to MergeStory (lookup)
        addStandardTitleBar();

        addLeft( BackButton.factory( "Change From" ).add( ViewDefs.STORY_MERGE_STORIES, new UriFragmentIdParams.ScreenParamsFactory() {
            @Override
            public UriFragmentIdParams create( ViewDef pTarget ) {
                return MergeStoriesFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) );
            }
        } ).create() );

        SizeableVerticalPanel zUpperPanel = new SizeableVerticalPanel().stretchable();

        zUpperPanel.add( createSectionTitle( "Story to merge From" ) );
        zUpperPanel.add( new StoryInfoPanel( mFormBinder0 = new FormBinder<StoryView>( new FormEngine( new WidgetCtrlMap( VISIBLE_BUT_DISABLED ), //
                                                                                                       FormEngine.Mode.ViewRegular, null ), //
                                                                                       StoryViewMetaData.getInstance() ) ) );

        QBEscreenSupport zQBEscreenSupport = new QBEscreenSupport();
        SizeableVerticalPanel zFormPanel = zQBEscreenSupport.getQBEleft();
        SizeableQBEboxedPanel zQBEboxedPanel = zQBEscreenSupport.getQBEboxedPanel();

        FilteringTableModel<StoryView> zFilter =
                new FilteringTableModel<StoryView>( mDataProvider, true, this, null, false ); // Second 'this' allows auto "New"
        StoryViewTable zTable = new StoryViewTable( zFilter, this );
        zQBEboxedPanel.setWidget( zFilter.addReloadable( zTable ) );

        WidgetCtrlMap zWidgetCtrlMap = StoryFieldsPanel.createWidgetCtrlMap( VISIBLE_AND_ACTIVE_ENABLED );

        mFE = new QBE_FormEngine( zWidgetCtrlMap, null, zQBEboxedPanel, zFilter, zFilter );

        zFormPanel.add( mFE.createSectionTitle( "Story to merge Into" ) );

        zFormPanel.add( new StoryFieldsPanel( mFormBinder1 = new FormBinder<StoryView>( mFE, //
                                                                                        StoryViewMetaData.getInstance() ), mFE, null ) );

        add( new SizeableVerticalSplitPairPanel().stretchable().add( zUpperPanel, zQBEscreenSupport ) );
    }

    @Override
    public void aboutToShow() {
        super.aboutToShow();
        StoryScreenViewHelper.requestRequiredStory( this, mStory0, 0 );
    }

    @Override
    public void foundStory( StoryView pStoryView, Integer pRequestID ) {
        if ( pRequestID == 1 ) {
            modeEdit( pStoryView );
            return;
        }
        mFormBinder0.setExistingObject( pStoryView, FormEngine.Mode.ViewRegular );
        ObjectURL zStory = mStory1;
        modeSearch(); // clears mStory
        StoryScreenViewHelper.requestOptionalStory( this, zStory, 1 );
    }

    @Override
    protected void justLoaded() {
        super.justLoaded();
        mFE.setFocus();
    }

    @Override
    public void execute( StoryView pRowValue ) {
        if ( pRowValue != null ) {
            modeEdit( pRowValue );
        }
    }

    private void modeSearch() {
        mStory1 = null;
        mFE.setMode( FormEngine.Mode.Search );
    }

    private void modeEdit( StoryView pStoryView ) {
        mStory1 = pStoryView.getObjectURL();
        mFormBinder1.setExistingObject( mDataProvider.copyIntoNewTS( pStoryView ), FormEngine.Mode.EditFromSearch );
    }

    @Override
    public Widget getBottomBar() {
        LeftCenterRightHorizontalPanel zActionPanel = new LeftCenterRightHorizontalPanel();

        zActionPanel.addLeft( mFE.addEditRevertButton( createRevertButton() ) );
        zActionPanel.addCenter( mFE.addEditSubmitButton( createSubmitButton( mDataProvider, mFormBinder1, this ) ) );
        zActionPanel.addRight( mFE.addExistingUnchangedNextButton( true, ViewDefs.STORY_MERGE_STORIES_STEP_THREE, new UriFragmentIdParams.ScreenParamsFactory() {
            @Override
            public UriFragmentIdParams create( ViewDef pTarget ) {
                return MergeStoriesStepThreeFactory.encodeParams( new TwoStoryURLs( mStory0, mStory1 ) );
            }
        } ) );
        return zActionPanel;
    }

    @Override
    public void viewUpdated( StoryView pStoryView ) {
        modeEdit( pStoryView );
    }
}

Commits for litesoft/trunk/Java/DATT/src/org/litesoft/datt/client/ui/views/stories/MergeStoriesStepTwo.java

Diff revisions: vs.
Revision Author Commited Message
948 Diff Diff GeorgeS picture GeorgeS Sat 07 Jun, 2014 23:42:39 +0000

Jusefuls Formatter Updated to New Code Format

566 Diff Diff markcmarkc Mon 14 Nov, 2011 01:45:18 +0000
565 Diff Diff markcmarkc Sun 13 Nov, 2011 21:45:35 +0000
539 Diff Diff markcmarkc Mon 03 Oct, 2011 00:35:01 +0000
501 Diff Diff markcmarkc Sun 11 Sep, 2011 22:50:22 +0000

Added a customer

496 Diff Diff GeorgeS picture GeorgeS Sun 11 Sep, 2011 16:58:00 +0000
430 GeorgeS picture GeorgeS Sat 20 Aug, 2011 19:46:21 +0000