/** ************************************************************************* * * Command */ public void doAdd() { UserTreePathStopCreationDialog scd = new UserTreePathStopCreationDialog(appState_); scd.setVisible(true); if (!scd.haveResult()) { return; } String addToPathKey = scd.getChosenPath(); String insertMode = scd.getInsertionMode(); appState_.getPathController().addAStop(addToPathKey, insertMode, dacx_); appState_.getPathControls().handlePathButtons(); return; }
/** ************************************************************************* * * Constructor */ protected BTStashResultsDialog( BTState appState, String titleResource, Dimension size, int columns) { super(appState.getTopFrame(), appState.getRMan().getString(titleResource), true); haveResult_ = false; appState_ = appState; rMan_ = appState_.getRMan(); setSize(size.width, size.height); cp_ = (JPanel) getContentPane(); cp_.setBorder(new EmptyBorder(20, 20, 20, 20)); cp_.setLayout(new GridBagLayout()); gbc_ = new GridBagConstraints(); rowNum_ = 0; ds_ = new DialogSupport(this, appState_, gbc_); columns_ = columns; }
/** ************************************************************************* * * Command */ public void doRemove() { if (appState_.getPathController().pathHasOnlyOneStop()) { ResourceManager rMan = appState_.getRMan(); int ok = JOptionPane.showConfirmDialog( appState_.getTopFrame(), rMan.getString("treePathDeleteStop.oneStopWarningMessage"), rMan.getString("treePathDeleteStop.oneStopWarningMessageTitle"), JOptionPane.YES_NO_OPTION); if (ok != JOptionPane.YES_OPTION) { return; } } appState_.getPathController().deleteCurrentStop(dacx_); appState_.getPathControls().handlePathButtons(); return; }
/** ************************************************************************* * * Do the step */ private DialogAndInProcessCmd stepToProcess() { if (doAdd) { doAdd(); } else { doRemove(); } appState_.getPathControls().handlePathButtons(); return (new DialogAndInProcessCmd(DialogAndInProcessCmd.Progress.DONE, this)); }
/** * ************************************************************************* * * Show the * expression key */ public static void expressionKeyCSV(BTState appState, PrintWriter out, boolean encodeConfidence) { ResourceManager rMan = appState.getRMan(); out.println("\"\""); out.println("\"\""); out.print("\""); out.print(rMan.getString("csvTcdExport.keyTitle")); out.println("\""); out.print("\""); out.print(rMan.getString((encodeConfidence) ? "csvTcdExport.var" : "csvTcdExport.varNC")); out.println("\""); out.print("\""); out.print(rMan.getString("csvTcdExport.number")); out.print("\",\""); out.print(rMan.getString("csvTcdExport.level")); if (encodeConfidence) { out.print("\",\""); out.print(rMan.getString("csvTcdExport.confidence")); } out.println("\""); out.print("0,\""); out.print(rMan.getString("csvTcdExport." + mapExpression(NO_DATA))); if (encodeConfidence) { out.print("\",\""); out.print(rMan.getString("csvTcdExport.nA")); } out.println("\""); int topConf = (encodeConfidence) ? (TimeCourseGene.NUM_CONFIDENCE - 1) : TimeCourseGene.NORMAL_CONFIDENCE; int confLev = 1; for (int i = 0; i <= topConf; i++) { String conf = rMan.getString("csvTcdExportConf." + TimeCourseGene.mapConfidence(i)); int expLev = 0; for (int j = 0; j < NUM_EXPRESSIONS; j++) { if ((j != NO_DATA) && (j != VARIABLE)) { String expr = rMan.getString("csvTcdExport." + mapExpression(j)); int totLev = (expLev++) + confLev; out.print(totLev); out.print(",\""); out.print(expr); if (encodeConfidence) { out.print("\",\""); out.print(conf); } out.println("\""); } } confLev += expLev; } return; }
/** ************************************************************************* * * Constructor */ public HaloLayoutSetupPanel( BTState appState, Genome genome, String selectedID, HaloLayout halo, HaloLayout.HaloLayoutParams params) { appState_ = appState; haveResult_ = false; params_ = (HaloLayout.HaloLayoutParams) params.clone(); params_.selected = selectedID; ResourceManager rMan = appState_.getRMan(); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); if ((params_.selected != null) && !halo.selectionIsValid(genome, params_.selected)) { params_.selected = null; } JLabel strategyLabel = new JLabel(rMan.getString("haloLayout.strategyType")); strategyCombo_ = new JComboBox(HaloLayout.StartSeed.getChoices(appState_, params_.selected != null)); UiUtil.gbcSet(gbc, 0, 0, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0); add(strategyLabel, gbc); UiUtil.gbcSet(gbc, 1, 0, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0); add(strategyCombo_, gbc); JLabel overlayLabel = new JLabel(rMan.getString("haloLayout.overlayOptions")); Vector<ChoiceContent> relayoutChoices = NetOverlayProperties.getRelayoutOptions(appState); overlayOptionCombo_ = new JComboBox(relayoutChoices); boolean activate = (genome == null) || (genome.getNetworkOverlayCount() > 0); if (!activate) { overlayLabel.setEnabled(false); overlayOptionCombo_.setEnabled(false); } UiUtil.gbcSet(gbc, 0, 1, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0); add(overlayLabel, gbc); UiUtil.gbcSet(gbc, 1, 1, 1, 1, UiUtil.HOR, 0, 0, 5, 5, 5, 5, UiUtil.CEN, 1.0, 0.0); add(overlayOptionCombo_, gbc); }
/** * ************************************************************************* * * Do the * relocation */ private DialogAndInProcessCmd stepRelocateSource() { // // Go and find if we intersect anything. // List<Intersection.AugmentedIntersection> augs = appState_.getGenomePresentation().intersectItem(x, y, rcxT_, true, false); Intersection.AugmentedIntersection ai = (new IntersectionChooser(true, rcxT_)).selectionRanker(augs); Intersection inter = ((ai == null) || (ai.intersect == null)) ? null : ai.intersect; // // If we don't intersect anything, we need to bag it. // if (inter == null) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } Object sub = inter.getSubID(); if (sub == null) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } String id = inter.getObjectID(); Node node = rcxT_.getGenome().getNode(id); if (node == null) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } if (!(sub instanceof Intersection.PadVal)) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } List<Intersection.PadVal> pads = inter.getPadCand(); if (LinkSupport.changeLinkSource(appState_, intersect, inter, pads, id, rcxT_)) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.ACCEPT, this)); } else { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } }
/** * ************************************************************************* * * Build display * name */ public static String buildMaternalDisplayName(BTState appState, String name) { String format = appState.getRMan().getString("expressionChannel.maternalSource"); String desc = MessageFormat.format(format, new Object[] {name}); return (desc); }
/** ************************************************************************* * * Constructor */ public ExpressionEntry( BTState appState, String region, String time, String expr, String source, String confidence, String strategySource, String startStrategy, String endStrategy, String variable) throws IOException { region_ = region; try { time_ = Integer.parseInt(time); } catch (NumberFormatException nfex) { throw new IOException(); } TimeAxisDefinition tad = appState.getDB().getTimeAxisDefinition(); if (!tad.timeIsOk(time_)) { throw new IOException(); } if (expr == null) { throw new IOException(); } else { expr = expr.trim(); try { expr_ = mapFromExpressionTag(expr); } catch (IllegalArgumentException iaex) { throw new IOException(); } } if (expr_ == VARIABLE) { if (variable == null) { throw new IOException(); } try { variable_ = Double.parseDouble(variable); } catch (NumberFormatException nfex) { throw new IOException(); } if ((variable_ < 0.0) || (variable_ > 1.0)) { throw new IOException(); } } if (source == null) { source_ = NO_SOURCE_SPECIFIED; } else { source = source.trim(); try { source_ = mapFromSourceTag(source); } catch (IllegalArgumentException iaex) { throw new IOException(); } } if (strategySource == null) { strategySource_ = NO_SOURCE_SPECIFIED; } else { strategySource = strategySource.trim(); try { strategySource_ = mapFromSourceTag(strategySource); } catch (IllegalArgumentException iaex) { throw new IOException(); } } if (confidence == null) { confidence_ = TimeCourseGene.USE_BASE_CONFIDENCE; } else { confidence = confidence.trim(); if (confidence.equalsIgnoreCase("normal")) { confidence_ = TimeCourseGene.NORMAL_CONFIDENCE; } else if (confidence.equalsIgnoreCase("interpolated")) { confidence_ = TimeCourseGene.INTERPOLATED; } else if (confidence.equalsIgnoreCase("assumption")) { confidence_ = TimeCourseGene.ASSUMPTION; } else if (confidence.equalsIgnoreCase("inferred")) { confidence_ = TimeCourseGene.INFERRED; } else if (confidence.equalsIgnoreCase("questionable")) { confidence_ = TimeCourseGene.QUESTIONABLE; } else { throw new IOException(); } } try { startStrategy_ = calculateStrategy(startStrategy, true); endStrategy_ = calculateStrategy(endStrategy, false); } catch (IllegalArgumentException iae) { throw new IOException(); } }
/** * ************************************************************************* * * Finish building */ protected void finishConstructionWithMultiExtraLeftButtons(List<JButton> xtraButtonList) { ds_.buildAndInstallButtonBoxWithMultiExtra(cp_, rowNum_, columns_, false, xtraButtonList, true); setLocationRelativeTo(appState_.getTopFrame()); return; }
/** * ************************************************************************* * * Finish building */ protected void finishConstruction() { ds_.buildAndInstallButtonBox(cp_, rowNum_, columns_, false, true); setLocationRelativeTo(appState_.getTopFrame()); return; }
/** * ************************************************************************* * * Do the * relocation */ private DialogAndInProcessCmd stepRelocateModuleSource() { String currentOverlay = rcxT_.oso.getCurrentOverlay(); // // Go and find if we intersect anything. // Intersection intersected = appState_ .getGenomePresentation() .intersectANetModuleElement( x, y, rcxT_, GenomePresentation.NetModuleIntersect.NET_MODULE_LINK_PAD); // // If we don't intersect anything, or the correct thing, we need to bag it. // if (intersected == null) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } String id = intersected.getObjectID(); NetOverlayOwner owner = rcxT_.getGenomeSource().getOverlayOwnerFromGenomeKey(rcxT_.getGenomeID()); NetworkOverlay novr = owner.getNetworkOverlay(currentOverlay); NetModule nm = novr.getModule(id); if (nm == null) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } NetModuleFree.IntersectionExtraInfo ei = (NetModuleFree.IntersectionExtraInfo) intersected.getSubID(); if (ei == null) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } if (ei.type != NetModuleFree.IntersectionExtraInfo.IS_PAD) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } // New point: Point2D padPt = (Point2D) ei.intersectPt.clone(); UiUtil.forceToGrid(padPt, UiUtil.GRID_SIZE); Vector2D toSide = ei.padNorm.scaled(-1.0); String treeID = intersect.getObjectID(); NetModuleLinkageProperties nmlp = rcxT_ .getLayout() .getNetOverlayProperties(currentOverlay) .getNetModuleLinkagePropertiesFromTreeID(treeID); LinkSegmentID[] linkIDs = intersect.segmentIDsFromIntersect(); Set<String> throughSeg = nmlp.resolveLinkagesThroughSegment(linkIDs[0]); int totalLinks = nmlp.getLinkageList().size(); if (throughSeg.size() != totalLinks) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } String myLinkId = throughSeg.iterator().next(); NetModuleLinkage myLink = novr.getLinkage(myLinkId); if (!myLink.getSource().equals(id)) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } // // Pretty lax about links in and out of modules. Only restriction is that // link cannot end on the same pad as it starts (avoids zero-length links!) // Iterator<String> tsit = throughSeg.iterator(); while (tsit.hasNext()) { String linkID = tsit.next(); if (!novr.linkIsFeedback(linkID)) { continue; } Point2D targPt = nmlp.getTargetEnd(linkID, 0.0); if (padPt.equals(targPt)) { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } } // // Undo/Redo support // UndoSupport support = new UndoSupport(appState_, "undo.changeModuleLinkSource"); // // We reject unless the target we are intersecting matches the // link we are trying to relocate. // Layout.PropChange lpc = rcxT_.getLayout().changeNetModuleSource(currentOverlay, treeID, padPt, toSide, rcxT_); if (lpc != null) { PropChangeCmd mov = new PropChangeCmd(appState_, rcxT_, lpc); support.addEdit(mov); support.addEvent( new LayoutChangeEvent(rcxT_.getLayoutID(), LayoutChangeEvent.UNSPECIFIED_CHANGE)); support.finish(); return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.ACCEPT, this)); } else { return (new DialogAndInProcessCmd(ServerControlFlowHarness.ClickResult.REJECT, this)); } }
/** * ************************************************************************* * * Gets a valid * measurement types */ public static ObjChoiceContent getProxySignValue(BTState appState, String proxVal) { return (new ObjChoiceContent(appState.getRMan().getString("proxyTypes." + proxVal), proxVal)); }