private void updateBgImage() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setBackgroundImage(showBgImage ? BG_PATTERN_IMAGE : null);
   }
 }
 private void updateBgColor() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setBackground(bgColors[bgIndex]);
   }
 }
 private void updateEnabled() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setEnabled(enabled);
   }
 }
 private void updateFgColor() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setForeground(fgColors[fgIndex]);
   }
 }
 private void updateVisible() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setVisible(visible);
   }
 }
 private void handleNewFeature() {
   final Control control = fCategoryViewer.getControl();
   BusyIndicator.showWhile(
       control.getDisplay(),
       new Runnable() {
         public void run() {
           IFeatureModel[] allModels = PDECore.getDefault().getFeatureModelManager().getModels();
           ArrayList<IFeatureModel> newModels = new ArrayList<IFeatureModel>();
           for (int i = 0; i < allModels.length; i++) {
             if (canAdd(allModels[i])) newModels.add(allModels[i]);
           }
           IFeatureModel[] candidateModels =
               newModels.toArray(new IFeatureModel[newModels.size()]);
           FeatureSelectionDialog dialog =
               new FeatureSelectionDialog(
                   fCategoryViewer.getTree().getShell(), candidateModels, true);
           if (dialog.open() == Window.OK) {
             Object[] models = dialog.getResult();
             try {
               doAdd(models);
             } catch (CoreException e) {
               PDEPlugin.log(e);
             }
           }
         }
       });
 }
 private void setControlActive(
     List<Control> controlList, List<Control> controlListForTable, String[] controlIds) {
   for (Control control : controlList) {
     control.setActive(false);
     for (int i = 0; i < controlIds.length; i++) {
       if (control.getId() == Long.parseLong(Utils.isEmpty(controlIds[i]) ? "0" : controlIds[i])) {
         control.setActive(true);
       }
     }
     controlListForTable.add(control);
   }
 }
 private void updateFont() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setFont(font);
   }
   // Force layout
   if (controls.size() > 0) {
     Composite parent = ((Control) controls.get(0)).getParent();
     parent.layout(true, true);
   }
 }
 private void showControlGroup(String group, boolean show) {
   List<Control> controlList = propGroupMap.get(group);
   if (controlList != null) {
     for (Control control : controlList) {
       GridData gd = (GridData) control.getLayoutData();
       if (gd == null) {
         gd = new GridData(GridData.BEGINNING);
         control.setLayoutData(gd);
       }
       gd.exclude = !show;
       control.setVisible(show);
     }
   }
 }
 private void updateRoundedBorder(
     final int width,
     final Color color,
     final int topLeft,
     final int topRight,
     final int bottomRight,
     final int bottomLeft) {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     Object adapter = control.getAdapter(IWidgetGraphicsAdapter.class);
     IWidgetGraphicsAdapter gfxAdapter = (IWidgetGraphicsAdapter) adapter;
     gfxAdapter.setRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft);
   }
 }
