// $Revision: 1.14 $ // PickerPresenter.C // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_PICKERPRESENTER #include "PickerPresenter.h" #endif #ifndef TaligentSamples_PICKERMODEL #include "PickerModel.h" #endif #ifndef TaligentSamples_PICKERVIEW #include "PickerView.h" #endif #ifndef TaligentSamples_STOCKCALLER #include #endif #ifndef Taligent_LOCALSERVICE #include #endif #ifndef Taligent_SCROLLINGVIEW #include #endif //============================================================================== // TEmptyPickerPresenter TaligentTypeExtensionMacro(TEmptyPickerPresenter); TEmptyPickerPresenter::TEmptyPickerPresenter() : TGUIPresenter(), fPrinting(false) { } TEmptyPickerPresenter::TEmptyPickerPresenter( const TEmptyPickerPresenter& source) : TGUIPresenter(source), fPrinting(false) { } TEmptyPickerPresenter::TEmptyPickerPresenter( const TGUIBundle& bundle) : TGUIPresenter(bundle), fPrinting(false) { } TEmptyPickerPresenter::~TEmptyPickerPresenter() { } TStream& TEmptyPickerPresenter::operator>>=(TStream& toStream) const { ::WriteVersion(toStream, kOriginalVersion); TGUIPresenter::operator>>=(toStream); return toStream; } TStream& TEmptyPickerPresenter::operator<<=(TStream& fromStream) { ::ReadVersion(fromStream, kOriginalVersion, kOriginalVersion); TGUIPresenter::operator<<=(fromStream); return fromStream; } TView* TEmptyPickerPresenter::HandleCreateMainView(TGUIBundle* bundleToAlias) const { static const TColor& kWhite = *TColorPaint::GetWhite().GetColor(); TView* mainView = new TPickerView(bundleToAlias); if (!fPrinting) { TScrollingView* scrollView = new TScrollingView(TScrollingView::kBothScrollbars); scrollView->AdoptClipBackgroundBundle(new TGrafBundle(kWhite, kWhite)); scrollView->AdoptViewToScroll(mainView); mainView = scrollView; } return mainView; } void TEmptyPickerPresenter::HandlePrint(const TPrinter& printer) { try { fPrinting = true; TGUIPresenter::HandlePrint(printer); fPrinting = false; } catch (...) { fPrinting = false; throw; } } //============================================================================== // TStandardPickerPresenter TaligentTypeExtensionMacro(TStandardPickerPresenter); TStandardPickerPresenter::TStandardPickerPresenter() : TEmptyPickerPresenter() { } TStandardPickerPresenter::TStandardPickerPresenter( const TStandardPickerPresenter& source) : TEmptyPickerPresenter(source) { } TStandardPickerPresenter::TStandardPickerPresenter( const TGUIBundle& bundle) : TEmptyPickerPresenter(bundle) { } TStandardPickerPresenter::~TStandardPickerPresenter() { } TStream& TStandardPickerPresenter::operator>>=(TStream& toStream) const { ::WriteVersion(toStream, kOriginalVersion); TEmptyPickerPresenter::operator>>=(toStream); return toStream; } TStream& TStandardPickerPresenter::operator<<=(TStream& fromStream) { ::ReadVersion(fromStream, kOriginalVersion, kOriginalVersion); TEmptyPickerPresenter::operator<<=(fromStream); return fromStream; } void TStandardPickerPresenter::HandleOpen() { TEmptyPickerPresenter::HandleOpen(); try { TModelPointerTo model(GetModelReference()); TStockCaller server(TStockCaller::CreateLocalServiceReference()); TPseudoTimeStamp serverTimeStamp(server.GetTimeStamp()); if (!model->GetStockTimeStamp().IsAsRecentAs(serverTimeStamp)) { TDequeOf stocks( new TOperatorComparator, new TPolymorphicStreamer); server.CopyAllStocks(stocks); model->AdoptStocks(stocks); model->SetStockTimeStamp(serverTimeStamp); } } catch (const TCompoundDocumentException& exception) { } }