protected boolean getShowLinearCurve() throws IOException {
    boolean res = false;

    {
      ConfigFactory f = DefaultConfigFactory.getInstance();
      Config c = f.getConfig();

      String configNameLinearCurve = getConfigNameLinearCurve();
      boolean configValueDefault = false;

      // Set 'configValueDefault':
      {
        String mode = c.getProperty("mode");
        if (mode != null) {
          if ("Test".equals(mode)) {
            configValueDefault = true;
          }
        }
      }

      res = c.getPropertyAsBoolean(configNameLinearCurve, configValueDefault);
    }

    return res;
  }
Example #2
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
    protected void init() {
      // Create link to backing-store:
      {
        BackingStore<String, DSLAMProviderRequest, C> backingStore =
            new DSLAMProviderContextBackingStore();

        setBackingStore(backingStore);
      }

      // Set renew-time and cache-time:
      {
        int renewTime = TIME_RENEW_DEFAULT;
        int cacheTime = TIME_CACHE_DEFAULT;

        {
          try {
            ConfigFactory f = DefaultConfigFactory.getInstance();
            Config c = f.getConfig();

            if (c != null) {
              renewTime =
                  c.getPropertyAsInt("provider.allocator.context-cache.time.renew", renewTime);
              cacheTime =
                  c.getPropertyAsInt("provider.allocator.context-cache.time.cache", cacheTime);
            }
          } catch (IOException ex) {
            // Ignore!
          }
        }

        setRenewTime(renewTime);
        setCacheTime(cacheTime);
      }
    }
Example #4
0
  @Test
  public void testMapRecordEviction() throws InterruptedException {
    int size = 100000;
    Config cfg = new Config();
    MapConfig mc = cfg.getMapConfig("testMapRecordEviction");
    mc.setTimeToLiveSeconds(1);
    final CountDownLatch latch = new CountDownLatch(size);
    mc.addEntryListenerConfig(
        new EntryListenerConfig()
            .setImplementation(
                new EntryAdapter() {
                  public void entryEvicted(EntryEvent event) {
                    latch.countDown();
                  }
                })
            .setLocal(true));

    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    final HazelcastInstance[] instances = factory.newInstances(cfg);

    IMap map = instances[0].getMap("testMapRecordEviction");
    for (int i = 0; i < size; i++) {
      map.put(i, i);
    }
    assertTrue(latch.await(5, TimeUnit.MINUTES));
    assertEquals(0, map.size());
  }
Example #5
0
  /** Create unique Session id. */
  protected String createSessionId() {
    // Use UUID if specified in config (thanks Uli Romahn)
    if (Config.hasProperty(SESSION_ID_GENERATION)
        && Config.getProperty(SESSION_ID_GENERATION).equals(SESSION_ID_GENERATION_UUID)) {
      // We want to be Java 1.4 compatible so use UID class (1.5+ we may
      // use java.util.UUID).
      return new UID().toString();
    }

    // Other cases use random name

    // Create a unique session id
    // In 99.9999 % of the cases this should be generated at once
    // We need the mutext to prevent the chance of creating
    // same-valued ids (thanks Uli Romahn)
    synchronized (mutex) {
      String id;
      while (true) {
        id = Rand.randomName(Config.getIntProperty(SESSION_ID_SIZE));
        if (!hasSession(id)) {
          // Created unique session id
          break;
        }
      }
      return id;
    }
  }
Example #6
0
  @Test
  public void testZeroResetsTTL() throws InterruptedException {
    Config cfg = new Config();
    MapConfig mc = cfg.getMapConfig("testZeroResetsTTL");
    int ttl = 5;
    mc.setTimeToLiveSeconds(ttl);
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
    HazelcastInstance instance = factory.newHazelcastInstance(cfg);
    IMap<Object, Object> map = instance.getMap("testZeroResetsTTL");
    final CountDownLatch latch = new CountDownLatch(1);
    map.addEntryListener(
        new EntryAdapter<Object, Object>() {
          public void entryEvicted(EntryEvent event) {
            latch.countDown();
          }
        },
        false);

    map.put(1, 1);
    map.put(2, 2);
    map.put(1, 2, 0, TimeUnit.SECONDS);
    latch.await(10, TimeUnit.SECONDS);
    assertNull(map.get(2));
    assertEquals(2, map.get(1));
  }