Exemple #11
0
  /** Adds validation overlay component to the control. */
  private void addValidationOverlay(
      final AttributeDescriptor descriptor,
      final IAttributeEditor editor,
      final Object defaultValue,
      final Control label) {
    final ControlDecoration decoration = new ControlDecoration(label, SWT.LEFT | SWT.BOTTOM);
    decoration.hide();

    final FieldDecoration requiredDecoration =
        FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);

    decoration.setImage(requiredDecoration.getImage());
    decoration.setDescriptionText("Invalid value");

    final IAttributeListener validationListener =
        new InvalidStateDecorationListener(decoration, descriptor, defaultValue);

    globalEventsProvider.addAttributeListener(validationListener);
    editor.addAttributeListener(validationListener);

    label.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            globalEventsProvider.removeAttributeListener(validationListener);
            editor.removeAttributeListener(validationListener);
            decoration.dispose();
          }
        });
  }
 /* (non-Javadoc)
  * @see org.eclipse.pde.internal.core.IPluginModelListener#modelsChanged(org.eclipse.pde.internal.core.PluginModelDelta)
  */
 public void modelsChanged(PluginModelDelta delta) {
   final Control control = fPluginTable.getControl();
   if (!control.isDisposed()) {
     control
         .getDisplay()
         .asyncExec(
             new Runnable() {
               public void run() {
                 if (!control.isDisposed()) {
                   fPluginTable.refresh();
                   updateRemoveButtons(true, true);
                 }
               }
             });
   }
 }
 @Override
 public void update() {
   for (int key : methodMap.keySet()) {
     if (myGame.bsInput.isMousePressed(key)) {
       super.update(key);
     }
   }
 }
 private void updateCursor(final String selection) {
   Cursor cursor = null;
   Class swtClass = SWT.class;
   if (selection != null) {
     try {
       Field field = swtClass.getField(selection);
       int cursorStyle = field.getInt(swtClass);
       cursor = Display.getCurrent().getSystemCursor(cursorStyle);
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setCursor(cursor);
   }
 }
Exemple #15
0
 static void processDoc1(Document doc, int docno) throws IOException {
   // process document
   // System.err.println ("Parsing: "+docno+"/"+doc);
   String script = JetTest.config.getProperty("processDocument");
   // if there is a name tagger, clear its cache
   if (JetTest.nameTagger != null) JetTest.nameTagger.newDocument();
   Span all = new Span(0, doc.length());
   Control.applyScript(doc, all, script);
 }
Exemple #16
0
 /** set tickFlag according to OldTick and NewTick */
 public synchronized void setTicks() {
   tickFlag = (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
   /*
   System.out.println(Scalar + " -> " + DisplayScalar +
                      "  set  tickFlag = " + tickFlag);
   */
   OldTick = NewTick;
   if (control != null) control.setTicks();
 }
 private void updateBgGradient() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     Object adapter = control.getAdapter(IWidgetGraphicsAdapter.class);
     IWidgetGraphicsAdapter gfxAdapter = (IWidgetGraphicsAdapter) adapter;
     if (showBgGradient) {
       Color[] gradientColors =
           new Color[] {
             BGG_COLOR_BLUE, BGG_COLOR_GREEN, BGG_COLOR_BLUE, BGG_COLOR_GREEN, BGG_COLOR_BLUE
           };
       int[] percents = new int[] {0, 25, 50, 75, 100};
       gfxAdapter.setBackgroundGradient(gradientColors, percents);
     } else {
       gfxAdapter.setBackgroundGradient(null, null);
     }
   }
 }
 @RequestMapping(value = "/icga/InternalCtrlGapAnalysisAC.html", method = RequestMethod.POST)
 public String InternalCtrlGapAnalysisACPost(HttpServletRequest request, Model model) {
   logger.debug(" :: InternalCtrlGapAnalysisAC POSt ::");
   String controlIds = "";
   List<Control> controlList = adminService.getAllControl();
   for (Control control : controlList) {
     String checkboxStatus = request.getParameter(control.getId() + "");
     if (checkboxStatus != null && Constants.CHECK_BOX_ON.equals(checkboxStatus)) {
       controlIds = controlIds + "," + control.getId();
     }
   }
   controlIds = Utils.isEmpty(controlIds) ? "" : controlIds.substring(1, controlIds.length());
   logger.debug(" ControlIds : " + controlIds);
   if (Utils.isEmpty(controlIds)) {
     Utils.setErrorMessage(
         request, Utils.getMessageBundlePropertyValue("icga.analyzeByControl.noIdisSelect"));
     return "redirect:./InternalCtrlGapAnalysisAC.html";
   }
   return "redirect:internalCtrlGapAnalysis.html?icga=0&controlIds=" + controlIds;
 }
  public Composite fillGeneralOption(Composite generalTabContent) {

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 3;
    generalTabContent.setLayout(layout);

    XModel model = getXModel();
    if (model == null) model = XModelFactory.getDefaultInstance();
    support.init(model.getRoot(), data);
    Control c = support.createControl(generalTabContent);
    pcl = new PCL();
    support.addPropertyChangeListener(pcl);

    fWizardModel = getSpecificWizard().getWizardModel();
    mpcl = new MPCL();
    fWizardModel.addPropertyChangeListener(mpcl);

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    c.setLayoutData(data);

    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    generalTabContent.setLayoutData(data);

    Label properties = new Label(generalTabContent, SWT.NONE);
    properties.setText(JsfUIMessages.DataTableWizardPage_Properties);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    properties.setLayoutData(data);

    propertyListEditor.setObject(propertyListObject);
    Control propertiesTable = propertyListEditor.createControl(generalTabContent);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 3;
    propertiesTable.setLayoutData(data);

    return generalTabContent;
  }
