attach Summary Attaches a view to the model. Usage public virtual void attach(View view) Parameters view The view to attach to the model. Description Attaches a view to the model. When the model data changes (such as via Model.updateAll()), the attached view(s) will also be updated. Examples Full Example 12345678910111213141516171819202122232425262728293031323334353637383940414243import System;import Altitude.Frontend; // Create the modelclass Temperature : Model{ Date date; double degrees; Temperature(Date date, double degrees) { this.date = date; this.degrees = degrees; } void setDegrees(double degrees) { this.degrees = degrees; }}// Create viewclass BarChart : View{ // ...} // Instantiate modelTemperature temp = new Temperature(new Date(), 27); // Instantiate viewBarChart barChart = new BarChart(); // Attach views to modeltemp.attach(barChart); // Initialize views (perform initial render) to the data in `temp`.// (Assuming data for `temp2` is initially hidden until the user, via// the user interface, enables it.)barChart.initialize(temp); // Change the data from the initial rendertemp.setDegrees(37); // Update all viewstemp.updateAll(); Share HTML | BBCode | Direct Link