Example #7
0
 void updateProperties() {
   Config config = MCPatcherUtils.config;
   Element mods = config.getMods();
   if (mods == null) {
     return;
   }
   HashMap<String, Element> oldElements = new HashMap<String, Element>();
   while (mods.hasChildNodes()) {
     Node node = mods.getFirstChild();
     if (node instanceof Element) {
       Element element = (Element) node;
       String name = config.getText(element, Config.TAG_NAME);
       if (name != null) {
         oldElements.put(name, element);
       }
     }
     mods.removeChild(node);
   }
   for (Mod mod : modsByIndex) {
     if (mod.internal) {
       continue;
     }
     Element element = oldElements.get(mod.getName());
     if (element == null) {
       defaultModElement(mod);
     } else {
       config.setText(
           element, Config.TAG_ENABLED, Boolean.toString(mod.isEnabled() && mod.okToApply()));
       updateModElement(mod, element);
       mods.appendChild(element);
       oldElements.remove(mod.getName());
     }
   }
 }
 private void switchAccount(boolean login) {
   if (!login) parentView = StaticData.getInstance().roster;
   destroyView();
   Config cf = Config.getInstance();
   cf.accountIndex = cursor;
   cf.saveToStorage();
   Account.loadAccount(login);
 }
Example #9
0
 /**
  * Returns the string to execute, which is determined from the property <code>install.execString
  * </code>. MessageFormat is used to reformat the string. The first argument is the the install
  * path, with the remaining arguments the paths to the extracted files that were downloaded.
  */
 private static String getExecuteString(String[] args) {
   String execString = Config.getExecString();
   if (execString == null) {
     Config.trace("No exec string specified");
     return null;
   }
   String apply = MessageFormat.format(execString, args);
   Config.trace("exec string !" + apply + "!");
   return apply;
 }
Example #10
0
 private AuthToken getAuthTokenForApp(
     HttpServletRequest req, HttpServletResponse resp, boolean doNotSendHttpError)
     throws IOException, ServiceException {
   Config config = Provisioning.getInstance().getConfig();
   int adminPort = config.getIntAttr(Provisioning.A_zimbraAdminPort, 0);
   if (adminPort == req.getLocalPort()) {
     return getAdminAuthTokenFromCookie(req, resp, doNotSendHttpError);
   }
   return getAuthTokenFromCookie(req, resp, doNotSendHttpError);
 }
Example #11
0
 private Element defaultModElement(Mod mod) {
   Config config = MCPatcherUtils.config;
   Element mods = config.getMods();
   if (mods == null) {
     return null;
   }
   Element element = config.getMod(mod.getName());
   config.setText(element, Config.TAG_ENABLED, Boolean.toString(mod.defaultEnabled));
   updateModElement(mod, element);
   return element;
 }
 @Test
 public void testInstance() {
   assertNotNull(instance);
   final Set<Member> members = instance.getCluster().getMembers();
   assertEquals(1, members.size());
   final Member member = members.iterator().next();
   final InetSocketAddress inetSocketAddress = member.getInetSocketAddress();
   assertEquals(5700, inetSocketAddress.getPort());
   assertEquals("test-instance", config.getInstanceName());
   assertEquals("HAZELCAST_ENTERPRISE_LICENSE_KEY", config.getLicenseKey());
 }