Exemple #20
0
 public void changeControlState(boolean enabled) {
   if (getControls() == null) return;
   Iterator it = getControls().iterator();
   while (it.hasNext()) {
     ISootOptionWidget control = (ISootOptionWidget) it.next();
     if (control.getControls() == null) continue;
     Iterator conIt = control.getControls().iterator();
     while (conIt.hasNext()) {
       Object obj = conIt.next();
       ((Control) obj).setEnabled(enabled);
     }
   }
 }
  private void createSourceViewer(Composite parent) {
    sourceFileViewer =
        new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER));
    sourceFileViewer.setContentProvider(new WorkbenchContentProvider());
    sourceFileViewer.setLabelProvider(new WorkbenchLabelProvider());
    sourceFileViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            java.util.List list;
            ISelection selection = event.getSelection();
            boolean newFilesSelected = false;

            if (selection instanceof IStructuredSelection) {
              list = ((IStructuredSelection) selection).toList();
              for (Iterator i = list.iterator(); i.hasNext(); ) {
                IResource resource = (IResource) i.next();
                if (resource instanceof IFile) {
                  if (checkIfFileInTarget((IFile) resource) == false) newFilesSelected = true;
                }
              }
              setAddButtonEnabled(newFilesSelected);
            }
          }
        });
    sourceFileViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            addSelectedFilesToTargetList();
          }
        });

    Control treeWidget = sourceFileViewer.getTree();
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = SIZING_LISTS_WIDTH;
    gd.heightHint = SIZING_LISTS_HEIGHT;
    treeWidget.setLayoutData(gd);
  }
Exemple #22
0
  /**
   * Clear the link to the VisAD display. This will subsequently cause {@link #getDisplay()} and
   * {@link #getControl()} to return <code>null</code>; consequently, information stored in the
   * Control might have to be reestablished. This method invokes the method {@link
   * ScalarMapListener#controlChanged(ScalarMapControlEvent)} on all registered {@link
   * ScalarMapListener}s with this instance as the event source, {@link
   * ScalarMapEvent#CONTROL_REMOVED} as the event ID, and the control as the event control.
   *
   * @throws RemoteException Java RMI failure
   * @throws VisADException VisAD failure
   */
  synchronized void nullDisplay() throws RemoteException, VisADException {
    if (control != null) {
      control.nullControl();
      ScalarMapControlEvent evt;
      evt = new ScalarMapControlEvent(this, ScalarMapEvent.CONTROL_REMOVED, control);
      notifyCtlListeners(evt);
    }
    control = null;

    display = null;
    ScalarIndex = -1;
    DisplayScalarIndex = -1;
    scale_flag = back_scale_flag;

    if (axisScale != null) axisScale.setAxisOrdinal(-1);
  }
Exemple #23
0
 /** return true if application called setRange */
 public synchronized boolean checkTicks(DataRenderer r, DataDisplayLink link) {
   if (control == null) {
     /*
     System.out.println(Scalar + " -> " + DisplayScalar + "  check  tickFlag = " +
                        tickFlag);
     */
     return tickFlag;
   } else {
     /*
     boolean cflag = control.checkTicks(r, link);
     System.out.println(Scalar + " -> " + DisplayScalar + "  check  tickFlag = " +
                        tickFlag + " cflag = " + cflag);
     */
     return tickFlag || control.checkTicks(r, link);
   }
 }
