本文整理汇总了Java中net.sf.memoranda.ProjectManager.removeProject方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectManager.removeProject方法的具体用法?Java ProjectManager.removeProject怎么用?Java ProjectManager.removeProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.memoranda.ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.removeProject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tearDown
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
ProjectManager.removeProject(tp1.getID());
ProjectManager.removeProject(tp2.getID());
ProjectManager.removeProject(tp3.getID());
ProjectManager.removeProject(tp4.getID());
ProjectManager.removeProject(tp5.getID());
}
示例2: testRemove
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
@Test
public void testRemove(){
int totalBefore = ProjectManager.getAllProjectsNumber();
ProjectManager.removeProject(tp1.getID());
ProjectManager.removeProject(tp4.getID());
assertEquals(totalBefore-2,ProjectManager.getAllProjectsNumber());
Vector allProj = ProjectManager.getAllProjects();
boolean correctProj = true;
for(Object o: allProj){
correctProj &= !((Project)o).getTitle().equals("testProj1") && !((Project)o).getTitle().equals("testProj4");
}
assertTrue(correctProj);
}
示例3: ppDeleteProject_actionPerformed
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
void ppDeleteProject_actionPerformed(ActionEvent e) {
String msg;
Project prj;
Vector toremove = new Vector();
if (prjTablePanel.projectsTable.getSelectedRows().length > 1) {
msg = Local.getString("Delete") + " " + prjTablePanel.projectsTable.getSelectedRows().length + " "
+ Local.getString("projects") + "\n" + Local.getString("Are you sure?");
} else {
prj = prjTablePanel.getSelectedProject();
msg = Local.getString("Delete project") + " '" + prj.getTitle() + "'.\n" + Local.getString("Are you sure?");
}
int n = JOptionPane.showConfirmDialog(App.getFrame(), msg, Local.getString("Delete project"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) {
return;
}
for (int i = 0; i < prjTablePanel.projectsTable.getSelectedRows().length; i++) {
prj = (net.sf.memoranda.Project) prjTablePanel.projectsTable.getModel()
.getValueAt(prjTablePanel.projectsTable.getSelectedRows()[i], ProjectsTablePanel.PROJECT);
toremove.add(prj.getID());
}
for (int i = 0; i < toremove.size(); i++) {
ProjectManager.removeProject((String) toremove.get(i));
}
CurrentStorage.get().storeProjectManager();
prjTablePanel.projectsTable.clearSelection();
prjTablePanel.updateUI();
setMenuEnabled(false);
}
示例4: BDeleteProject_actionPerformed
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
public void BDeleteProject_actionPerformed(ActionEvent e) {
String msg;
Project prj;
prj = CurrentProject.get();
msg = Local.getString("Delete project")
+ " '"
+ prj.getTitle()
+ "'.\n"
+ Local.getString("Are you sure?");
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Delete project"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION)
return;
if(ProjectManager.getActiveProjectsNumber() > 1)
if(((Project)ProjectManager.getActiveProjects().toArray()[1]).equals(prj))
CurrentProject.set((Project)(ProjectManager.getActiveProjects().toArray()[0]));
else
CurrentProject.set((Project)(ProjectManager.getActiveProjects().toArray()[1]));
else
CurrentProject.set(ProjectManager.createProject("Default Project", CalendarDate.today(), null));
ProjectManager.removeProject(prj.getID());
CurrentProject.set(CurrentProject.get());
CurrentStorage.get().storeProjectManager();
prjTablePanel.projectsTable.clearSelection();
prjTablePanel.updateUI();
setMenuEnabled(false);
AgendaPanel.refresh(CalendarDate.today());
}
示例5: testNormalDeleteProject
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
/**
* Tests an appropriate project deletion.
*/
@Test
public void testNormalDeleteProject() {
if(allProj < 1) {
ProjectManager.createProject("Default", CalendarDate.today(), null);
}
ProjectManager.removeProject("1");
assertTrue(allProj-1 == ProjectManager.getAllProjectsNumber());
}
示例6: testDeleteProjectRefresh
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
@Test
public void testDeleteProjectRefresh() {
AgendaPanel.setRefreshCount(0);
ProjectManager.removeProject("My Project6");
ProjectManager.removeProject("My Project5");
ProjectManager.removeProject("My Project4");
ProjectManager.removeProject("My Project3");
ProjectManager.removeProject("My Project2");
assert(AgendaPanel.getRefreshCount() == 5);
}
示例7: ppDeleteProject_actionPerformed
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
void ppDeleteProject_actionPerformed(ActionEvent e) {
String msg;
Project prj;
Vector toremove = new Vector();
if (prjTablePanel.projectsTable.getSelectedRows().length > 1)
msg =
Local.getString("Delete")
+ " "
+ prjTablePanel.projectsTable.getSelectedRows().length
+ " "
+ Local.getString("projects")
+ "\n"
+ Local.getString("Are you sure?");
else {
prj = prjTablePanel.getSelectedProject();
msg =
Local.getString("Delete project")
+ " '"
+ prj.getTitle()
+ "'.\n"
+ Local.getString("Are you sure?");
}
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Delete project"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION)
return;
for (int i = 0;
i < prjTablePanel.projectsTable.getSelectedRows().length;
i++) {
prj =
(net.sf.memoranda.Project) prjTablePanel
.projectsTable
.getModel()
.getValueAt(
prjTablePanel.projectsTable.getSelectedRows()[i],
ProjectsTablePanel.PROJECT);
toremove.add(prj.getID());
}
for (int i = 0; i < toremove.size(); i++) {
ProjectManager.removeProject((String) toremove.get(i));
}
CurrentStorage.get().storeProjectManager();
prjTablePanel.projectsTable.clearSelection();
prjTablePanel.updateUI();
setMenuEnabled(false);
}
示例8: tearDown
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
@After
public void tearDown() {
ProjectManager.removeProject(project1.getID());
ProjectManager.removeProject(project2.getID());
CurrentStorage.get().storeProjectManager();
}
示例9: tearDown
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
@AfterClass
public static void tearDown() {
ProjectManager.removeProject(project1.getID());
ProjectManager.removeProject(project2.getID());
CurrentStorage.get().storeProjectManager();
}
示例10: removeProject_actionPerformed
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
void removeProject_actionPerformed(ActionEvent e) {
String msg;
Project prj;
Vector toremove = new Vector();
if (mainPanel.projectsTable.getSelectedRows().length > 1){
msg =
Local.getString("Delete")
+ " "
+ mainPanel.projectsTable.getSelectedRows().length
+ " "
+ Local.getString("projects")
+ "\n"
+ Local.getString("Are you sure?");
} else {
prj = mainPanel.getSelectedProject();
msg =
Local.getString("Delete project")
+ " '"
+ prj.getTitle()
+ "'.\n"
+ Local.getString("Are you sure?");
}
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Delete project"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION){
return;
}
for (int i = 0;i < mainPanel.projectsTable.getSelectedRows().length;i++) {
prj =
(net.sf.memoranda.Project) mainPanel
.projectsTable
.getModel()
.getValueAt(
mainPanel.projectsTable.getSelectedRows()[i],
ProjectsTablePanel.PROJECT);
toremove.add(prj.getID());
}
for (int i = 0; i < toremove.size(); i++) {
ProjectManager.removeProject((String) toremove.get(i));
}
CurrentStorage.get().storeProjectManager();
mainPanel.projectsTable.clearSelection();
mainPanel.updateUI();
//setMenuEnabled(false);
}
示例11: unpack
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
public static void unpack(File zipfile) {
try {
ZipFile zip = new ZipFile(zipfile);
ZipEntry info = zip.getEntry("__PROJECT_INFO__");
BufferedReader in = new BufferedReader(new InputStreamReader(zip.getInputStream(info), "UTF-8"));
String pId = in.readLine();
String pTitle = in.readLine();
String pStartD = in.readLine();
String pEndD = in.readLine();
in.close();
if (ProjectManager.getProject(pId) != null) {
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
Local.getString("This project is already exists and will be replaced.\nContinue?"),
Local.getString("Project is already exists"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) {
zip.close();
return;
}
ProjectManager.removeProject(pId);
}
Project prj = ProjectManager.createProject(pId, pTitle, new CalendarDate(pStartD), null);
if (pEndD != null)
prj.setEndDate(new CalendarDate(pEndD));
//File prDir = new File(JN_DOCPATH + prj.getID());
Enumeration files;
for (files = zip.entries(); files.hasMoreElements();){
ZipEntry ze = (ZipEntry)files.nextElement();
if ( ze.isDirectory() )
{
File theDirectory = new File(JN_DOCPATH + prj.getID()+ "/" + ze.getName() );
// create this directory (including any necessary parent directories)
theDirectory.mkdirs();
theDirectory = null;
}
if ((!ze.getName().equals("__PROJECT_INFO__")) && (!ze.isDirectory())) {
FileOutputStream out = new FileOutputStream(JN_DOCPATH + prj.getID() +"/"+ ze.getName());
InputStream inp = zip.getInputStream(ze);
byte[] buffer = new byte[1024];
int len;
while((len = inp.read(buffer)) >= 0)
out.write(buffer, 0, len);
inp.close();
out.close();
}
}
zip.close();
CurrentStorage.get().storeProjectManager();
}
catch (Exception ex) {
new ExceptionDialog(ex, "Failed to read from "+zipfile, "Make sure that this file is a Memoranda project archive.");
}
}
示例12: unpack
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
public static void unpack(File zipfile) {
try {
ZipFile zip = new ZipFile(zipfile);
ZipEntry info = zip.getEntry("__PROJECT_INFO__");
BufferedReader in = new BufferedReader(new InputStreamReader(zip.getInputStream(info), "UTF-8"));
String pId = in.readLine();
String pTitle = in.readLine();
String pStartD = in.readLine();
String pEndD = in.readLine();
in.close();
if (ProjectManager.getProject(pId) != null) {
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
Local.getString("This project is already exists and will be replaced.\nContinue?"),
Local.getString("Project is already exists"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) {
zip.close();
return;
}
ProjectManager.removeProject(pId);
}
Project prj = ProjectManager.createProject(pId, pTitle, new CalendarDate(pStartD), null);
if (pEndD != null)
prj.setEndDate(new CalendarDate(pEndD));
//File prDir = new File(JN_DOCPATH + prj.getID());
Enumeration files;
for (files = zip.entries(); files.hasMoreElements();){
ZipEntry ze = (ZipEntry)files.nextElement();
if ( ze.isDirectory() )
{
File theDirectory = new File (JN_DOCPATH + prj.getID()+ "/" + ze.getName() );
// create this directory (including any necessary parent directories)
theDirectory.mkdirs();
theDirectory = null;
}
if ((!ze.getName().equals("__PROJECT_INFO__")) && (!ze.isDirectory())) {
FileOutputStream out = new FileOutputStream(JN_DOCPATH + prj.getID() +"/"+ ze.getName());
InputStream inp = zip.getInputStream(ze);
byte[] buffer = new byte[1024];
int len;
while((len = inp.read(buffer)) >= 0)
out.write(buffer, 0, len);
inp.close();
out.close();
}
}
zip.close();
CurrentStorage.get().storeProjectManager();
}
catch (Exception ex) {
new ExceptionDialog(ex, "Failed to read from "+zipfile, "Make sure that this file is a Memoranda project archive.");
}
}
示例13: ppDeleteProject_actionPerformed
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
void ppDeleteProject_actionPerformed(ActionEvent e) {
String msg;
Project prj;
Vector<String> toRemove = new Vector<String>();
if (prjTablePanel.projectsTable.getSelectedRows().length > 1)
msg =
Local.getString("Delete")
+ " "
+ prjTablePanel.projectsTable.getSelectedRows().length
+ " "
+ Local.getString("projects")
+ "\n"
+ Local.getString("Are you sure?");
else {
prj = prjTablePanel.getSelectedProject();
msg =
Local.getString("Delete project")
+ " '"
+ prj.getTitle()
+ "'.\n"
+ Local.getString("Are you sure?");
}
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Delete project"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION)
return;
for (int i = 0;
i < prjTablePanel.projectsTable.getSelectedRows().length;
i++) {
prj =
(net.sf.memoranda.Project) prjTablePanel
.projectsTable
.getModel()
.getValueAt(
prjTablePanel.projectsTable.getSelectedRows()[i],
ProjectsTablePanel.PROJECT);
toRemove.add(prj.getID());
}
for (String remove : toRemove) {
ProjectManager.removeProject(remove);
}
CurrentStorage.get().storeProjectManager();
prjTablePanel.projectsTable.clearSelection();
prjTablePanel.updateUI();
setMenuEnabled(false);
}
示例14: unpack
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
public static void unpack(File zipfile) {
try {
ZipFile zip = new ZipFile(zipfile);
ZipEntry info = zip.getEntry("__PROJECT_INFO__");
BufferedReader in = new BufferedReader(new InputStreamReader(zip.getInputStream(info), "UTF-8"));
String pId = in.readLine();
String pType = in.readLine();
String pTitle = in.readLine();
String pStartD = in.readLine();
String pEndD = in.readLine();
in.close();
if (ProjectManager.getProject(pId) != null) {
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
Local.getString("This project is already exists and will be replaced.\nContinue?"),
Local.getString("Project is already exists"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION) {
zip.close();
return;
}
ProjectManager.removeProject(pId);
}
Project prj = ProjectManager.createProject(pId, Project.Type.valueOf(pType), pTitle, new CalendarDate(pStartD), null);
if (pEndD != null)
prj.setEndDate(new CalendarDate(pEndD));
//File prDir = new File(JN_DOCPATH + prj.getID());
Enumeration files;
for (files = zip.entries(); files.hasMoreElements();){
ZipEntry ze = (ZipEntry)files.nextElement();
if ( ze.isDirectory() )
{
File theDirectory = new File (JN_DOCPATH + prj.getID()+ "/" + ze.getName() );
// create this directory (including any necessary parent directories)
theDirectory.mkdirs();
theDirectory = null;
}
if ((!ze.getName().equals("__PROJECT_INFO__")) && (!ze.isDirectory())) {
FileOutputStream out = new FileOutputStream(JN_DOCPATH + prj.getID() +"/"+ ze.getName());
InputStream inp = zip.getInputStream(ze);
byte[] buffer = new byte[1024];
int len;
while((len = inp.read(buffer)) >= 0)
out.write(buffer, 0, len);
inp.close();
out.close();
}
}
zip.close();
CurrentStorage.get().storeProjectManager();
}
catch (Exception ex) {
new ExceptionDialog(ex, "Failed to read from "+zipfile, "Make sure that this file is a Memoranda project archive.");
}
}
示例15: ppDeleteProject_actionPerformed
import net.sf.memoranda.ProjectManager; //导入方法依赖的package包/类
private void ppDeleteProject_actionPerformed() {
String msg;
Project prj;
Vector<String> toremove = new Vector<String>();
if (prjTablePanel.projectsTable.getSelectedRows().length > 1)
msg =
Local.getString("Delete")
+ " "
+ prjTablePanel.projectsTable.getSelectedRows().length
+ " "
+ Local.getString("projects")
+ "\n"
+ Local.getString("Are you sure?");
else {
prj = prjTablePanel.getSelectedProject();
msg =
Local.getString("Delete project")
+ " '"
+ prj.getTitle()
+ "'.\n"
+ Local.getString("Are you sure?");
}
int n =
JOptionPane.showConfirmDialog(
App.getFrame(),
msg,
Local.getString("Delete project"),
JOptionPane.YES_NO_OPTION);
if (n != JOptionPane.YES_OPTION)
return;
for (int i = 0;
i < prjTablePanel.projectsTable.getSelectedRows().length;
i++) {
prj =
(net.sf.memoranda.Project) prjTablePanel
.projectsTable
.getModel()
.getValueAt(
prjTablePanel.projectsTable.getSelectedRows()[i],
ProjectsTablePanel.PROJECT);
toremove.add(prj.getID());
}
for (String aToremove : toremove) {
ProjectManager.removeProject(aToremove);
}
CurrentStorage.get().storeProjectManager();
prjTablePanel.projectsTable.clearSelection();
prjTablePanel.updateUI();
setMenuEnabled();
}