Example #13
0
  public static void ajaxEditDocument(Long documentId, String newTitle, String newContent) {
    Document document = Document.findById(documentId);
    document.changeSubject(newTitle);

    Config config = Config.getInstance();
    User currentUser = User.findById(config.getSingedInUserId());
    Version newVersion = new Version(currentUser, document, newContent).save();
    System.out.println("* A new version is successfully created.");

    document.addVersion(newVersion);
    document.save();
  }
 @Test
 public void testProperties() {
   final Properties properties = config.getProperties();
   assertNotNull(properties);
   assertEquals("5", properties.get(GroupProperties.PROP_MERGE_FIRST_RUN_DELAY_SECONDS));
   assertEquals("5", properties.get(GroupProperties.PROP_MERGE_NEXT_RUN_DELAY_SECONDS));
   final Config config2 = instance.getConfig();
   final Properties properties2 = config2.getProperties();
   assertNotNull(properties2);
   assertEquals("5", properties2.get(GroupProperties.PROP_MERGE_FIRST_RUN_DELAY_SECONDS));
   assertEquals("5", properties2.get(GroupProperties.PROP_MERGE_NEXT_RUN_DELAY_SECONDS));
 }
Example #15
0
  @Test
  public void testMapRecordIdleEvictionOnMigration() throws InterruptedException {
    Config cfg = new Config();
    final String name = "testMapRecordIdleEvictionOnMigration";
    MapConfig mc = cfg.getMapConfig(name);
    int maxIdleSeconds = 10;
    int size = 100;
    final int nsize = size / 5;
    mc.setMaxIdleSeconds(maxIdleSeconds);
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(3);

    HazelcastInstance instance1 = factory.newHazelcastInstance(cfg);
    final IMap map = instance1.getMap(name);
    final CountDownLatch latch = new CountDownLatch(size - nsize);
    map.addEntryListener(
        new EntryAdapter() {
          public void entryEvicted(EntryEvent event) {
            latch.countDown();
          }
        },
        false);

    for (int i = 0; i < size; i++) {
      map.put(i, i);
    }
    final Thread thread =
        new Thread(
            new Runnable() {
              public void run() {
                while (!Thread.currentThread().isInterrupted()) {
                  try {
                    for (int i = 0; i < nsize; i++) {
                      map.get(i);
                    }
                    Thread.sleep(1000);
                  } catch (HazelcastInstanceNotActiveException e) {
                    return;
                  } catch (InterruptedException e) {
                    return;
                  }
                }
              }
            });
    thread.start();
    HazelcastInstance instance2 = factory.newHazelcastInstance(cfg);
    HazelcastInstance instance3 = factory.newHazelcastInstance(cfg);

    assertTrue(latch.await(1, TimeUnit.MINUTES));
    Assert.assertEquals(nsize, map.size());

    thread.interrupt();
    thread.join(5000);
  }
Example #16
0
  public void saveStreams() throws IOException {
    Config config = Config.getConfiguration("manager.streams");

    config.setArray("streams", streams.toArray());

    Iterator it = streams.iterator();
    while (it.hasNext()) {
      DataSource ds = (DataSource) it.next();
      ds.save();
    }

    config.save();
  }
 @Test
 public void testExecutorConfig() {
   ExecutorConfig testExecConfig = config.getExecutorConfig("testExec");
   assertNotNull(testExecConfig);
   assertEquals("testExec", testExecConfig.getName());
   assertEquals(2, testExecConfig.getPoolSize());
   assertEquals(100, testExecConfig.getQueueCapacity());
   ExecutorConfig testExec2Config = config.getExecutorConfig("testExec2");
   assertNotNull(testExec2Config);
   assertEquals("testExec2", testExec2Config.getName());
   assertEquals(5, testExec2Config.getPoolSize());
   assertEquals(300, testExec2Config.getQueueCapacity());
 }
Example #18
0
 /**
  * Test for issue 614
  *
  * @throws InterruptedException
  */
 @Test
 public void testContainsKeyShouldDelayEviction() throws InterruptedException {
   Config cfg = new Config();
   String mapname = "testContainsKeyShouldDelayEviction";
   cfg.getMapConfig(mapname).setMaxIdleSeconds(3);
   TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
   HazelcastInstance instance = factory.newHazelcastInstance(cfg);
   IMap<Object, Object> map = instance.getMap(mapname);
   map.put(1, 1);
   for (int i = 0; i < 20; i++) {
     assertTrue(map.containsKey(1));
     Thread.sleep(500);
   }
 }