Exemple #24
0
 public synchronized boolean peekTicks(DataRenderer r, DataDisplayLink link) {
   if (control == null) {
     /*
     boolean flag = (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
     if (flag) {
       System.out.println(Scalar + " -> " + DisplayScalar + "  peek  flag = " + flag);
     }
     */
     return (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
   } else {
     /*
     boolean flag = (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
     boolean cflag = control.peekTicks(r, link);
     if (flag || cflag) {
       System.out.println(Scalar + " -> " + DisplayScalar + "  peek   flag = " +
                          flag + " cflag = " + cflag);
     }
     */
     return (OldTick < NewTick || (NewTick < 0 && 0 < OldTick)) || control.peekTicks(r, link);
   }
 }
 private void setControlInActive(List<Control> controlList, List<Control> controlListForTable) {
   for (Control control1 : controlList) {
     control1.setActive(false);
     controlListForTable.add(control1);
   }
 }
  /**
   * control list with applied in no of transaction
   *
   * @param request
   * @return
   */
  @RequestMapping(value = "/icga/getJASONforExistingControlList.html", method = RequestMethod.POST)
  public @ResponseBody JasonBean getAssignmentList(HttpServletRequest request) {
    logger.debug("Control List Controller ");
    String page = request.getParameter("page") != null ? request.getParameter("page") : "1";
    String rp = request.getParameter("rp") != null ? request.getParameter("rp") : "10";
    String sortname =
        request.getParameter("sortname") != null ? request.getParameter("sortname") : "projectName";
    String sortorder =
        request.getParameter("sortorder") != null ? request.getParameter("sortorder") : "desc";
    String query = request.getParameter("query") != null ? request.getParameter("query") : "false";
    String qtype = request.getParameter("qtype") != null ? request.getParameter("qtype") : "false";

    String controlIds =
        request.getParameter("controlIds") != null ? request.getParameter("controlIds") : "0";
    String tableName =
        request.getParameter("tableName") != null ? request.getParameter("tableName") : "";

    String controlIdsListAsString = "";

    JasonBean jasonData = new JasonBean();
    List dbColumnHeaderList = new ArrayList();
    int totalControl = 0;
    List controlList = new ArrayList();
    List<Cell> entry = new ArrayList<Cell>();
    List allControlList = new ArrayList<Cell>();
    Map<String, Integer> countMap = new TreeMap<String, Integer>();

    try {
      String partSql =
          !"0".equals(controlIds)
              ? InternalControlGapAnalysisController.getStringForComparingControls(controlIds)
              : "";
      allControlList = adminJdbcService.getControlIdList(controlIds, partSql);
      controlIdsListAsString = getCommaseparatedStringFromList(allControlList);
      String[] controllIdsArray =
          !"0".equals(controlIds)
              ? getUsedControlsByControlIds(controlIds, controlIdsListAsString.split(","))
              : controlIdsListAsString.split(",");

      countMap = countStringOccurences(controllIdsArray, adminJdbcService);
      if (countMap != null && countMap.size() > 0) {
        logger.debug("AMLOG:: countMap size: " + countMap.size());
        jasonData.setPage(Utils.parseInteger(page));

        for (String string : countMap.keySet()) {
          Map map = new HashMap();
          Long controlId = !Utils.isEmpty(string) ? Long.parseLong(string) : 0;
          logger.debug("AMLOG:: controlId: " + controlId);
          //                        Control control = new Control();
          Cell cell = new Cell();
          Control control =
              controlId > 0
                  ? (Control) adminService.loadEntityById(controlId, Constants.CONTROL)
                  : new Control();
          /*control.setId(controlId);
          control.setName(controlName);*/
          control.setTotalUsed(countMap.get(string));
          cell.setCell(control);
          entry.add(cell);

          map.put("control_name", control.getName());
          map.put("transaction_type", control.getTransactionType());
          map.put("total", countMap.get(string));
          controlList.add(map);
        }
        int totalItem = controlList != null ? controlList.size() : 0;

        Map mapForHeader = new HashMap();
        mapForHeader.put(
            "name", "control_name"); // key=flexigrid parameter name, value = dbField Name
        mapForHeader.put("transactionType", "transaction_type");
        mapForHeader.put("totalUsed", "total");
        dbColumnHeaderList.add(mapForHeader);
        request.getSession().setAttribute(tableName, dbColumnHeaderList);

        jasonData.setRows(entry);
        jasonData.setTotal(totalItem);
        jasonData.setDbColumnHeader(dbColumnHeaderList);

        if ("max".equals(rp)) {
          logger.debug("SMN LOG: custom controlList size=" + controlList.size());
          TransactionSearchController.setTotalListSizeAndListInSession(
              totalItem, controlList, request);
        }
      }
    } catch (Exception ex) {
      logger.debug("CERROR: Real Time Project exception : " + ex);
    }

    return jasonData;
  }
Exemple #27
0
 /** reset tickFlag */
 synchronized void resetTicks() {
   // System.out.println(Scalar + " -> " + DisplayScalar + "  reset");
   tickFlag = false;
   if (control != null) control.resetTicks();
 }