Пример #1
0
 /**
  * Function: setCellStyles
  * 
  * Assigns the value for the given key in the styles of the given cells, or
  * removes the key from the styles if the value is null.
  * 
  * Parameters:
  * 
  * model - <mxGraphModel> to execute the transaction in.
  * cells - Array of <mxCells> to be updated.
  * key - Key of the style to be changed.
  * value - New value for the given key.
  */
 static function setCellStyles($model, $cells, $key, $value)
 {
     if ($cells != null && sizeof($cells) > 0) {
         $model->beginUpdate();
         try {
             for ($i = 0; $i < sizeof($cells); $i++) {
                 if (isset($cells[$i])) {
                     $style = mxUtils::setStyle($model->getStyle($cells[$i]), $key, $value);
                     $model->setStyle($cells[$i], $style);
                 }
             }
         } catch (Exception $e) {
             $model->endUpdate();
             throw $e;
         }
         $model->endUpdate();
     }
 }