Example #19
0
  public static void main(String[] args) throws Exception {
    final Config config = Config.loadFromDisk("nexus-importer");
    final HTTPCache http = HttpClient.createHttpCache(config);
    final XmlParser xmlParser = new XmlParser();
    final BoneCPDataSource boneCp = config.createBoneCp();

    XmlParser.debugXml = false;

    ObjectManager<NexusServerDto, ActorRef<NexusServer>> serverManager =
        new ObjectManager<>(
            "Nexus server",
            Collections.<NexusServerDto>emptySet(),
            new ObjectFactory<NexusServerDto, ActorRef<NexusServer>>() {
              public ActorRef<NexusServer> create(NexusServerDto server) {
                final NexusClient client = new NexusClient(http, server.url);

                String name = server.name;

                return ObjectUtil.threadedActor(
                    name,
                    config.nexusUpdateInterval,
                    boneCp,
                    "Nexus Server: " + name,
                    new NexusServer(client, server, xmlParser));
              }
            });

    final AtomicBoolean shouldRun = new AtomicBoolean(true);
    config.addShutdownHook(currentThread(), shouldRun);

    while (shouldRun.get()) {
      try {
        List<NexusServerDto> newKeys;

        try (Connection c = boneCp.getConnection()) {
          newKeys = new NexusDao(c).selectServer();
        }

        serverManager.update(newKeys);
      } catch (SQLException e) {
        e.printStackTrace(System.out);
      }

      synchronized (shouldRun) {
        shouldRun.wait(60 * 1000);
      }
    }

    serverManager.close();
  }
 @SuppressWarnings({"unchecked"})
 @NotNull
 public Config getState() {
   myConfig.tasks =
       ContainerUtil.map(
           myTasks.values(),
           new Function<Task, LocalTaskImpl>() {
             public LocalTaskImpl fun(Task task) {
               return new LocalTaskImpl(task);
             }
           });
   myConfig.servers = XmlSerializer.serialize(getAllRepositories());
   return myConfig;
 }
Example #21
0
  void buildConfigPanel() {
    try {
      Config config = playerObjects.getConfig();
      for (Field field : config.getClass().getDeclaredFields()) {
        Annotation excludeAnnotation = field.getAnnotation(ReflectionHelper.Exclude.class);
        if (excludeAnnotation == null) { // so, this field is not excluded
          Class<?> fieldType = field.getType();
          Method getMethod = getGetMethod(config.getClass(), field.getType(), field.getName());
          if (getMethod != null) {
            Object value = getMethod.invoke(config);
            if (fieldType == String.class) {
              addTextBox(field.getName(), (String) value);
            }
            if (fieldType == boolean.class || fieldType == Boolean.class) {
              addBooleanComponent(field.getName(), (Boolean) value);
            }
            if (fieldType == float.class || fieldType == Float.class) {
              addTextBox(field.getName(), "" + value);
            }
            if (fieldType == int.class || fieldType == Integer.class) {
              addTextBox(field.getName(), "" + value);
            }
          } else {
            playerObjects
                .getLogFile()
                .WriteLine("No get accessor method for config field " + field.getName());
          }
        }
      }
    } catch (Exception e) {
      playerObjects.getLogFile().WriteLine(Formatting.exceptionToStackTrace(e));
    }

    configGridLayout.setRows(configGridLayout.getRows() + 2);

    configRevertButton = new JButton("Revert");
    configReloadButton = new JButton("Reload");
    configApplyButton = new JButton("Apply");
    configSaveButton = new JButton("Save");

    configRevertButton.addActionListener(new ConfigRevert());
    configReloadButton.addActionListener(new ConfigReload());
    configApplyButton.addActionListener(new ConfigApply());
    configSaveButton.addActionListener(new ConfigSave());

    configPanel.add(configRevertButton);
    configPanel.add(configReloadButton);
    configPanel.add(configApplyButton);
    configPanel.add(configSaveButton);
  }
