use of org.vcell.util.document.User in project vcell by virtualcell.
the class VCComprehensiveStatistics method collectBioModelStats.
private void collectBioModelStats(long startDateInMs, long endDateInMs) throws DataAccessException {
retrieveUsers();
List<String> internalDeveloper = Arrays.asList(VCComprehensiveStatistics.INTERNAL_DEVELOPERS);
for (User user : userList) {
if (!userConstraintList.contains(user.getName())) {
continue;
}
if (!internalDeveloper.contains(user.getName())) {
boolean bInternal = internalUsers.contains(user.getName());
ModelStat modelStat = bioModelStats[bInternal ? 0 : 1];
BioModelInfo[] bioModelInfos = dbServerImpl.getBioModelInfos(user, false);
for (BioModelInfo bmi : bioModelInfos) {
Date createDate = bmi.getVersion().getDate();
long t = createDate.getTime();
// }
if (t < startDateInMs || t > endDateInMs) {
continue;
}
// modelStat.count_model ++;
try {
BigString bioModelXML = dbServerImpl.getBioModelXML(user, bmi.getVersion().getVersionKey());
BioModel bioModel = (BioModel) waitForModel(bioModelXML, false);
if (bioModel == null) {
System.out.println("---------- Skipped BioModel " + bmi.getVersion() + " ----------");
continue;
}
modelStat.count_model++;
for (SimulationContext simContext : bioModel.getSimulationContexts()) {
modelStat.count_geoDimApplications[simContext.getGeometry().getDimension()]++;
if (simContext.isStoch()) {
modelStat.count_app_stochastic++;
} else {
modelStat.count_app_deterministic++;
}
}
boolean bHasCompletedSim = false;
for (Simulation sim : bioModel.getSimulations()) {
SimulationStatusPersistent ss = dbServerImpl.getSimulationStatus(sim.getKey());
if (ss != null) {
for (int scan = 0; scan < sim.getScanCount(); scan++) {
SimulationJobStatusPersistent jobStatus = ss.getJobStatus(scan);
if (jobStatus != null) {
if (jobStatus.getSchedulerStatus() == SchedulerStatus.COMPLETED) {
bHasCompletedSim = true;
long elapsed = jobStatus.getEndDate().getTime() - jobStatus.getStartDate().getTime();
if (elapsed < 2 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[0]++;
} else if (elapsed < 5 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[1]++;
} else if (elapsed < 20 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[2]++;
} else if (elapsed < HOUR_IN_MS) {
modelStat.runningTimeHistogram[3]++;
} else if (elapsed < DAY_IN_MS) {
modelStat.runningTimeHistogram[4]++;
} else {
modelStat.runningTimeHistogram[5]++;
}
}
int dimension = sim.getMathDescription().getGeometry().getDimension();
modelStat.count_geoDimSim[dimension]++;
if (sim.getMathDescription().isNonSpatialStoch() || sim.getMathDescription().isSpatialStoch()) {
modelStat.count_sim_stochastic++;
} else {
modelStat.count_sim_deterministic++;
}
if (dimension > 0) {
if (sim.getSolverTaskDescription().getSolverDescription().isSemiImplicitPdeSolver()) {
modelStat.count_semiSim++;
} else {
modelStat.count_fullySim++;
}
}
}
}
}
}
if (bHasCompletedSim) {
modelStat.count_model_simcomplete++;
}
} catch (Exception e2) {
e2.printStackTrace(System.out);
}
}
}
}
itemCount++;
statOutputPW.println(itemCount + ". BioModel Statistics ");
statOutputPW.println("====================================================");
for (ModelStat modelStat : bioModelStats) {
statOutputPW.println("\t" + modelStat.title);
statOutputPW.println("========================================");
statOutputPW.println("number of biomodels saved :\t" + modelStat.count_model);
statOutputPW.println("number of biomodels that has at least 1 completed simulation :\t" + modelStat.count_model_simcomplete);
statOutputPW.println();
statOutputPW.println("Application statistics :");
statOutputPW.println("number of application ODE :\t" + modelStat.count_geoDimApplications[0]);
statOutputPW.println("number of application 1D :\t" + modelStat.count_geoDimApplications[1]);
statOutputPW.println("number of application 2D :\t" + modelStat.count_geoDimApplications[2]);
statOutputPW.println("number of application 3D :\t" + modelStat.count_geoDimApplications[3]);
statOutputPW.println("number of application stochastic :\t" + modelStat.count_app_stochastic);
statOutputPW.println("number of application deterministic :\t" + modelStat.count_app_deterministic);
statOutputPW.println();
statOutputPW.println("Simulation statistics (including all simulations (stopped, failed, completed) :");
statOutputPW.println("number of run simulation ODE :\t" + modelStat.count_geoDimSim[0]);
statOutputPW.println("number of run simulation 1D :\t" + modelStat.count_geoDimSim[1]);
statOutputPW.println("number of run simulation 2D :\t" + modelStat.count_geoDimSim[2]);
statOutputPW.println("number of run simulation 3D :\t" + modelStat.count_geoDimSim[3]);
statOutputPW.println("number of run simulation Semi-Implicit :\t" + modelStat.count_semiSim);
statOutputPW.println("number of run simulation Fully-Implicit :\t" + modelStat.count_fullySim);
statOutputPW.println("number of run simulation stochastic :\t" + modelStat.count_sim_stochastic);
statOutputPW.println("number of run simulation deterministic :\t" + modelStat.count_sim_deterministic);
statOutputPW.println();
statOutputPW.println("Running time histogram for completed simulations only:");
statOutputPW.println("0 ~ 2min:\t" + modelStat.runningTimeHistogram[0]);
statOutputPW.println("2 ~ 5min:\t" + modelStat.runningTimeHistogram[1]);
statOutputPW.println("5 ~ 20min:\t" + modelStat.runningTimeHistogram[2]);
statOutputPW.println("20min ~ 1hr:\t" + modelStat.runningTimeHistogram[3]);
statOutputPW.println("1hr ~ 1day:\t" + modelStat.runningTimeHistogram[4]);
statOutputPW.println(">1day:\t" + modelStat.runningTimeHistogram[5]);
statOutputPW.println();
statOutputPW.println();
statOutputPW.flush();
}
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class NewName method run.
/**
* Insert the method's description here.
* Creation date: (5/31/2004 6:04:14 PM)
* @param hashTable java.util.Hashtable
* @param clientWorker cbit.vcell.desktop.controls.ClientWorker
*/
public void run(Hashtable<String, Object> hashTable) throws java.lang.Exception {
DocumentWindowManager documentWindowManager = (DocumentWindowManager) hashTable.get(CommonTask.DOCUMENT_WINDOW_MANAGER.name);
if (documentWindowManager.getUser() == null || User.isGuest(documentWindowManager.getUser().getName())) {
throw new IllegalArgumentException(User.createGuestErrorMessage("saveNewDocument"));
}
VCDocument document = documentWindowManager.getVCDocument();
if (document.getDocumentType() == VCDocumentType.MATHMODEL_DOC) {
if (((MathModelWindowManager) documentWindowManager).hasUnappliedChanges()) {
String msg = "Changes have been made in VCML Editor, please click \"Apply Changes\" or \"Cancel\" to proceed.";
PopupGenerator.showErrorDialog(documentWindowManager, msg);
throw UserCancelException.CANCEL_UNAPPLIED_CHANGES;
}
}
MDIManager mdiManager = (MDIManager) hashTable.get("mdiManager");
String oldName = document.getName();
User user = mdiManager.getFocusedWindowManager().getRequestManager().getDocumentManager().getUser();
DocumentManager documentManager = mdiManager.getFocusedWindowManager().getRequestManager().getDocumentManager();
VCDocumentInfo[] vcDocumentInfos = new VCDocumentInfo[0];
String documentTypeDescription = "unknown";
if (document.getDocumentType() == VCDocumentType.MATHMODEL_DOC) {
documentTypeDescription = "MathModel";
vcDocumentInfos = documentManager.getMathModelInfos();
} else if (document.getDocumentType() == VCDocumentType.BIOMODEL_DOC) {
documentTypeDescription = "BioModel";
vcDocumentInfos = documentManager.getBioModelInfos();
} else if (document.getDocumentType() == VCDocumentType.GEOMETRY_DOC) {
documentTypeDescription = "Geometry";
vcDocumentInfos = documentManager.getGeometryInfos();
}
String newDocumentName = (oldName == null ? "New" + documentTypeDescription : oldName);
while (true) {
newDocumentName = mdiManager.getDatabaseWindowManager().showSaveDialog(document.getDocumentType(), (Component) hashTable.get("currentDocumentWindow"), newDocumentName);
if (newDocumentName == null || newDocumentName.trim().length() == 0) {
newDocumentName = null;
DialogUtils.showWarningDialog((Component) hashTable.get("currentDocumentWindow"), "New " + documentTypeDescription + " name cannot be empty.");
continue;
}
// Check name conflict
boolean bNameConflict = false;
for (int i = 0; i < vcDocumentInfos.length; i++) {
if (vcDocumentInfos[i].getVersion().getOwner().compareEqual(user)) {
if (vcDocumentInfos[i].getVersion().getName().equals(newDocumentName)) {
bNameConflict = true;
break;
}
}
}
if (bNameConflict) {
DialogUtils.showWarningDialog((Component) hashTable.get("currentDocumentWindow"), "A " + documentTypeDescription + " with name '" + newDocumentName + "' already exists. Choose a different name.");
continue;
} else {
break;
}
}
hashTable.put("newName", newDocumentName);
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class VCellClientDataServiceImpl method getVtkManager.
@Override
public VtkManager getVtkManager(SimulationDataSetRef simulationDataSetRef) throws FileNotFoundException, DataAccessException {
VCSimulationDataIdentifier vcSimulationDataIdentifier = getVCSimulationDataIdentifier(simulationDataSetRef);
VtkManager vtkManager = null;
if (!simulationDataSetRef.isLocal) {
vtkManager = vcellClient.getRequestManager().getVtkManager(null, vcSimulationDataIdentifier);
} else {
// ---- preliminary : construct the localDatasetControllerProvider
File primaryDir = ResourceUtil.getLocalRootDir();
User usr = User.tempUser;
DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(null, primaryDir, null);
ExportServiceImpl localExportServiceImpl = new ExportServiceImpl();
LocalDataSetControllerProvider localDSCProvider = new LocalDataSetControllerProvider(usr, dataSetControllerImpl, localExportServiceImpl);
VCDataManager vcDataManager = new VCDataManager(localDSCProvider);
vtkManager = new VtkManager(null, vcDataManager, vcSimulationDataIdentifier);
}
return vtkManager;
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class DocumentWindow method updateConnectionStatus.
/**
* Insert the method's description here.
* Creation date: (5/10/2004 4:32:17 PM)
*/
public void updateConnectionStatus(ConnectionStatus connStatus) {
// other updates
String status = "";
User user = getWindowManager().getUser();
boolean isTestUser = (user != null) ? (user.isTestAccount()) : (false);
switch(connStatus.getStatus()) {
case ConnectionStatus.NOT_CONNECTED:
{
status = "";
getJProgressBarConnection().setString("NOT CONNECTED");
getJProgressBarConnection().setValue(0);
getChange_UserMenuItem().setEnabled(true);
getUpdate_UserMenuItem().setEnabled(false);
getReconnectMenuItem().setEnabled(false);
getViewJobsMenuItem().setEnabled(false);
enableOpenMenuItems(false);
getSaveMenuItem().setEnabled(false);
getSave_AsMenuItem().setEnabled(false);
getSave_AsLocalMenuItem().setEnabled(true);
getSave_VersionMenuItem().setEnabled(false);
getJMenuItemRevert().setEnabled(false);
getJMenuItemCompare().setEnabled(false);
// getJMenuItemServer().setEnabled(true);
getTestingFrameworkMenuItem().setVisible(isTestUser);
getTestingFrameworkMenuItem().setEnabled(false);
getJMenuItemFieldData().setEnabled(false);
getPermissionsMenuItem().setEnabled(false);
getGrantPermissionsToVCellSupportMenuItem().setEnabled(false);
checkForReconnecting(connStatus);
break;
}
case ConnectionStatus.CONNECTED:
{
status = "Server: " + connStatus.getApihost() + ":" + connStatus.getApiport() + " User: " + connStatus.getUserName();
getJProgressBarConnection().setString("CONNECTED (" + connStatus.getUserName() + ")");
getJProgressBarConnection().setValue(100);
getChange_UserMenuItem().setEnabled(true);
getUpdate_UserMenuItem().setEnabled(true);
getReconnectMenuItem().setEnabled(true);
getViewJobsMenuItem().setEnabled(true);
enableOpenMenuItems(true);
boolean bVersionedDocument = getWindowManager() != null && getWindowManager().getVCDocument() != null && getWindowManager().getVCDocument().getVersion() != null;
getSaveMenuItem().setEnabled(bVersionedDocument && !(getWindowManager().getVCDocument().getVersion().getFlag().compareEqual(VersionFlag.Archived) || getWindowManager().getVCDocument().getVersion().getFlag().compareEqual(VersionFlag.Published)));
getSave_AsMenuItem().setEnabled(true);
getSave_AsLocalMenuItem().setEnabled(true);
getSave_VersionMenuItem().setEnabled(bVersionedDocument);
getJMenuItemRevert().setEnabled(bVersionedDocument);
getJMenuItemCompare().setEnabled(bVersionedDocument);
// getJMenuItemServer().setEnabled(true);
getTestingFrameworkMenuItem().setVisible(isTestUser);
getTestingFrameworkMenuItem().setEnabled(true);
getJMenuItemFieldData().setEnabled(true);
// getJMenuItemMIRIAM().setEnabled(true);
getJMenuItemPreferences().setEnabled(true);
getTransMAMenuItem().setEnabled(getWindowManager() != null && getWindowManager().getVCDocument() != null && getWindowManager().getVCDocument() instanceof BioModel);
getViewJobsMenuItem().setEnabled(true);
// getJMenuImportPathway().setEnabled(getWindowManager().getVCDocument() instanceof BioModel);
getPermissionsMenuItem().setEnabled(bVersionedDocument && getWindowManager().getVCDocument().getVersion().getOwner().equals(getWindowManager().getUser()));
getGrantPermissionsToVCellSupportMenuItem().setEnabled(bVersionedDocument && getWindowManager().getVCDocument().getVersion().getOwner().equals(getWindowManager().getUser()));
break;
}
case ConnectionStatus.INITIALIZING:
{
status = "Server: " + connStatus.getApihost() + ":" + connStatus.getApiport() + " User: " + connStatus.getUserName();
getJProgressBarConnection().setString("INITIALIZING...");
getJProgressBarConnection().setValue(0);
getChange_UserMenuItem().setEnabled(false);
getUpdate_UserMenuItem().setEnabled(false);
getReconnectMenuItem().setEnabled(false);
enableOpenMenuItems(false);
getSave_AsLocalMenuItem().setEnabled(true);
getSaveMenuItem().setEnabled(false);
getSave_AsMenuItem().setEnabled(false);
getSave_AsLocalMenuItem().setEnabled(true);
getSave_VersionMenuItem().setEnabled(false);
getJMenuItemRevert().setEnabled(false);
getJMenuItemCompare().setEnabled(false);
// getJMenuItemServer().setEnabled(false);
getTestingFrameworkMenuItem().setVisible(isTestUser);
getTestingFrameworkMenuItem().setEnabled(isTestUser);
getJMenuItemFieldData().setEnabled(false);
// getJMenuItemMIRIAM().setEnabled(false);
getJMenuItemPreferences().setEnabled(false);
getPermissionsMenuItem().setEnabled(false);
getGrantPermissionsToVCellSupportMenuItem().setEnabled(false);
break;
}
case ConnectionStatus.DISCONNECTED:
{
status = "Server: " + connStatus.getApihost() + ":" + connStatus.getApiport() + " User: " + connStatus.getUserName();
getJProgressBarConnection().setString("DISCONNECTED");
getJProgressBarConnection().setValue(0);
getChange_UserMenuItem().setEnabled(true);
getUpdate_UserMenuItem().setEnabled(false);
getReconnectMenuItem().setEnabled(true);
enableOpenMenuItems(false);
getSave_AsLocalMenuItem().setEnabled(true);
getSaveMenuItem().setEnabled(false);
getSave_AsMenuItem().setEnabled(false);
getSave_VersionMenuItem().setEnabled(false);
getJMenuItemRevert().setEnabled(false);
getJMenuItemCompare().setEnabled(false);
// getJMenuItemServer().setEnabled(true);
getTestingFrameworkMenuItem().setVisible(isTestUser);
getTestingFrameworkMenuItem().setEnabled(false);
getJMenuItemFieldData().setEnabled(false);
// getJMenuItemMIRIAM().setEnabled(false);
getJMenuItemPreferences().setEnabled(false);
getPermissionsMenuItem().setEnabled(false);
getGrantPermissionsToVCellSupportMenuItem().setEnabled(false);
checkForReconnecting(connStatus);
break;
}
}
getJProgressBarConnection().setToolTipText(status);
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class MathModelCellRenderer method getTreeCellRendererComponent.
/**
* Insert the method's description here.
* Creation date: (7/27/2000 6:41:57 PM)
* @return java.awt.Component
*/
public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
JLabel component = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
//
try {
if (value instanceof UserNameNode) {
UserNameNode node = (UserNameNode) value;
String label = (String) node.getUserObject();
String qualifier = "";
if (sessionUser != null && sessionUser.getName().contentEquals(label)) {
String colorString = (sel) ? "white" : "#8B0000";
qualifier = "<font color=\"" + colorString + "\"><b>" + label + "</b></font>";
} else {
String colorString = (sel) ? "white" : "black";
qualifier = "<font color=\"" + colorString + "\">" + label + "</font>";
}
component.setToolTipText(label);
component.setText("<html>" + qualifier + " (" + node.getChildCount() + ")" + "</html>");
component.setIcon(fieldFolderUserIcon);
} else if (value instanceof PublicationInfoNode) {
BioModelNode node = (PublicationInfoNode) value;
PublicationInfo pi = (PublicationInfo) node.getUserObject();
String label = pi.getTitle();
String name = "";
if (pi.getAuthors() != null && pi.getAuthors().length > 0) {
name = pi.getAuthors()[0];
}
if (name.contains(",")) {
name = name.substring(0, name.indexOf(","));
}
int year = Integer.parseInt((new SimpleDateFormat("yyyy")).format(pi.getPubDate()));
String label2 = name + " " + year + " " + label;
int maxLen = MaxPublicationLabelLength + (node.getChildCount() > 1 ? 0 : 4);
if (label2.length() > maxLen) {
label2 = label2.substring(0, maxLen) + "...";
}
if (node.getChildCount() > 1) {
String prefix = sel ? "" : "<span style=\"color:#8B0000\">";
String suffix = sel ? "" : "</span>";
label += prefix + " (" + node.getChildCount() + ")" + suffix;
label2 += prefix + " (" + node.getChildCount() + ")" + suffix;
}
component.setText("<html>" + label2 + "</html>");
component.setToolTipText("<html>" + label + "</html>");
if (pi.getPubDate().compareTo(Calendar.getInstance().getTime()) > 0) {
// sanity check
setIcon(fieldFolderWarningIcon);
} else if (pi.getDoi() == null) {
setIcon(fieldFolderWarningIcon);
} else if (name.contains(" ")) {
setIcon(fieldFolderWarningIcon);
} else {
// publications have their own icon
setIcon(fieldPublishedPublicationIcon);
}
} else if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
Object userObject = node.getUserObject();
if (userObject instanceof User) {
String label = null;
if (sessionUser != null && sessionUser.compareEqual((User) userObject)) {
label = "My MathModels (" + ((User) userObject).getName() + ") (" + node.getChildCount() + ")";
} else {
label = ((User) userObject).getName() + " ";
}
component.setToolTipText(label);
component.setText(label);
} else if (userObject instanceof MathModelInfo) {
// a math model version
MathModelInfo mathModelInfo = (MathModelInfo) userObject;
if (mathModelInfo.getPublicationInfos() != null && mathModelInfo.getPublicationInfos().length > 0) {
if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Published)) {
component.setText("(Published) " + component.getText());
} else {
component.setText("(Curated) " + component.getText());
}
} else if (mathModelInfo.getVersion().getFlag().compareEqual(org.vcell.util.document.VersionFlag.Archived)) {
component.setText("(Archived) " + component.getText());
}
String str = component.getToolTipText();
if (str != null && !str.isEmpty()) {
component.setToolTipText(str + " " + mathModelInfo.getVersion().getVersionKey());
}
// we change color of version if it's in the Other folder (Uncurated) and belongs to login user
Object pNode = node.getParent();
if (pNode instanceof BioModelNode) {
pNode = ((BioModelNode) pNode).getParent();
if (pNode instanceof BioModelNode && ((BioModelNode) pNode).getUserObject() instanceof String) {
str = (String) ((BioModelNode) pNode).getUserObject();
pNode = ((BioModelNode) pNode).getParent();
if (((BioModelNode) pNode).getUserObject() instanceof String && str.equalsIgnoreCase(sessionUser.getName())) {
str = (String) ((BioModelNode) pNode).getUserObject();
if (str.equals(VCDocumentDbTreeModel.Other_MathModels)) {
// GRAY
String prefix = sel ? "" : "<span style=\"color:#808080\">";
String suffix = sel ? "" : "</span>";
String str1 = prefix + component.getText() + suffix;
setText("<html>" + str1 + "</html>");
}
}
}
}
} else if (userObject instanceof VCDocumentInfoNode) {
VCDocumentInfoNode infonode = (VCDocumentInfoNode) userObject;
User nodeUser = infonode.getVCDocumentInfo().getVersion().getOwner();
String modelName = infonode.getVCDocumentInfo().getVersion().getName();
String username = nodeUser.getName();
if (username.equals(VCDocumentDbTreeModel.USER_tutorial)) // || username.equals(VCDocumentDbTreeModel.USER_Education)
{
if (node.getParent() instanceof BioModelNode && ((BioModelNode) node.getParent()).getUserObject() instanceof String) {
String pName = (String) ((BioModelNode) node.getParent()).getUserObject();
if (pName.equals(VCDocumentDbTreeModel.Curated_MathModels)) {
// we add the user name to Curated
setText("<html><b>" + nodeUser.getName() + " </b> : " + modelName + "</html>");
} else {
// keep it simple for Education and Tutorial
component.setText(modelName);
}
} else {
component.setText(modelName);
}
} else if (nodeUser.compareEqual(sessionUser)) {
Object pNode = node.getParent();
if (pNode instanceof BioModelNode) {
BioModelNode parent = (BioModelNode) pNode;
if (parent.getUserObject() instanceof String) {
// the Published, Curated and Other folders are the only
// ones where the parent user object is a String
String str = (String) parent.getUserObject();
if (str.equals(VCDocumentDbTreeModel.Published_MathModels) || str.equals(VCDocumentDbTreeModel.Curated_MathModels)) /*|| str.equals(VCDocumentDbTreeModel.Other_MathModels)*/
{
String prefix = sel ? "" : "<span style=\"color:#8B0000\">";
String suffix = sel ? "" : "</span>";
setText("<html><b>" + prefix + nodeUser.getName() + suffix + "</b> : " + modelName + "</html>");
} else {
// in the Other folder / owner folder
// GRAY
String prefix = sel ? "" : "<span style=\"color:#808080\">";
String suffix = sel ? "" : "</span>";
String str1 = prefix + modelName + suffix;
if (node.getChildCount() > 1) {
prefix = sel ? "" : "<span style=\"color:#8B0000\">";
suffix = sel ? "" : "</span>";
str1 += prefix + " (" + node.getChildCount() + ")" + suffix;
}
// the name of the model container - which holds the versions
setText("<html>" + str1 + "</html>");
}
} else if (parent.getUserObject() instanceof PublicationInfo) {
String prefix = sel ? "" : "<span style=\"color:#8B0000\">";
String suffix = sel ? "" : "</span>";
setText("<html><b>" + prefix + nodeUser.getName() + suffix + "</b> : " + modelName + "</html>");
} else {
String str = modelName;
if (node.getChildCount() > 1) {
String prefix = sel ? "" : "<span style=\"color:#8B0000\">";
String suffix = sel ? "" : "</span>";
str += prefix + " (" + node.getChildCount() + ")" + suffix;
}
setText("<html>" + str + "</html>");
}
} else {
// unreachable
setText(modelName);
}
} else {
Object pNode = node.getParent();
if (pNode instanceof UserNameNode) {
// if we are inside an UserName folder (like Shared or Uncurated public),
// don't prefix again the model with the user name
String str = modelName;
if (node.getChildCount() > 1) {
String prefix = sel ? "" : "<span style=\"color:#8B0000\">";
String suffix = sel ? "" : "</span>";
str += prefix + " (" + node.getChildCount() + ")" + suffix;
}
setText("<html>" + str + "</html>");
} else {
// content of "Published" folder
setText("<html><b>" + nodeUser.getName() + " </b> : " + modelName + "</html>");
}
}
}
}
} catch (Throwable e) {
e.printStackTrace(System.out);
}
//
if (component.getToolTipText() == null || component.getToolTipText().length() == 0) {
component.setToolTipText(component.getText());
}
return component;
}
Aggregations