/** * Update the values in an interpolated column (a set of three columns * representing a current value along with starting and ending values). * The current value will become the new starting value, while the given * value will become the new current and ending values. * @param item the VisualItem to update * @param field the base field to update, start and ending fields will * also be updated, too. * @param val the value to set */ public static void update(VisualItem item, String field, Object val) { item.set(getStartField(field), item.get(field)); item.set(field, val); item.set(getEndField(field), val); }
public void run (double frac) { VisualItem item = null; SwimlanesStatePalette pal = new SwimlanesStatePalette(); Iterator<?> curr_group_items = this.m_vis.items(this.m_group); while (curr_group_items.hasNext()) { item = (VisualItem) curr_group_items.next(); double start_time = item.getDouble(START_FIELD_NAME); double finish_time = item.getDouble(END_FIELD_NAME); item.setShape(Constants.POLY_TYPE_LINE); item.setX(0.0); item.setY(0.0); float [] coords = new float[4]; coords[0] = (float) cs.get_x_coord(start_time); coords[1] = (float) cs.get_y_coord((double)item.getInt("ycoord")); coords[2] = (float) cs.get_x_coord(finish_time); coords[3] = (float) cs.get_y_coord((double)item.getInt("ycoord")); item.set(VisualItem.POLYGON,coords); item.setStrokeColor(pal.getColour(item.getString("state_name"))); } } } // SwimlanesStateAction
set(item, val, b); String label = i==0 ? m_nf.format(v) : null; item.set(LABEL, label); item.setDouble(VALUE, v);
if ( (r=index.get((double)v)) >= 0 ) { VisualItem item = labels.getItem(r); item.set(VisualItem.LABEL, model.getObject(v).toString()); item.setVisible(true); item.setEndVisible(true); } else { VisualItem item = labels.addItem(); item.set(VisualItem.LABEL, model.getObject(v).toString()); item.setDouble(VisualItem.VALUE, v); double f = pspan==0 ? 0.5 : ((v-m_prevlo)/pspan);
} else { VisualItem item = labels.addItem(); item.set(LABEL, m_nf.format(v)); item.setDouble(VALUE, v); double f = pspan==0 ? 0 : ((v-m_prevlo)/pspan);
/** * Set a data field value for all items in a given data group matching a * given filter predicate. * @param group the visual data group name * @param p the filter predicate determining which items to modify * @param field the data field / column name to set * @param val the value to set */ public void setValue(String group, Predicate p, String field, Object val) { Iterator items = items(group, p); while ( items.hasNext() ) { VisualItem item = (VisualItem)items.next(); item.set(field, val); } }
} else { VisualItem item = labels.addItem(); item.set(LABEL, m_nf.format(v)); item.setDouble(VALUE, v); double f = spspan==0 ? 0 : ((MathLib.safeSqrt(v)-splo)/spspan);
/** * Get the polygon values for a visual item. */ private float[] getPolygon(VisualItem item, String field) { float[] poly = (float[])item.get(field); if ( poly == null || poly.length < 4*columns.length ) { // get oriented int len = columns.length; float inc = (float) (m_horiz?(bounds.getMinY()-bounds.getMaxY()) :(bounds.getMaxX()-bounds.getMinX())); inc /= len-1; float max = (float) (m_horiz ? (m_top?bounds.getMaxX():bounds.getMinX()) : (m_top?bounds.getMinY():bounds.getMaxY())); float min = (float)(m_horiz?bounds.getMaxY():bounds.getMinX()); int bias = (m_horiz ? 1 : 0); // create polygon, populate default values poly = new float[4*len]; Arrays.fill(poly, max); for ( int i=0; i<len; ++i ) { float x = i*inc + min; poly[2*(len+i) +bias] = x; poly[2*(len-1-i)+bias] = x; } item.set(field, poly); } return poly; }
private Params getParams(VisualItem item) { Params rp = (Params)item.get(PARAMS); if ( rp == null ) { rp = new Params(); item.set(PARAMS, rp); } return rp; }
private Params getParams(VisualItem item) { Params rp = (Params)item.get(PARAMS); if ( rp == null ) { rp = new Params(); item.set(PARAMS, rp); } return rp; }
/** * Stops text editing on the display, hiding the text editing widget. If * the text editor was associated with a specific VisualItem (ie one of the * editText() methods which include a VisualItem as an argument was called), * the item is updated with the edited text. */ public void stopEditing() { m_editor.setVisible(false); if ( m_editItem != null ) { String txt = m_editor.getText(); m_editItem.set(m_editAttribute, txt); m_editItem = null; m_editAttribute = null; m_editor.setBackground(null); m_editor.setForeground(null); } m_editing = false; }