Example #22
0
 private void createAttrConfigForNode(Node selected) {
   Config parent = null;
   if (selected instanceof Config) {
     parent = (Config) selected;
   } else if (selected instanceof AttrConfig) {
     parent = (Config) ((AttrConfig) selected).getParent();
   }
   if (parent != null) {
     String newName = unusedName("Attr", new AttrNameIter(parent));
     String type = ViperData.ViPER_DATA_URI + "svalue";
     AttrValueWrapper params = model.getMediator().getDataFactory().getAttribute(type);
     Node n = parent.createAttrConfig(newName, type, false, null, params);
     select(n);
   }
 }
Example #23
0
  /**
   * Returns the language-dependent label with the given key. The search order is to look first in
   * the extension's <code>label</code> files and if the requested label is not found in the BlueJ
   * system <code>label</code> files. Extensions' labels are stored in a Property format and must be
   * jarred together with the extension. The path searched is equivalent to the bluej/lib/[language]
   * style used for the BlueJ system labels. E.g. to create a set of labels which can be used by
   * English, Italian and German users of an extension, the following files would need to be present
   * in the extension's Jar file:
   *
   * <pre>
   * lib/english/label
   * lib/italian/label
   * lib/german/label
   * </pre>
   *
   * The files named <code>label</code> would contain the actual label key/value pairs.
   *
   * @param key Description of the Parameter
   * @return The label value
   */
  public String getLabel(String key) {
    if (!myWrapper.isValid()) throw new ExtensionUnloadedException();

    // If there are no label for this extension I can only return the system ones.
    if (localLabels == null) return Config.getString(key, key);

    // In theory there are label for this extension let me try to get them
    String aLabel = localLabels.getProperty(key, null);

    // Found what I wanted, job done.
    if (aLabel != null) return aLabel;

    // ok, the only hope is to get it from the system
    return Config.getString(key, key);
  }
 @Test
 public void testQueueConfig() {
   QueueConfig testQConfig = config.getQueueConfig("testQ");
   assertNotNull(testQConfig);
   assertEquals("testQ", testQConfig.getName());
   assertEquals(1000, testQConfig.getMaxSize());
   QueueConfig qConfig = config.getQueueConfig("q");
   assertNotNull(qConfig);
   assertEquals("q", qConfig.getName());
   assertEquals(2500, qConfig.getMaxSize());
   assertEquals(1, testQConfig.getItemListenerConfigs().size());
   ItemListenerConfig listenerConfig = testQConfig.getItemListenerConfigs().get(0);
   assertEquals("com.hazelcast.spring.DummyItemListener", listenerConfig.getClassName());
   assertTrue(listenerConfig.isIncludeValue());
 }
Example #25
0
  public static void zhongbiao(Long id) {
    Toubiao toubiao = Toubiao.findById(id);
    toubiao.status = "1";
    toubiao.save();
    Request request = toubiao.request;
    request.status = 1;
    request.zb = true;
    request.save();
    List<Toubiao> toubiaos = Toubiao.find("request.id=? and id!=?", request.id, id).fetch();
    for (Toubiao tb : toubiaos) {
      tb.status = "2";
      tb.save();
    }
    Config config = Config.find("1=1").first();
    String message = "";
    SendMessage m = new SendMessage();
    message = "您已中标" + toubiao.request.name + "项目,请按时发货";
    if (config.msg_request_invite != null && !"".equals(config.msg_request_invite)) {
      message = config.msg_request_notification.replace("{request}", toubiao.request.name);
    }
    Profile p = toubiao.profile;
    if (p.contact_phone != null && !"".equals(p.contact_phone))
      m.sendSms(p.contact_phone, message, "0000003");
    if (p.contact_email != null && !"".equals(p.contact_email))
      m.sendMail(p.contact_email, "[" + Messages.get("application.name") + "]中标通知", message);

    redirect("/admin/requests");
  }
  protected List<String> getUserRolesFromConfig(String property) throws IOException {
    List<String> res = null;

    {
      if (property != null) {
        ConfigFactory f = DefaultConfigFactory.getInstance();
        Config c = f.getConfig();

        String v = c.getProperty(property); // re-read; marks property read in 'Config'-impl. cache

        res = parseStringList(v);
      }
    }

    return res;
  }
