// For Real Primitive public void setPrimitiveText(final Primitive prime) { this.setCoordsText(prime.getVertices(), ""); String info_str; info_str = prime.toInfoBoxString().trim(); if (info_str.length() > 0) { strbuf.append("\n" + info_str); num_rows++; } Drawable prime_parent; prime_parent = prime.getParent(); if (prime_parent != null) { info_str = prime_parent.toInfoBoxString().trim(); if (info_str.length() > 0) { strbuf.append("\n" + info_str); num_rows++; } } }
/* finalizeLatestTime() should be invoked BEFORE mergeVerticalShadowBufs() and shiftHorizontalShadowBuf() are called */ public void finalizeLatestTime(final Drawable last_drawable_added) { if (childnode == null) // i.e. if ( super.isLeaf() ) super.setLatestTime(last_drawable_added.getLatestTime()); else // if ( childnode != null ) super.setLatestTime(childnode.getLatestTime()); if (shadowbuf != null) { // After setting the LatestTime, seal the shadows' category weights shadowbuf.setLatestTime(super.getLatestTime()); shadowbuf.initializeMapOfCategoryWeights(); } }
// For Real Composite public void setCompositeText(final Composite cmplx) { Coord[] cmplx_coords; cmplx_coords = new Coord[] {cmplx.getStartVertex(), cmplx.getFinalVertex()}; this.setCoordsText(cmplx_coords, ""); String info_str; info_str = cmplx.toInfoBoxString().trim(); if (info_str.length() > 0) { strbuf.append("\n" + info_str); num_rows++; } Drawable cmplx_parent; cmplx_parent = cmplx.getParent(); if (cmplx_parent != null) { info_str = cmplx_parent.toInfoBoxString().trim(); if (info_str.length() > 0) { strbuf.append("\n" + info_str); num_rows++; } } }
public InfoPanelForDrawable( final Map map_line2treenodes, final String[] y_colnames, final Drawable dobj) { super(); super.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); /* Define DecialFormat for the displayed time */ if (fmt == null) { fmt = (DecimalFormat) NumberFormat.getInstance(); fmt.applyPattern(FORMAT); } if (tfmt == null) tfmt = new TimeFormat(); if (Normal_Border == null) { /* Normal_Border = BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder() ); */ Normal_Border = BorderFactory.createEtchedBorder(); } if (Shadow_Border == null) { Shadow_Border = BorderFactory.createTitledBorder( Normal_Border, " Preview State ", TitledBorder.LEFT, TitledBorder.TOP, Const.FONT, Color.magenta); } drawable = dobj; // Set the CategoryLabel Icon Dimension panel_max_size; Category type = null; CategoryLabel label_type = null; JPanel top_panel = new JPanel(); top_panel.setLayout(new BoxLayout(top_panel, BoxLayout.X_AXIS)); if (drawable instanceof Shadow && ((Shadow) drawable).getSelectedSubCategory() != null) { type = ((Shadow) drawable).getSelectedSubCategory(); label_type = new CategoryLabel(type); ((Shadow) drawable).clearSelectedSubCategory(); top_panel.setBorder(Shadow_Border); } else { type = drawable.getCategory(); label_type = new CategoryLabel(type); top_panel.setBorder(Normal_Border); } top_panel.add(STRUT); top_panel.add(label_type); top_panel.add(GLUE); top_panel.setAlignmentX(Component.LEFT_ALIGNMENT); panel_max_size = top_panel.getPreferredSize(); panel_max_size.width = Short.MAX_VALUE; top_panel.setMaximumSize(panel_max_size); super.add(top_panel); // Determine the text of the drawable TextAreaBuffer textbuf; int num_cols, num_rows; textbuf = new TextAreaBuffer(map_line2treenodes, y_colnames); if (drawable instanceof Shadow) textbuf.setShadowText((Shadow) drawable, type); else if (drawable instanceof Composite) textbuf.setCompositeText((Composite) drawable); else textbuf.setPrimitiveText((Primitive) drawable); textbuf.finalized(); num_cols = textbuf.getColumnCount(); num_rows = textbuf.getRowCount(); // Set the TextArea JTextArea text_area; int adj_num_cols; text_area = new JTextArea(textbuf.toString()); adj_num_cols = Routines.getAdjNumOfTextColumns(text_area, num_cols); num_cols = (int) Math.ceil(adj_num_cols * 85.0d / 100.0d); text_area.setColumns(num_cols); text_area.setRows(num_rows); text_area.setEditable(false); text_area.setLineWrap(true); JScrollPane scroller = new JScrollPane(text_area); scroller.setAlignmentX(Component.LEFT_ALIGNMENT); super.add(scroller); }