① 求一個完整的javaweb項目的購物網站源代碼
JAVA WEB項目的網路購物網站源代碼的話,很復雜的話,肯定是沒有的,你可以去eoe或者安卓巴士網站看看有沒有源碼
② 求一套完整的JAVA WEB項目的網路購物網站源代碼
/**
*@description:
*@authorchenshiqiangE-mail:[email protected]
*@date2014年9月7日下午2:51:50
*@version1.0
*/
packagecom.example.map;
importjava.util.ArrayList;
importjava.util.Collections;
importjava.util.HashSet;
importjava.util.List;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.support.v4.view.PagerAdapter;
importandroid.support.v4.view.PagerTabStrip;
importandroid.support.v4.view.ViewPager;
importandroid.text.Editable;
importandroid.util.Log;
importandroid.view.LayoutInflater;
importandroid.view.View;
importandroid.view.ViewGroup;
importandroid.widget.ExpandableListView;
importandroid.widget.ListView;
importcom..mapapi.map.offline.MKOLSearchRecord;
importcom..mapapi.map.offline.MKOLUpdateElement;
importcom..mapapi.map.offline.MKOfflineMap;
importcom..mapapi.map.offline.MKOfflineMapListener;
importcom.example.map.adapters.OfflineExpandableListAdapter;
importcom.example.map.adapters.OfflineMapAdapter;
importcom.example.map.adapters.OfflineMapManagerAdapter;
importcom.example.map.interfaces.;
importcom.example.map.models.OfflineMapItem;
importcom.example.map.utils.CsqBackgroundTask;
importcom.example.map.utils.ToastUtil;
importcom.example.system.R;
istener,
{
//------------------------Constants------------------------
//-------------------------Fields--------------------------
privateViewPagerviewpager;
privatePagerTabStrippagertab;
privateMySearchViewsvDown;
privateListViewlvDown;
privateMySearchViewsvAll;
;
privateListViewlvSearchResult;
privateList<View>views=newArrayList<View>(2);
privateList<String>titles=newArrayList<String>(2);
privateMKOfflineMapmOffline=null;
;
;
;
privateList<OfflineMapItem>itemsDown;//下載或下載中城市
privateList<OfflineMapItem>itemsAll;//所有城市,與熱門城市及下載管理對象相同
privateList<OfflineMapItem>itemsProvince;
privateList<List<OfflineMapItem>>itemsProvinceCity;
//-----------------------Constructors----------------------
//--------Methodsfor/fromSuperClass/Interfaces-----------
@Override
protectedvoidonCreate(BundlesavedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_offline_map);
// finalStringpackname=this.getPackageName();
// PackageInfopackageInfo;
// try
// {
// packageInfo=this.getPackageManager().getPackageInfo(packname,PackageManager.GET_SIGNATURES);
//
//
// if(code==-00)
// {
//初始化離線地圖管理
mOffline=newMKOfflineMap();
mOffline.init(this);
initViews();
viewpager.setCurrentItem(1);
// }
// }
// catch(NameNotFoundExceptione)
// {
// e.printStackTrace();
// }
}
privatebooleanisResumed=false;
@Override
protectedvoidonResume()
{
super.onResume();
if(!isResumed)
{
isResumed=true;
loadData();
}
}
@Override
protectedvoidonDestroy()
{
super.onDestroy();
mOffline.destroy();
}
/**
*
*@authorchenshiqiangE-mail:[email protected]
*@paramtype
*事件類型:MKOfflineMap.TYPE_NEW_OFFLINE,MKOfflineMap.TYPE_DOWNLOAD_UPDATE,MKOfflineMap.TYPE_VER_UPDATE.
*@paramstate
*事件狀態:當type為TYPE_NEW_OFFLINE時,表示新安裝的離線地圖數目.當type為TYPE_DOWNLOAD_UPDATE時,表示更新的城市ID.
*/
@Override
(inttype,intstate)
{
switch(type)
{
caseMKOfflineMap.TYPE_DOWNLOAD_UPDATE:
MKOLUpdateElementupdate=mOffline.getUpdateInfo(state);
if(setElement(update,true)!=null)
{
if(itemsDown!=null&&itemsDown.size()>1)
{
Collections.sort(itemsDown);
}
refreshDownList();
}
else
{
downAdapter.notifyDataSetChanged();
}
allSearchAdapter.notifyDataSetChanged();
allCountryAdapter.notifyDataSetChanged();
break;
caseMKOfflineMap.TYPE_NEW_OFFLINE:
//有新離線地圖安裝
Log.d("OfflineDemo",String.format("addofflinemapnum:%d",state));
break;
caseMKOfflineMap.TYPE_VER_UPDATE:
//版本更新提示
break;
}
}
/**
*網路下載狀態改變(暫停--》恢復)居然不回調,所以改變狀態時自己得增加介面監聽狀態改變刷新界面
*
*@authorchenshiqiangE-mail:[email protected]
*@paramitem
*有狀態改變的item
*@paramremoved
*item是否被刪除
*/
@Override
publicvoidstatusChanged(OfflineMapItemitem,booleanremoved)
{
if(removed)
{
for(inti=itemsDown.size()-1;i>=0;i--)
{
OfflineMapItemtemp=itemsDown.get(i);
if(temp.getCityId()==item.getCityId())
{
itemsDown.remove(i);
}
}
refreshDownList();
}
else
{
loadData();
downAdapter.notifyDataSetChanged();
}
allSearchAdapter.notifyDataSetChanged();
allCountryAdapter.notifyDataSetChanged();
}
//---------------------Methodspublic----------------------
publicvoidtoDownloadPage()
{
viewpager.setCurrentItem(0);
}
//---------------------Methodsprivate---------------------
privatevoidinitViews()
{
//TODO
viewpager=(ViewPager)findViewById(R.id.viewpager);
pagertab=(PagerTabStrip)findViewById(R.id.pagertab);
LayoutInflaterinf=LayoutInflater.from(this);
Viewv1=inf.inflate(R.layout.view_offline_download,null,false);
svDown=(MySearchView)v1.findViewById(R.id.svDown);
lvDown=(ListView)v1.findViewById(R.id.lvDown);
views.add(v1);
Viewv2=inf.inflate(R.layout.view_offline_countrys,null,false);
svAll=(MySearchView)v2.findViewById(R.id.svAll);
lvWholeCountry=(ExpandableListView)v2.findViewById(R.id.lvWholeCountry);
lvSearchResult=(ListView)v2.findViewById(R.id.lvSearchResult);
views.add(v2);
titles.add("下載管理");
titles.add("城市列表");
pagertab.setTabIndicatorColor(0xff00cccc);
pagertab.setDrawFullUnderline(false);
pagertab.setBackgroundColor(0xFF38B0DE);
pagertab.setTextSpacing(50);
viewpager.setOffscreenPageLimit(2);
viewpager.setAdapter(newMyPagerAdapter());
svDown.setSearchListener(newMySearchView.SearchListener()
{
@Override
publicvoidafterTextChanged(Editabletext)
{
refreshDownList();
}
@Override
publicvoidsearch(Stringtext)
{
}
});
svAll.setSearchListener(newMySearchView.SearchListener()
{
@Override
publicvoidafterTextChanged(Editabletext)
{
refreshAllSearchList();
}
@Override
publicvoidsearch(Stringtext)
{
}
});
downAdapter=newOfflineMapManagerAdapter(this,mOffline,this);
lvDown.setAdapter(downAdapter);
allSearchAdapter=newOfflineMapAdapter(this,mOffline,this);
lvSearchResult.setAdapter(allSearchAdapter);
allCountryAdapter=(this,mOffline,this);
lvWholeCountry.setAdapter(allCountryAdapter);
lvWholeCountry.setGroupIndicator(null);
}
/**
*刷新下載列表,根據搜索關鍵字及itemsDown下載管理數量變動時調用
*/
privatevoidrefreshDownList()
{
Stringkey=svDown.getInputText();
if(key==null||key.length()<1)
{
downAdapter.setDatas(itemsDown);
}
else
{
List<OfflineMapItem>filterList=newArrayList<OfflineMapItem>();
if(itemsDown!=null&&!itemsDown.isEmpty())
{
for(OfflineMapItemi:itemsDown)
{
if(i.getCityName().contains(key))
{
filterList.add(i);
}
}
}
downAdapter.setDatas(filterList);
}
}
/**
*刷新所有城市搜索結果
*/
()
{
Stringkey=svAll.getInputText();
if(key==null||key.length()<1)
{
lvSearchResult.setVisibility(View.GONE);
lvWholeCountry.setVisibility(View.VISIBLE);
allSearchAdapter.setDatas(null);
}
else
{
lvSearchResult.setVisibility(View.VISIBLE);
lvWholeCountry.setVisibility(View.GONE);
List<OfflineMapItem>filterList=newArrayList<OfflineMapItem>();
if(itemsAll!=null&&!itemsAll.isEmpty())
{
for(OfflineMapItemi:itemsAll)
{
if(i.getCityName().contains(key))
{
filterList.add(i);
}
}
}
allSearchAdapter.setDatas(filterList);
}
}
privatevoidloadData()
{
newCsqBackgroundTask<Void>(this)
{
@Override
protectedVoidonRun()
{
//TODOAuto-generatedmethodstub
//導入離線地圖包
//將從官網下載的離線包解壓,把vmp文件夾拷入SD卡根目錄下的BaiMapSdk文件夾內。
//把網站上下載的文件解壓,將BaiMapvmpl裡面的.dat_svc文件,拷貝到手機BaiMapSDK/vmp/h目錄下
intnum=mOffline.importOfflineData();
if(num>0)
{
ToastUtil.showToastInfo(BaiOfflineMapActivity.this,"成功導入"+num+"個離線包",false);
}
List<MKOLSearchRecord>all=null;
try
{
all=mOffline.getOfflineCityList();
}
catch(Exceptione)
{
e.printStackTrace();
}
if(all==null||all.isEmpty())
{
ToastUtil.showToastInfo(BaiOfflineMapActivity.this,"未獲取到離線地圖城市數據,可能有其他應用正在使用網路離線地圖功能!",false);
returnnull;
}
List<MKOLSearchRecord>hotCity=mOffline.getHotCityList();
HashSet<Integer>hotCityIds=newHashSet<Integer>();
if(!hotCity.isEmpty())
{
for(MKOLSearchRecordr:hotCity)
{
hotCityIds.add(r.cityID);
}
}
itemsAll=newArrayList<OfflineMapItem>();
itemsDown=newArrayList<OfflineMapItem>();
itemsProvince=newArrayList<OfflineMapItem>();
itemsProvinceCity=newArrayList<List<OfflineMapItem>>();
//cityType0:全國;1:省份;2:城市,如果是省份,可以通過childCities得到子城市列表
//全國概略圖、直轄市、港澳子城市列表
ArrayList<MKOLSearchRecord>childMunicipalities=newArrayList<MKOLSearchRecord>();
proHot.cityName="熱門城市";
proHot.childCities=cs;
List<MKOLUpdateElement>updates=mOffline.getAllUpdateInfo();
if(updates!=null&&updates.size()>0)
{
}
@Override
protectedvoidonResult(Voidresult)
{
//TODOAuto-generatedmethodstub
refreshDownList();
refreshAllSearchList();
allCountryAdapter.setDatas(itemsProvince,itemsProvinceCity);
}
}.execute();
}