Example #27
0
 private static void main2(String[] args) {
   Config.cmdline(args);
   try {
     javabughack();
   } catch (InterruptedException e) {
     return;
   }
   setupres();
   MainFrame f = new MainFrame(null);
   if (Utils.getprefb("fullscreen", false)) f.setfs();
   f.mt.start();
   try {
     f.mt.join();
   } catch (InterruptedException e) {
     f.g.interrupt();
     return;
   }
   dumplist(Resource.remote().loadwaited(), Config.loadwaited);
   dumplist(Resource.remote().cached(), Config.allused);
   if (ResCache.global != null) {
     try {
       Writer w = new OutputStreamWriter(ResCache.global.store("tmp/allused"), "UTF-8");
       try {
         Resource.dumplist(Resource.remote().used(), w);
       } finally {
         w.close();
       }
     } catch (IOException e) {
     }
   }
   System.exit(0);
 }
  /** Creates a new instance of AccountPicker */
  public AccountSelect(Display display, boolean enableQuit) {
    super();
    // this.display=display;

    setTitleItem(new Title(SR.MS_ACCOUNTS));

    accountList = new Vector();
    Account a;

    int index = 0;
    activeAccount = Config.getInstance().accountIndex;
    do {
      a = Account.createFromStorage(index);
      if (a != null) {
        accountList.addElement(a);
        a.active = (activeAccount == index);
        index++;
      }
    } while (a != null);
    if (accountList.isEmpty()) {
      a = Account.createFromJad();
      if (a != null) {
        // a.updateJidCache();
        accountList.addElement(a);
        rmsUpdate();
      }
    }
    attachDisplay(display);
    addCommand(cmdAdd);

    if (enableQuit) addCommand(cmdQuit);

    commandState();
    setCommandListener(this);
  }
Example #29
0
  public void openDialog(Config config) {
    if (config == null) {
      config = new Config();
    }

    ViewContext viewContext = new ViewContext();
    PropertyView emailType =
        propertyViewManager
            .createPropertyViews("emailType", RecipientType.class, null, viewContext)[0];
    getModel().setEmailType(emailType);
    // MailboxMessageFormat
    getModel()
        .setMailboxMessageFormat(
            propertyViewManager
                .createPropertyViews(
                    "mailboxMessageFormat", MailboxMessageFormat.class, null, viewContext)[0]);
    String t = config.getTitle();

    getModel().setTitle(StringUtils.isEmpty(t) ? "Envoi de Mail" : t);

    Map<String, Object> options = new HashMap<String, Object>();
    options.put("resizable", false);
    options.put("draggable", false);
    options.put("modal", true);

    RequestContext.getCurrentInstance()
        .openDialog("/modules/mailbox/send-external-mail-dialog", options, null);
  }
Example #30
0
    @Override
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

      // Get the renderer component from parent class

      JLabel label =
          (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

      // Get icon to use for the list item value
      Character character = (Character) value;
      Config.ConfigEntry ce = config.get(character.getName());
      Icon icon = null;

      if (ce == null) {
        icon = icons.get(NOTOK);
        label.setToolTipText(
            "Double-click to enter configuration information for this character, right-click for more options");
      } else {
        if (ce.isOk()) {
          icon = icons.get(OK);
          ui.exportAllButton.setEnabled(true);
        } else {
          icon = icons.get(NOTOK);
        }
      }
      // Set icon to display for value

      label.setIcon(icon);
      return label;
    }