/** Construct the panel's GUI. */
  private void initGUI() {
    PanelManager mainPanelManager = new PanelManager(this);
    PanelManager destPanelManager = new PanelManager("Destination");
    PanelManager regionPanelManager = new PanelManager("Process");

    ButtonGroup destinationGroup = new ButtonGroup();
    ButtonGroup imageVOIGroup = new ButtonGroup();

    newImageRadio = WidgetFactory.buildRadioButton("New image", true, destinationGroup);
    destPanelManager.add(newImageRadio);
    replaceImageRadio = WidgetFactory.buildRadioButton("Replace image", false, destinationGroup);
    destPanelManager.addOnNextLine(replaceImageRadio);

    // Only if the image is unlocked can it be replaced.
    if (srcImage.getLockStatus() == ModelStorageBase.UNLOCKED) {
      replaceImageRadio.setEnabled(true);
      if (ViewUserInterface.getReference().doForceInPlace()) {
        replaceImageRadio.setSelected(true);
        newImageRadio.setEnabled(false);
      }
    } else {
      replaceImageRadio.setEnabled(false);
    }

    wholeImageRadio = WidgetFactory.buildRadioButton("Whole image", true, imageVOIGroup);
    regionPanelManager.add(wholeImageRadio);
    voiRegionsRadio = WidgetFactory.buildRadioButton("VOI region(s)", false, imageVOIGroup);
    regionPanelManager.addOnNextLine(voiRegionsRadio);

    mainPanelManager.add(destPanelManager.getPanel());
    mainPanelManager.add(regionPanelManager.getPanel());
  }
 public void newwidget(int id, String type, Coord c, int parent, Object... args)
     throws InterruptedException {
   WidgetFactory f;
   if (type.indexOf('/') >= 0) {
     int ver = -1, p;
     if ((p = type.indexOf(':')) > 0) {
       ver = Integer.parseInt(type.substring(p + 1));
       type = type.substring(0, p);
     }
     Resource res = Resource.load(type, ver);
     res.loadwaitint();
     f = res.layer(Resource.CodeEntry.class).get(WidgetFactory.class);
   } else {
     f = Widget.gettype(type);
   }
   synchronized (this) {
     Widget pwdg = widgets.get(parent);
     if (pwdg == null)
       throw (new UIException("Null parent widget " + parent + " for " + id, type, args));
     Widget wdg = f.create(c, pwdg, args);
     bind(wdg, id);
     wdg.binded();
     if (wdg instanceof MapView) mainview = (MapView) wdg;
   }
 }
 public Collection<WidgetMenuItem> getChangeToMenuItems() {
   List<WidgetMenuItem> changeItems = new ArrayList<WidgetMenuItem>();
   List<WidgetFactory> factories = widgetRegistry.getWidgets(type);
   for (int i = 0; i < factories.size(); ++i) {
     final WidgetFactory factory = factories.get(i);
     if (factory instanceof TableWidgetFactory) {
       changeItems.add(
           new WidgetMenuItem.Action(factory.getName()) {
             @Override
             public void execute() {
               TableWidget widget = ((TableWidgetFactory) factory).createWidget(table);
               setWidget(widget);
             }
           });
     }
   }
   return changeItems;
 }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    prevBtn = (Button) getView().findViewById(R.id.mquiz_prev_btn);
    nextBtn = (Button) getView().findViewById(R.id.mquiz_next_btn);
    qText = (TextView) getView().findViewById(R.id.question_text);
    questionImage = (LinearLayout) getView().findViewById(R.id.question_image);

    loadQuiz();
  }
 @Override
 public void onResume() {
   super.onResume();
   loadQuiz();
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putSerializable("widget_config", getWidgetConfig());
 }